This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Two SPI instances running at the same time.

Hello,

I have one SPI instance (instance 3, but have tried others) reading data from an ADC. It's reading data from an ADC triggered by a DRDY signal at 25khz. I setup a PPI chain where the DRDY interrupt will trigger the SS line to low, SPI transfer (7 bytes out, 7bytes in, held, repeated and rxpostinc), SPI line to high and increase a timer counter, when the counter reaches a certain threshold, in the timer interrupt I reset the timer, reset the SPI transfer (to start from the buffer beginning again) , copy the buffer to another memory area and start a SPI transfer of that data using SPI instance 0 to another IC (all while keep going the ADC reading on instance 3).

For some reason that I still don't completely understand eventually I will start reading all zero readings from the ADC for a while, and then it will fix itself and I will start getting correct reading again, only to fall to all zero again after a while etc.

Any ideas? DMA congestion?

This is in NRF52840

Also the SPI transfer to the other IC has a queue mechanism as the SPI of that can be not be ready at any given point so the transfers times are not deterministic.

Using SDK15, but checked the SPI driver and it doesn't really have significant changes in the latest SDK.

Parents
  • Is it possible that the SPI is reading memory that the SAADC is not writing to? e.g if the SAADC buffers are shorter than the "certain threshold" for the counting timer?

    Have you tried to debug to check where the data is lost? I know you are using PPI, but it should still be possible to set a breakpoint in an event handler. Use this to check whether it is the SPI or ADC that originally contains the 0 values.

    Best regards,

    Edvin

Reply
  • Is it possible that the SPI is reading memory that the SAADC is not writing to? e.g if the SAADC buffers are shorter than the "certain threshold" for the counting timer?

    Have you tried to debug to check where the data is lost? I know you are using PPI, but it should still be possible to set a breakpoint in an event handler. Use this to check whether it is the SPI or ADC that originally contains the 0 values.

    Best regards,

    Edvin

Children
No Data
Related