CW-B-W / ESP32-openLIN

open-LIN-c implementation on ESP32
MIT License
8 stars 2 forks source link

Issues with TX and bus timeouts #2

Open oshoemaker opened 5 months ago

oshoemaker commented 5 months ago

I am working on a small leveraging your LIN bus work. For the most part everything was going quite well but have ran into a problem.

I have attempted to simplify the issue and use the microchip serial analyzer as master and the esp32 as the slave. This is as close to identical as I could make it to your demo. The serial analyzer sends the frames out , the esp32 sees them, but the TX is never sent and times out. I have tried multiple devices, uarts, etc… and all yield the same results. Do you have any suggestions?

I am using the slave.cpp from examples with some extra logging and have tried at 9600, 19200, and autobaud.

IMG_5876 IMG_5875 Screenshot%202024-04-01%20at%2010 15 23%E2%80%AFPM image

CW-B-W commented 5 months ago

Hello @oshoemaker ,

Thanks for pointing out the error. I think it's because I had changed the slave.cpp after I wrote the README.md, therefore the result is inconsistent.

Would you try to run it with slave.cpp@9d824e, I think it's the version corresponding to the illustration. As you can find the frame slot in this version is more alike to that of the illustration. https://github.com/CW-B-W/ESP32-openLIN/blob/9d824e0641abfd4c78489764e8883b3f019b8ea4/examples/slave.cpp#L56-L59

As I haven't touched this project for a long while, I am not sure why I changed the slave.cpp. It's appreciated if you can make the latest slave.cpp work and take some screenshot, so that we may update the wrong illustration in README.md.

CW-B-W commented 5 months ago

OpenLIN parses the frames based on the frame_slot configured. In my examples, it's configured inside slave.cpp Below is the structure of frame_slot of the latest slave.cpp https://github.com/CW-B-W/ESP32-openLIN/blob/1b4281d4c0f5582622e1fb1093cc6fa4aa352cda/examples/slave.cpp#L58-L62

As it can be observed,

Therefore, under such configuration, you should adapt the 0x03 to 0x01 in your figure if you want your Master (i.e. LIN Serial Analyzer) to receive data from Slave.