2020-09-30 04:12 AM
Hi,
I am creating project in which I need to use LIN bus, I have tried to generate code from cubeMX, I have changed the BaudRate to 19200 in initialization,
see the code from Initialization :
static void MX_USART1_UART_Init(void)
{
huart1.Instance = USART1;
huart1.Init.BaudRate = 19200;
huart1.Init.WordLength = UART_WORDLENGTH_8B;
huart1.Init.StopBits = UART_STOPBITS_1;
huart1.Init.Parity = UART_PARITY_NONE;
huart1.Init.Mode = UART_MODE_TX_RX;
huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart1.Init.OverSampling = UART_OVERSAMPLING_16;
if (HAL_LIN_Init(&huart1, UART_LINBREAKDETECTLENGTH_10B) != HAL_OK)
{
Error_Handler();
}
}
I have created array and tried to send it to the network
uint8_t data[] = {0x05};
while (1)
{
HAL_UART_Transmit(&huart1,data , sizeof(data), HAL_MAX_DELAY);
HAL_Delay(500);
}
I am using LIN transceiver TJA1020,
see the datasheet:
https://www.nxp.com/docs/en/data-sheet/TJA1020.pdf
I have connected NSLP pin to 5V, RX and TX to stm board, BAT pin to 12V, LIN to 12V over diode and 1kR, and when I am trying to catch the signal over oscilloscope I can see only the wakeup signal, but no data are tranfered, beyond the transceiver
Thank you very much for your time reading this, and I hope you can help me
i would really appreciate any help