0xCAFEDECAF / VanBus

Vehicle Area Network (VAN) bus packet reader/writer for ESP8266 and ESP32
MIT License
40 stars 5 forks source link

writing packets to the VAN #2

Closed jnslsrwy closed 3 years ago

jnslsrwy commented 3 years ago

Hi, first of all thank you for this amazing lib! I wanted to ask why you chose to limit the lib to ro from the bus. Is this feature planned for a future update and if so what are the difficulties to overcome if there are any?

0xCAFEDECAF commented 3 years ago

Hi, writing to the VAN bus is not yet possible because I have not implemented it yet. Maybe in the future, if I have some spare time, I will see what may be possible in that area.

morcibacsi commented 3 years ago

Writing the VAN bus can be quite challenging. There are more than one message types which also complicates things. In the TSS463 datasheet there is a good explanation on what should be taken care of. The device should listen on the bus for a specific amount of time. When in this time frame the bus is free then it can start transmitting (and in the meantime also listening). If it detects that there's a difference between what it transferred and what it received it must stop transmitting (this is called bus arbitration). Otherwise we overwrite a message that another device is sending. However I admit that it would be awesome to have a software only solution for this. There is something similar to this implemented for a PIC microcontroller here: https://www.cnblogs.com/shangdawei/p/4769620.html

jnslsrwy commented 3 years ago

Hi, writing to the VAN bus is not yet possible because I have not implemented it yet. Maybe in the future, if I have some spare time, I will see what may be possible in that area.

Ah I see. Thanks for your reply 👍🏼

In the TSS463 datasheet there is a good explanation on what should be taken care of.

Will dig into that! Could you give me some other sources to learn more about the VAN standard or is the best way to simply read datasheets?

There is something similar to this implemented for a PIC microcontroller here: https://www.cnblogs.com/shangdawei/p/4769620.html

I recall that guy Graham Auld doing something with a PIC (http://graham.auld.me.uk/projects/vanbus/van-pioneer.html) but I could not find the source code of his firmware for further research. I believe he did not release it.

morcibacsi commented 3 years ago

I read a lot of forums and the documents which is mentioned by @0xCAFEDECAF in the readme, but the datasheet of the TSS463 contains everything which is needed to understand the protocol. However I admit that it is not the easiest to read (I read it so many times that I almost know what does it contain on every page). I have the source code from Graham but it is also for reading only. It is written in assembly so it didn't help me much. The only publicly available library for writing is probably mine. You should check my repositories for further information. I spent a lot of time on reverse engineering the VAN bus protocol and tried to release everything I figured out.

0xCAFEDECAF commented 3 years ago

Just uploaded a new version that supports rudimentary packet transmitting functionality. I will close this issue ticket; new issues can be dealt with in separate tickets.