-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
We are using a Raspberry Pi 3 with a FLIR Lepton 3 thermal camera. This camera uses VoSPI to transfer thermal video frames. The protocol involves performing continuous, regular SPI transfers. While we are able to successfully get frames off the camera most of the time, we occasionally lose data. This is obvious because the camera uses a scheme of packet and segment numbers to identify the data - we sometimes see gaps in the returned identifiers. These loss of sync events happens irregularly and are spaced anywhere from 10s to 5 mins apart.
When looking at various SPI signals with a scope we've observed that just before a loss of sync is observed the CLK signal stops while /CS stays low.
Here's the output from the scope shows the CLK going away twice in quick succession:
Notes for interpreting the output: The large bottom area of the output is a zoomed in section of the smaller top area. The zoomed in section is shown with the [ ] indicators.
- purple is /CS
- yellow is CLK
- blue is connected to a GPIO which goes high when our software detects loss of sync (slightly delayed because it takes a little time to notice)
We've watched a number of loss of sync events with the scope and the CLK output stopping seems to be highly correlated to the problem.
We are using the 4.9.59-v7+ Raspian kernel.
Our /boot/config.txt looks like this:
gpu_mem=16
start_x=0
enable_uart=0
arm_freq=600
arm_freq_min=600
gpu_freq=200
gpu_freq_min=200
dtparam=i2c_arm=on
dtparam=spi=on
# Enable audio (loads snd_bcm2835)
dtparam=audio=on
We have disabled CPU scaling because it significantly reduces the frequency of the sync loss events.
We do not set the CS change flag during SPI transfers.
Could we be doing something wrong? Could this be a problem with the spi_bcm2835 driver? Could there be a hardware issue?
We are highly motivated to get this resolved and are willing and able to try out any suggestions or potential fixes.