open-LIN/open-LIN-c implementation in ESP32.
This project implements hardware abstraction APIs of open-LIN-c
in ESP32 based on CW-B-W/ESP32-SoftwareLIN.
Besides of the implementation, there are simple examples to illustrate how to use open-LIN-c
.
examples/master.cpp
to src/
examples/slave.cpp
to src/
In examples/master.cpp
, master_frame_table
is used to store the periodic frames information. open-LIN-c
keeps iterating through the table and send each frame itme.
Refer to https://github.com/CW-B-W/ESP32-openLIN/blob/677470aaf2609fb12ef86f3ba0c760aa747735f0/examples/master.cpp#L44-L47
In examples/master.cpp
, frame_slot
is used to store the periodic frames information.
When a framed is received, open-LIN-c
searches the received frame PID in the frame_slot
and return the frame information if found.
Refer to https://github.com/CW-B-W/ESP32-openLIN/blob/677470aaf2609fb12ef86f3ba0c760aa747735f0/examples/slave.cpp#L54-L57
In examples/master.cpp
, function open_lin_master_dl_rx_callback
is used to handle the frames received. Refer to https://github.com/CW-B-W/ESP32-openLIN/blob/677470aaf2609fb12ef86f3ba0c760aa747735f0/examples/master.cpp#L84-L91
In examples/master.cpp
, function open_lin_error_handler
is used to handle the errors. Refer to https://github.com/CW-B-W/ESP32-openLIN/blob/677470aaf2609fb12ef86f3ba0c760aa747735f0/examples/master.cpp#L93-L153
In examples/slave.cpp
, function open_lin_on_rx_frame
is used to handle the frames received. Refer to https://github.com/CW-B-W/ESP32-openLIN/blob/677470aaf2609fb12ef86f3ba0c760aa747735f0/examples/slave.cpp#L115-L122
In examples/slave.cpp
, function open_lin_error_handler
is used to handle the errors. Refer to https://github.com/CW-B-W/ESP32-openLIN/blob/677470aaf2609fb12ef86f3ba0c760aa747735f0/examples/slave.cpp#L124-L185
In examples/slave.cpp
, if LIN_AUTOBAUD
is defined, autobaud is enabled, otherwise autobaud is disabled. Refer to https://github.com/CW-B-W/ESP32-openLIN/blob/677470aaf2609fb12ef86f3ba0c760aa747735f0/examples/slave.cpp#L35
This project was tested with Microchip LIN Serial Analyzer and NXP TJA1021 module.
(Sleep was not used in this test)
examples/master.cpp
to do this test.LIN Serial Analyzer
Add Slave Response Buffer
Compared with the result in logic analyzer
examples/slave.cpp
to do this test.LIN Serial Analyzer
Send Continuous
Compared with the result in logic analyzer
This project was also tested with VN1611.
We can take advantages of Vector XL Driver Library to test it with VN1611.