cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 USART in LIN mode

AlexSmart
Senior
Posted on April 01, 2014 at 21:42

LIN mode not very well documented by STM as I realize. And

does not have

as many

features

, as I hoped.

Anyway, it works quite ok in my STM32F407 project.

But on STM32F303 there is a problem - LIN brake signal is only 10 bit wide.

Datasheet says it must be 13 bit. No information about this in erratasheet.

Found here couple of LIN related discussion started, but without any answer, hope this discussion will be different:)

#stm32 #lin #usart
2 REPLIES 2
maggie
Associate III
Posted on September 05, 2014 at 07:21

Hi AlexSmart - you mentioned that you got LIN working in .STM32F407, so I wanna ask a few questions:

  1. What is the LIN Transceiver module you used?
  2. Where did you download the drivers/documentations you need for STM32F407 to make it work?
  3. Is your connection via USART or UART?
I know that through the official HAL drivers from ST, we can set the mode as LIN, but after that, no more documentations/software references.

I have no idea how to link it to the LIN Transceiver module, like for example - configure the in and out data.

I'm previously using STM32F303x as well, but I already changed to STM32F407x.

Posted on September 09, 2014 at 19:46

HiAlexSmart,

Please note that the LIN modeshould be activated before enabling USART and not all USARTs support this feature, as described within the reference manual:

The LIN mode enables the capability to send LIN Synch Breaks (13 low bits) using the SBKRQ bit in the USARTx_RQR register, and to detect LIN Sync breaks.
This bit field can only be written when the USART is disabled (UE=0).

Thus, you can find below the approriate function calls, to check LIN mode, using the StdPeriphLib:

/* USART configuration */
USART_Init(); 
USART_LINBreakDetectLengthConfig();
USART_LINCmd();
/* Enable USART */
USART_Cmd();
USART_RequestCmd(EVAL_COM1, USART_Request_SBKRQ, ENABLE);

With regards.