2025-02-07 07:16 AM
First time designing for ST microcontrollers, so I thank you for your patience.
I see by the datasheet that USART1 can be used as a LIN bus directly without a LIN bus transceiver, but I can't find any examples of how the hardware is implemented when that's set up. My assumption is that I need a 1kohm pull up to Vcc on the master and a weaker pull up on the slaves, connected to USART1_TX and leaving USART1_RX floating.
Is this accurate? If not, how do I use the LIN bus peripherals on the STM32L5 series?
2025-02-07 08:53 AM - edited 2025-02-07 08:55 AM
No.
LIN bus is typical on cars, 12V signal level. And STM32 is 3v3 cpu - so you always need transceiver chip.
But you can use the uart, set in linbus-mode, to work with transceiver .
2025-02-07 09:18 AM
That doesn't make sense to me. LIN bus transceivers already work with standard UARTs. There's no reason for a special LIN bus setting in the microcontroller if you already have a UART.
The datasheet for the STM32L562xx part says:
So they have the ability to be used as a half-duplex and as LIN master/slave. The question I have is how am I supposed to connect the half-duplex connection? Do I use just the TX line, or just the RX line, or do I short them together?
The question of the level shifter is one I'll have to investigate further, but one of the reasons I chose this chip for my design was because it supported LIN without a separate transceiver.
2025-02-07 10:05 AM
"sense to me" ...come on.
see ds, maximum voltage on pins:
So if your LIN bus is working under 5V , its might work ok ; but never on 12V , without level shifter or transceiver.
2025-02-07 10:28 AM
LIN bus doesn't have to be 12V. It's typically 12V because it's typically used in cars. I'm not developing for automotive. I have an example of the legacy system that is currently in use that uses a LINbus transceiver with BATT connected to 5V. It's functional, and has been for a while.
So yes, if I needed this system to operate at 12V then I would put in a level shifter, but I don't need it to run at 12V. Regardless, that doesn't answer my question. If I enable LIN mode, what pin do I connect to? RX, TX or both?
2025-02-07 10:47 AM - edited 2025-02-07 10:55 AM
>what pin do I connect to? RX, TX or both?
RX and TX to the rx tx pins of the LIN transceiver...
just try in Cube: set the uart to LIN-mode and see, what it changes on rx + tx hardware. (nothing.)
read in rm :
So you get LIN break detection etc , but there is no LIN transceiver built in the cpu.
If you insist on working without transceiver, maybe you could try: set tx pin to alternate open drain with pullup on, connect tx to rx and see, if its working. Maybe discrete pullup resistor to add. (internal has about 40 k .)
But be aware : if using internal pullups or output, your limited to 3v3 max. level !
"5V tolerant is only for inputs " ! So will need transceiver on 5V-LIN also.
Just connect it to the transceiver, as you did it on your system up to now.
2025-02-07 11:04 AM
Ok.
I was hoping to reduce component count but if LIN Mode doesn't mean I can use the port as a half duplex bus then I guess I'm stuck with it.
2025-02-07 11:13 AM - edited 2025-02-07 11:16 AM
See what i wrote...you can use it half duplex - but only at 3v3 max. level.
see rm, half duplex mode...