2025-09-13 9:45 AM - last edited on 2025-09-17 4:25 AM by mƎALLEm
Building upon my previous post, "Bidirectional Serial Communication with ST-Link using FreeRTOS on NUCLEO Boards," this code demonstrates a Simulator component and an Application component operating on two separate NUCLEO-C092RC boards. Please note that this project is intended for educational use and is not designed as robust production code; some errors or omissions may remain that users will need to address. This initial demonstration should function as described when configured according to the provided instructions, and it may serve as a foundational template for future development and enhancements.
Val Gretchev
Solved! Go to Solution.
2025-09-17 2:58 AM - edited 2025-09-17 3:04 AM
Hello @Gretchev and thank you for your contribution.
I tested the two projects and they work well.
If I summurize: the first CAN node, the "simulator" (as a car simulator), is diagnosed by the second CAN node, the "application" (simulating the OBD) which simulates the On-Board Diagnostics, diagnosing the car. NUCLEO-C092RC boards were used: one used to simulate a vehicle and the second one to simulate the OBD.
This is the log obtained when sending different commends from the PC to the "application" over USART2 to request data from the vehicle (the simulator) over CAN.
Welcome to STlink PC-to-MCU command interpreter
Starting default task
Starting UART command task
Starting CAN receive task
Starting CAN transmit task
A: toggle green LED
B: toggle blue LED
C: How now brown cow?
D: Same way black bull
R: Retrieve RPM
RX: 11b 0x7E8 41 0C RPM: 1500
S: Retrieve vehicle speed
RX: 11b 0x7E8 41 0D Speed: 60 km/h
T: Retrieve coolant temperature
RX: 11b 0x7E8 41 05 Coolant: 85B0 C
r: to request the current engine RPM
s: to request the current vehicle speed
t: to request the current coolant temperature value
Other commands, like a, b, c, d are miscs and used to toggle leds etc ..
I will mark this comment as solution to give it more visibility for other users to help them to find efficiently this solution.
2025-09-15 1:56 AM
Hello @Gretchev
Thank you for sharing your project, "Bidirectional Serial Communication with ST-Link using FreeRTOS on NUCLEO Boards," on the ST Community. Your willingness to openly share your work and insights is truly appreciated.
Thank you again for your contribution your efforts are making a positive impact and helping others learn and grow!
THX
Ghofrane
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-09-17 2:58 AM - edited 2025-09-17 3:04 AM
Hello @Gretchev and thank you for your contribution.
I tested the two projects and they work well.
If I summurize: the first CAN node, the "simulator" (as a car simulator), is diagnosed by the second CAN node, the "application" (simulating the OBD) which simulates the On-Board Diagnostics, diagnosing the car. NUCLEO-C092RC boards were used: one used to simulate a vehicle and the second one to simulate the OBD.
This is the log obtained when sending different commends from the PC to the "application" over USART2 to request data from the vehicle (the simulator) over CAN.
Welcome to STlink PC-to-MCU command interpreter
Starting default task
Starting UART command task
Starting CAN receive task
Starting CAN transmit task
A: toggle green LED
B: toggle blue LED
C: How now brown cow?
D: Same way black bull
R: Retrieve RPM
RX: 11b 0x7E8 41 0C RPM: 1500
S: Retrieve vehicle speed
RX: 11b 0x7E8 41 0D Speed: 60 km/h
T: Retrieve coolant temperature
RX: 11b 0x7E8 41 05 Coolant: 85B0 C
r: to request the current engine RPM
s: to request the current vehicle speed
t: to request the current coolant temperature value
Other commands, like a, b, c, d are miscs and used to toggle leds etc ..
I will mark this comment as solution to give it more visibility for other users to help them to find efficiently this solution.
2025-09-17 6:49 AM
For the coolant temperature, I get:
t
T: Retrieve coolant temperature
RX: 11b 0x7E8 41 05 Coolant: 85° C
I guess not all PCs handle special characters the same way.
Val
2025-09-17 7:17 AM
Although I haven’t tested this code in a vehicle, it should be able to retrieve those parameters from the car's OBD connector under the dash. All you need is an OBD cable. Dozens are available at Amazon.com. You only connect CAN High, CAN Low, and signal ground. Because the parameters retrieved from the OBD connector are dynamic, such as vehicle speed, the car must be in motion to obtain readings other than zero. For safety reasons, ensure a passenger is responsible for monitoring the laptop output at all times while the driver focuses on operating the vehicle.
Val