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

SPIS of nrf52 could not read the data accuracy

I am working with SPIS example ( sdk version 15.3). SPI master send data regulaly. For example, it sent 5ms cs low, but there are only two bytes transferred, the first byte at begin of 5ms, other one at the end. SPIS of nrf52  not read the second one, what can I do with it?

Parents Reply Children
  • Only 1 byte was received, that's the reason i launch the item.

  • Hi, Edvin,

    I found something wrong using the logic analyzer.

    The problem was cause by the second cs signal, it's stay on high just take 3.5us which was too small than the others(34us).

    Is there any thing i can changed to solve the problem? 

    BR,

    Xin

  • Hello,

    According to the datasheet the minimum high of the CS/SS is 300ns, so 3.5us should really be fine. 

    Are you using the following function to check whether the data is received?

    NRF_LOG_INFO(" Transfer completed. Received: %s",(uint32_t)m_rx_buf);

    can you try the following:

            NRF_LOG_RAW_INFO("received string len %d, data: 0x", sizeof(m_rx_buf));
            for (uint8_t i=0; i<sizeof(m_rx_buf); i++)
            {
                NRF_LOG_RAW_INFO("%02x:", m_rx_buf[i]);
            }
            NRF_LOG_RAW_INFO("\n");

    I am sorry I can't give a concrete answer, but I don't have any HW capable of simulating your device. Please test this with the unmodified spis example, except for the printing of the string. I don't understand exactly how you handle the SPI events in the main file that you sent.

    BR,

    Edvin

  • I had tried unmodified spis again, only add the instructions you give to me, no any more changed, the second bytes was lost, and many bytes not printed in log info, but only the first was printed with server 0x00. i think maybe print log info take so much time, so some bytes was lost.

    I tried to store all data to a big buffer like the amount reached to 200 without printing any log info, i tried setup the break point when the 200 data had stored to the buffer, then to find the second bytes, result tell me i was fail again.

    So i can sure, your minimum high of the CS 300ns is wrong, because i can get the second byte with logic analyzer but the 52832 could not. Could you give me any advice?

  • Is it possible to save the file that this screenshot is from?

    I would like to measure some timings. It may be that the nRF doesn't have time to start the clocks. Can you try to enable the HCLK and keep it running? Does that change the behavior?

    BR,

    Edvin

Related