I currently have a custom hat with ADCs that communicate via SPI. I am using a Raspberry Pi 4 with a C program to perform measurements at a frequency of 50 kHz, and everything is working well. However, when I switched to a Raspberry Pi 5, the program only runs at a maximum of 22 kHz.
Does anyone have a solution for this issue? It appears that the SPI communication is significantly slower on the RPi 5. Could this be related to spi_dw? I attempted to disable spi_dw and used only spi_bcm2835, but that did not resolve the problem.
Thank you.
1 Answer 1
I have seen a similar SPI performance problem when migrating from CM4 to CM5. On the CM5, there's ~12us dead time between chip select going low and SCK activity starting. There's a similar delay between SCK activity finishing and the chip select going inactive. The SCK frequency is about right, however.
On CM4 the dead time is ~1us which is a great deal better, especially when performing lots of short SPI transactions.
Hopefully this is a problem that will get fixed in the drivers, rather than a fundamental limitation of the RPi 5 architecture...
config.txt
to enable SPI IAW the README file./boot/firmware/config.txt
is IN ACCORDANCE WITH (IAW) the SPI overlay documentation at/boot/firmware/overlays/README
"