SPIM3 is not working properly

Hello all,

I am using the nrf52840 MCU and NCS v2.6.2 for my application development. Here I am using SPIM3.
I am using a peripheral which have an internal FIFO. From that peripheral, I receive the interrupt when the FIFO is full. I received the interrupt every 160ms and read 360 bytes of data. It uses a fixed register read/write cycle every interrupt for the FIFO read. This process is successful over the longtime. After some random point in time SPI driver sent the wrong value sequence, and due to that, my peripheral internal configuration changed, and it stopped working as per expectations.

  • A successful send sequence of 4 bytes is 0xFF,0xFF,0xFF,0xFF.

  • Found wrong sequence of 4 bytes is 0x00,0xFF,0xFF,0xFF. After this sequence peripheral goes into failure.

           

If I swap the SPIM2 and SPIM3. The issue is not reproduced, and the peripheral is working fine.

I found the errata document(section 3.29) from nrf web. In that mention, like the tx pointer corruption issue, sometimes, when the CPU accesses the same memory. That causes this issue. I am researching the same, and I found CONFIG_NRF52_ANOMALY_198_WORKAROUND, CONFIG_NRFX_SPIM3 as a part of the solution. This config is already turned on, still I am still facing the same issue.

Can anyone help me with the SPIM3 issue?

Thanks,
Dinkar

Parents
  • Hi Dinkar,

    You also need to make sure that the same RAM AHB is not used for SPIM Tx buffer and application data. The simplest way to do that is probably as shown in this post.

    (Alternatively, unless you need high SPI frequency or have use dall the other serial periperal instances, you could consider using another SPIM instance that do not have this issue, as you have allready tested).

    Einar

  • Hello Einar,

    Thanks for the quick revert.

    I checked the post that you suggested. But seems it is not clear what changes I need to make for the working SPIM3 to work properly. Do I need to make use of the global buffer for SPI read or write? Can you please add more here?  If you give some example code with those changes, that will help a lot.

    Dinkar

  • Let me translate that for your: If you needed SPIM >8MHz, redesign with a newer NRF chip generation.

    The problem is catastrophic, the fix requires a fairly complete understanding how to put buffers into specific RAM locations - which Gnu LD does not like to do at all.

    There cannot be a generic fix because it matters how the SPI data is used later, and because it needs to reserve quite a bit of RAM.

Reply
  • Let me translate that for your: If you needed SPIM >8MHz, redesign with a newer NRF chip generation.

    The problem is catastrophic, the fix requires a fairly complete understanding how to put buffers into specific RAM locations - which Gnu LD does not like to do at all.

    There cannot be a generic fix because it matters how the SPI data is used later, and because it needs to reserve quite a bit of RAM.

Children
No Data
Related