I’ve noticed a pesky issue with the GoPiGo-3 robot and the Waveshare e-Paper displays when running GoPiGo O/S: After updating the display, the robot goes brain-dead and won’t respond to commands or do anything.
Noted facts based on viewing schematics and monitoring pins with an oscilloscope:
-
The Waveshare devices use SPI device 1, (CS_0 pulled low), and is currently configured for “4-wire” SPI, (i.e. it uses the CS pin to communicate).
-
When the Waveshare demo is running and it’s updating the display, the SPI CS_0 is being asserted cyclically almost continuously for about a minute or two while the display is updated to show a number of different display modes and features.
-
The GoPiGo robot uses SPI device 2, (CS_1 pulled low), and also appears to be configured for “4-wire” SPI too.
-
The GoPiGo’s raspberry pi communicates with the controller board in one of two specific situations:
-
If a command is issued for the robot to do something. This is noted because any time I do something, there’s a short CS blip on the GoPiGo’s chip select line.
-
Once every few seconds if nothing else is happening. This command is a relatively long command-string requiring multiple SPI cycles (chip select assertions), that last for a as much as half a second.
-
-
Because they use separate SPI channels, there shouldn’t be any conflict between them because they’re responding to different chip-select lines.
Viewing this with one of my el-cheapo 'scopes, I think I have found the problem:
It appears that the two signals are not mutually exclusive, being implemented by plain-vanilla GPIO pins being controlled independently by different programs that don’t communicate with each other - and there is no hardware arbitration. In other words, it is possible, (and perhaps even likely), that the two communication sessions can overlap since it appears that neither the GoPiGo, nor the Waveshare display, check to see if anyone else is using the SPI buss.
- At least I know the Waveshare device doesn’t check as there is no logic for reading the state of the second chip-select pin when signalling.
What I suspect is happening is that, while the Waveshare display driver is communicating with the e-Paper display, the GoPiGo attempts to use the SPI buss too - and gets corrupted data causing it to go brain-dead - requiring a power-cycle to reset it.
This is going to require further exploration and a non-trivial amount of programming to research. Solving the problem will also require a non-trivial amount of programming so that the two devices can monitor each other’s state. Or, just maybe, I can ask the GoPiGo libraries to assert, (pull low), the Waveshare device’s “Paper Busy” pin and see if that solves the problem?
Then again, I can simply punt and use one of the two Adafruit Raspberry Pi display modules that use i2c communication on what appears to be an unused address.