Which peripheral to use for bus arbitration? RMT/MCPWM/LEDC/I2S/SPI?

Captain.Chode
Posts: 15
Joined: Mon Mar 11, 2019 4:23 pm

Which peripheral to use for bus arbitration? RMT/MCPWM/LEDC/I2S/SPI?

Postby Captain.Chode » Sat Sep 05, 2020 9:21 am

Hi, I am fiddling with a legacy automotive bus called VAN bus with an ESP32. I have successfully created a library using the RMT to read it, however I also would like to implement writing purely from software. To be able to do that bus arbitration logic must be implemented. For this I need to listen on the bus and when the line is high for 64 microseconds I can start transmitting. However I need to keep track whether what I transmitted is the same as I received, because when a difference is found I need to stop transmitting right away (another node transmitted a message with a higher priority). To have a more complicated problem the data is e-manchester coded, so a nibble is 5 bits long (The fifth bit is the reverse of the fourth). So this is the task in a nutshell. Unfortunately as I understand the RMT is not capable for such thing. So I am looking for suggestions on what to use. Can I (mis)use the MCPWM or LEDC peripheral for this purpose or maybe I2S somehow? Or hack around with the SPI? Any hint or suggestion is greatly appreciated as currently I don't have a starting point. The speed is 125 kbps so the "length" of one bit is 8 microseconds.

A brief summary on the protocol I would like to implement: http://graham.auld.me.uk/projects/vanbu ... tocol.html

Who is online

Users browsing this forum: cistern and 226 guests