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

SPI slave receiving corrupted data when using low SPI frecuency

Hi there,

I am using two nRF52 one as Master and the other as Slave SPI, but I am facing an issue with the slave side, because when I use NRF_DRV_SPI_FREQ_125K it get some corrupted bytes, I solved the issue increasing the frequency to NRF_DRV_SPI_FREQ_8M, but it does not look like a great solution, because I am not solving the problem cause.

What I am thinking about is that the issue is being generated when the SPI uses low frequency and it requires CPU usage for longer periods and when a softdevice event occurs the CPU prioritize them, leaving the SPIS in idle for few nano/microseconds and it generates corrupted data

any recommendations to avoid receiving corrupted data when using SPI Slave and BLE with 5 concurrent connections?

details:

nRF52832 (DK) and SDK15.2

Regards and thanks in advance

Parents
  • In the master side, you have to use NRFx_SPIM code and on the slave side, use SPI_SLAVE code.

    then its working fine using for the same frequency. 

    pls, check connection also MISO-MOSI and MOSI-MISO, CS-CS, SCK-SCK.

    And also see the waveform on the logic analyzer. 

  • Hi Rohit, I used an oscilloscope to double check the data I was sending was good,

    testing: the only parameter modified on my test was the SPIM frequency

    RTT Terminal:

    1) test 1: NRF_DRV_SPI_FREQ_125K

    result: the last 2 bytes were wrong on the SPI MOSI, but the buffers use on the SPI master were OK 

    2) test 2:NRF_DRV_SPI_FREQ_1M ( I was unable to measure 8M using my oscilloscope)

    results: all the data was sent with no issues when using frequencies >= 1M

    My concerns are:

    I can leave the SPIM using high frequencies e.g: 8M, but what if the issue happens again? using a checksum to validate a retransmit does not solve it, because it keeps transmitting the last 2 bytes corrupted

    any recommendation to avoid this behavior?

    Regards

Reply
  • Hi Rohit, I used an oscilloscope to double check the data I was sending was good,

    testing: the only parameter modified on my test was the SPIM frequency

    RTT Terminal:

    1) test 1: NRF_DRV_SPI_FREQ_125K

    result: the last 2 bytes were wrong on the SPI MOSI, but the buffers use on the SPI master were OK 

    2) test 2:NRF_DRV_SPI_FREQ_1M ( I was unable to measure 8M using my oscilloscope)

    results: all the data was sent with no issues when using frequencies >= 1M

    My concerns are:

    I can leave the SPIM using high frequencies e.g: 8M, but what if the issue happens again? using a checksum to validate a retransmit does not solve it, because it keeps transmitting the last 2 bytes corrupted

    any recommendation to avoid this behavior?

    Regards

Children
No Data
Related