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

SPI Communication Problems Concerning nRF52840

Now there is a project, nrf52840 uses SPI to communicate with other microcontrollers. Data is currently available, but it is suspected that each packet lacks a second byte. The corresponding modification of SPI mode eliminates the problem of SPI mode. Are there any other parameters that affect the results of the data?

SPI Communication Program Reference Sample Program (sdk15.0    examples\peripheral\spi\pca10040)

Parents Reply
  • The above is the waveform of data pin and chip selection pin.(The yellow waveform is the data pin waveform. The blue waveform is the chip selection pin waveform. And chip selection is pin low level effective)

    Through the analysis of chip selection waveform and data, it is found that chip selection pin is always valid after the data transmission of the first byte, and invalid only after the data transmission of the second byte.Therefore, the data of the second byte is lost due to this problem.

Children
  • The normal chip selection cycle is 500us. However, the first chip selection cycle is 4.34ms. 

  • I am the colleague of June6,  give more information for the problem.

    We are using the SPIS sample in examples\peripheral\spis of15.3 SDK.
    As show in the above Oscilloscope, the second bytes had sent after a long time after the first bytes(maybe 4.34 ms), and i read the rx_amount of nrf_drv_spis_event_t event in callback spis_event_handler, the value always is 1.
    In this period, there are two bytes clk cycles(that mean clk has the  16 high low in turn) & two bytes appear there, and at the same time, the cs is low, so according the spi protocol, i should received two bytes, am i right? 

    After this period, the cs cycle changed to 500us, and in one cycle, there is a clk cycle(8 high low in turn), the interval is very short(maybe 30us), these data received perfect.

    Please give us some suggestion on how to get the second bytes? how to modify the program?

Related