Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4909

Interfacing (DSI, CSI, I2C, etc.) • [Solved] Early SPI Chip Select Release With RPi 5 - No SPI Response

$
0
0
For some reason the GoPiGo3 robot's SPI interface on Raspberry Pi 5 is prone to frequent early chip select release
resulting in the GoPiGo3 not writing the SPI reply bytes in the transfer array. This issue has not been
seen running the GoPiGo3 API on Raspberry Pi 2, 3, 3B+, or Pi4, but has been reported by others happening between 500kHz and 2MHz transfer speeds on a RPi4.

The current released GoPiGo3 API sets the SPI maximum transfer speed at 500000:

Code:

    GPG_SPI.max_speed_hz = 500000
which results in a transfer speed of 250 MHz / 512 (2^9) = 488281 Hz as I understand the Python spidev documentation.

The Work-Around

The transfers appear to proceed without exception by setting this to the next lower transfer speed of 250000:

Code:

   GPG_SPI.max_speed_hz = 250000
which results in a transfer speed of 250 MHz / 1024 (2^10) = 244140 Hz.

At this reduced transfer rate, the GoPiGo3 can make a two byte SPI transfer in 0.0003 seconds, which means it can retrieve the left and right wheel encoder values roughly 1700 times per second - plenty fast enough for my ROS 2 Humble robot to publish encoders and the resultant odometry at 30 Hz.

Statistics: Posted by amcdonley — Fri Apr 12, 2024 2:58 pm



Viewing all articles
Browse latest Browse all 4909

Trending Articles