2022-06-07 01:07 AM
Hello, I have a question about STMA-Discovery Boards.
I want to use just one board which is STM8AL one, without connecting it with STM8AF, and i want to make LIN communication using Peak Lin (which requires an exterior 12V power supply).
Normally to debug the stm8 board it is done through the USB power cable (5V) but if I want to debug and connect Peak LIN at the same time the board will be connected to 5V (from the debug cable) and to 12V (from the exterior power source) at the same time !
My question here is this connection correct, I am afraid to burn the board or the PC.
En the datasheet i understand that the board already generates 12V, but i am wondering how to connect the Peak lin (because i think they have to be connected to the same ground).
2022-06-07 02:05 AM
Welcome, @ZElya.1, to the community!
With LIN, communication runs via a single line to which the participants are connected with open-collector or open-drain and which is connected to 12V via a pull-up.
If the STM8AL (MB1037) is supplied with 5V, however, this has nothing to do directly with the 12V on the LIN line. The STM8AL also contains a CAN/LIN transceiver L99PM62, which converts the UART signals LIN_RX and LIN_TX to the 12V level of LIN.
You can therefore safely connect the LIN line at CN4.4 to another LIN device.
Does it answer your question?
Regards
/Peter
2022-06-07 04:46 AM
Hello, thank you For your answer.
Okey so I understand that the board could be connected to the USB cable (5V) and to the exterior Vbat (12V) at the same time and without any problem, okey nice.
my doubt here is: when you said
"You can therefore safely connect the LIN line at CN4.4 to another LIN device"
because for me, what I had in my mind was to connect Peak lin like that:
Is this connection wrong ?
If it is wrong and I had to do it like you said, so why CN4 and not CN3, plus where can I connect GND in that case ?
Thank you
Best regards
2022-06-07 06:39 AM
OK, CN3 and CN4 are connected pin for pin, except that CN3 is a female connector and CN4 is a male connector. However, LIN is not available on pin 3, but on pin 4 respectively.
Connector P2 is actually more for access to U12 (L99PM62), it would be better to use GND on CN3 or CN4 to avoid confusion. GND is otherwise identical, of course.
The 12V don't need to be fed externally, because as you have already seen, they are alternatively generated on the STM8AL board when the board is connected to USB and gets USB5V.
So it should be sufficient to make the LIN connection to your LIN device from Peak via CN3.3 (GND) and CN3.4 (LIN).
If the problem is resolved, please mark this topic as answered by selecting Select as best under your preferred answer. This will help other users find that answer faster.
Good luck!
/Peter
2022-06-13 12:13 PM
Hello, Thank you for your response.
I connected it as you have said it seems that it works but...
I've downloded in it the project from the st website "STM8A-DISCOVERY boards firmware package, including LIN communication (AN4101)", but when I try to send and receive data from peaklin it gave me always "slave not responding, timeout".
I don't know if I am missing something, could you please help me.
Thank you.
Kind regards.
2022-06-15 01:24 AM
Hello,
I will add here more information about the debugging, it seems that the data sent from the master is received correctly, and the function "USART_SendData8" responsible of sending frame from uc to the master is executed but i still get "slave not responding, timeout"
I am confused Idon't know where the problem is !
Thank you in advance