Very Simple BLE<->ISO-TP A0 firmware

Hi all, just wanted to share something I’ve been working on targeting the A0: https://github.com/bri3d/esp32-isotp-ble-bridge .

This is a super simple mash-up of open-source ISO-TP code and the ESP-IDF (FreeRTOS ESP toolchain) examples for BLE “Serial” using GATTs and the ESP-IDF “TWAI” drivers (CAN in copyright disguise).

To build it, you need the ESP-IDF toolchain and then it’s just “idf.py flash” .

Right now, it works perfectly for simple multi-frame ISO-TP messages with flow control, on both the send and receive side.

The client demo Python code needs to be expanded to implement the GATT multi-framing protocol stolen from the ESP-IDF example if you want to send messages larger than the BLE MTU - pretty rare / impossible in diagnostic use cases but could be important for flashing. And, if you fully saturate the BLE side by spamming tons of very small attribute writes, you’ll get task contention with the TWAI/CAN drivers and messages will start to slow down a lot as the CAN messages languish in buffers rather than being processed by the drivers. I need to shorten the queues and implement failure backoff in the client to prevent it from clobbering the BLE drivers on the ESP side. But to be clear, it’s quite useful already - for 20Hz diagnostic logging purposes, no issues whatsoever.

I left the example code for a control channel on the GATT side in, and plan to add some basic client/server version control, ID set/retrieve (right now hardcoded to 7E0/7E8 pair), and LED control shortly, along with Android and iOS client libraries instead of the basic Python tester I have right now. My goal is eventually to finish up a full logging/flashing toolkit for VW MQB Simos18 ECUs which runs on Android.

For anyone interested in the A0 I can highly recommend it. It’s a wonderfully clever and simple device - no frills, plenty of power, and works great. The only feature I could ever ask for down the road is a MicroSD slot for standalone logging.

Very cool project! Thanks for sharing.