cancel
Showing results for 
Search instead for 
Did you mean: 

Simple Classic CAN + FreeRTOS Demo simulating OBD and a vehicle

Gretchev
Associate

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

1 ACCEPTED SOLUTION

Accepted Solutions
mƎALLEm
ST Employee

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.

 

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.

View solution in original post

2 REPLIES 2
Ghofrane GSOURI
ST Employee

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.

mƎALLEm
ST Employee

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.

 

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.