AnsweredAssumed Answered

STM32F429 LIN usage

Question asked by Fabrizio Pizzolato on Sep 14, 2017
Latest reply on Sep 15, 2017 by Fabrizio Pizzolato

Hi all, I have a problema using STM32F429 USART Hal functions in conjunction with a LIN device, using USART1.

 

I configure the peripheral as any other UART in the project, using a pattern like:

 

LinPinInit()

{

   ...

}
LinEnable(LIN_ENABLE)

{

   ...

}
LinUartInit(9600)

{

   ...

   HAL_LIN_Init(&LinUart, UART_LINBREAKDETECTLENGTH_10B);

   HAL_NVIC_SetPriority(LIN_UART_IRQ, 5, 0);   
   HAL_NVIC_EnableIRQ(LIN_UART_IRQ);

}

 

 

Then I try to send a message to a sensor and receive some byte in answer.

I send starting with 

HAL_LIN_SendBreak(...);

then HAL_UART_Transmit to send 0x55 and sensor identifier field. 

 

I verified with an oscilloscope that some byte are indeed exchaged on the physical lines doing so, TX line of the microcontroller show this.  But:

1. in case I execute a polling read using HAL_UART_Receive, I got 9 bytes with a wrong crc16.

2. In case I use HAL_UART_Receive_IT (calling the function before the syncronous transmit of course) I got a frame error. 

I don't understand what is wrong with my configuration. Any guesses? thanks.

Outcomes