comma 3X: switch to kernel driver for low level SPI comms
The comma 3X talks to its internal panda over SPI using the spidev driver. We want to move the low-level SPI transactions into the kernel for better performance and efficiency.
I already started this a while ago at panda/drivers/spi/.
Minimum requirements for this bounty:
- Switch to the kernel driver for the panda Python library (
panda/python/) - Make it interrupt driven (no busy waiting!)
- Good auto loading + updating the driver
- Better throughput than the existing panda SPI stack
- for bonus points, you can patch the kernel to fix the SPI overhead. apparently tracking the "SPI stats" has a ton of overhead in our kernel version, and this was fixed in newer kernels.
- Performance needs to be good enough to support https://github.com/commaai/openpilot/pull/34711
- since the easiest way to validate may end up being to finish that move, there's an extra $250 on this bounty ($1k total) for finishing that up and merging it together
We'll be switching pandad in openpilot to Python soon, so no need to implement this for the C++ panda library (just the one in panda/python/).
You cant use a comma 3(tici) for this I assume?
You need a C3X, C3 has the panda connected via USB:
$ lsusb
Bus 001 Device 010: ID 3801:ddcc comma.ai panda
You need a C3X, C3 has the panda connected via USB:
$ lsusb Bus 001 Device 010: ID 3801:ddcc comma.ai panda
It's also connected over SPI actually, if you compile it with ENABLE_SPI=1 it should also be possible on tici
Beware that this hasn't been extensively tested for stability, so it's possible that you won't be able to hit the same clock speed reliably on a C3
@robbederks Yep, I could confirm that SPI works on my C3, but only for frequencies below 33MHz.
Thinking about doing this.
- [ ] Kernel SPI protocol driver that handles low level async communication.
- [ ] Update panda spi userspace code to eliminate the need for busy looping