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

nRF52840-DK and nRF52840 Dongle difference during SPI communication with same pins

Hello,

I observed a weird behavior when I changed to nRF52840-DK from nRF52840 Dongle. I am using the device as an SPI slave connected to a Raspberry PI as SPI master.

The following pins are used:

SCK: P1.10

MISO: P1.13

MOSI: P1.15

CS: P0.2

When I started to use the DK with the USB debugger with my laptop the some of the packages sent via SPI was missing one bit from the front (instead of 255 the value 127 was received), however in the debugger the correct value was present. The SPI speed is set to 4MHz, but I tried it with 400KHz too and the same issue was present. SPI mode is 0 on both sides (as defined in NRFX_SPIS_DEFAULT_CONFIG). The same exact software is tested with the nRF52840 Dongle and this issue is not present in that case.

My question is that, are any of these pins used for something different on the DK because of which I have this problem? Should I consider different pin configuration for SPI communication?

Thank you in advance for your support!

Best regards,

Bertalan

  • I just tested this myself with the SPI master example (on nRF52832) and the SPI slave example (on nRF52840) with the pins you selected, and it worked without problems.

    I am not sure what causing this issue? It may be caused by the Raspberry reading on the wrong edges, try changing that.

    Have you checked with a logic analyzer, to see what is actually sent over the lines?

    Best regards,

    Simon

  • Hello Simon,

    Thanks for the response, and previously I recall that I tested the basic SPI communication was working fine even with the DK, but now that I am using the Radio communication along with the SPIS functionality this issue came up. However why I thought it has to do something with the nRF52840 device is because when I change to nRF52840 Dongle this issue is not present at all (which means that the Raspberry side is good in that case).

    I did not yet check the lines with logic analyzer, but maybe later we will check it on an oscilloscope.

    My first guess was that something went wrong on my older DK board, but today I checked it with a brand new one and the issue still persists. I am using SPIS 1.

    Best regards,

    Bertalan

  • I'm sorry for the delay, I've been quite busy lately. I'll try to dig some more into this tomorrow. I would be interested in seeing the result from the oscilloscope, however.

    Best regards,

    Simon

  • Have you been able to capture a trace from the oscilloscope?

    So if I understand the problem correctly, the data sent from the nRF52 via MISO to the raspberry is missing one bit? What happens if you run it without debugging?

    Have you tried to track down the issue and figure out exactly where the fault happens?

    • What is the tx buffer set to in nrf_drv_spis_buffers_set?
    • What is the tx buffer set to in nRF5SDK17009d13099\nRF5_SDK_17.0.0_9d13099\modules\nrfx\hal\nrf_spis.h-->nrf_spis_tx_buffer_set()?
    • What is transferred over the lines? (Check with an oscilloscope or logic analyzer)
    • What is received on the Raspberry?

    If you can track down exactly where the issue occurs, it is easier to figure out the cause.

    Best regards,

    Simon

Related