1

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.

asked Jan 17 at 16:49
3
  • Set config.txt to enable SPI IAW the README file. Commented Jan 17 at 22:53
  • 1
    Hi, thanks for the answer. I don't think I understood what "SPI IAW" means. Can you provide more information? Commented Jan 18 at 12:45
  • Apologies; it wasn't an answer, but I should have said it like this: "Pi 4 and Pi 5 may have differences in their SPI setup. Therefore, you may want to verify that /boot/firmware/config.txt is IN ACCORDANCE WITH (IAW) the SPI overlay documentation at /boot/firmware/overlays/README" Commented Jan 18 at 22:52

1 Answer 1

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...

answered Feb 20 at 14:00

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.