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

Random SPI data shifting at ~72kB/s throughput

Hello,

I am using nRF52 with ADS1292, and i am trying to sample at 8kHz with data throughput of 72kB/s, but some data is being randomly shifted giving me random spikes. This occurs on all available clock speeds to some degree. I am using Easy DMA. I am not getting any warnings or errors from the SPI driver as far as I can tell.

This issue does not occur at a lower data rate. Does this have something to do with overhead from the nRF SPIM drivers? I am also using I2C and other resources, but this also occurs with those additional resources disabled.

I'm trying to figure out what the limitation here is; is there a known limit on how many times you can call 'nrf_drv_spi_transfer' every second?

Thanks,

  • Hi,

    1. Shifted how much and which way?
    2. What SDK are you using?
    3. Since you use Easy DMA I assume that you have not configured the SPI driver in non-blocking mode? That should make it less dangerous to call it too often, but you should wait and check the status of the transfer in the event callback anyway.
    4. Have you checked the return codes from the SPI driver function calls for errors like this?
  • Sorry about the lack of complete info:

    1. It is seemingly random; and does not happen on every transfer. I cannot find a consistent pattern or direction. In some cases part of the data is intact, and the rest is garbled or missing. Since I don't have the correct debugging tools at my disposal (logic analyzer), I am using the internally generated 1-Hz square wave. plot of bad data
    2. Using SDK 13.1.0
    3. I tried both non-blocking and blocking modes, giving same result.
    4. SPI drivers did not report any errors. All transfers returned NRF_SUCCESS. The first few BLE transfers return NRF_ERROR_RESOURCES, but eventually goes away.

    Let me know if there is any other information I can provide that will help.

    Thanks,

    1. So in other words, you don't know if it shifts a certain number of bytes either to the left or right? It could be shifted e.g. just one bit both ways?
    2. Is it possible that it is because of bad wiring? Have you remembered to connect both devices to common ground? With bad wires or grounding you can pick up noise that registers as bits. It would also behave quite random.
  • Hello, I don't think wiring or ground is an issue. I am working with a PCB design that we have used for some time, with good results at lower sampling rate (lower throughput). It looks like not all transfers are completed correctly. Many times data are replaced with zeros, and other times it is just garbage data. I cannot pin down exactly what the issue is.

    Is there anything I should try to get more information?

    Thanks,

  • I think some measurements of the bus with an oscilloscope or logic analyzer could be very valuable.

    Does it occur if you disable all other resources and do nothing, but transfer data with SPI?

    How do you use the SPI? Are you using EasyDMA?

    What do you mean by " internally generated 1-Hz square wave" by the way?

Related