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

nRF52840 Dongle FATFS issue when SPIM and SPIS are configured at the same time

Hello, 

I have been using nRF52840-DK and also nRF52840 Dongle for testing and I found an interesting behaviour when I established my test setup. The RF module acts as an SPI slave towards another MCU, and also acts as an SPI master towards a micro SD card extension. As far as I know most of the existing GPIO pins can be configured to be used as SPI pins so based on that my PIN layout is the following:

SPIM (micro SD card extension):

  • SCK: P0.31
  • MISO: P0.13
  • MOSI: P0.15
  • CS: P1.0

SPIS (another MCU):

  • SCK: P1.10
  • MOSI: P1.15
  • MISO: P1.13
  • CS: P0.2

Also there is an additional GPIO configured as output on P0.29.

I also set the MISO Pull configuration to pull-up because I read (https://devzone.nordicsemi.com/f/nordic-q-a/24334/fatfs-example-sdk14-0-0-not-working#post-id-163682) that it is needed for the fatfs library to work as expected for new generation micro SD cards.

The issue is when I execute my program the nRF52840-DK works perfectly and the data is written to the SD card always, but when I use the Dongle the data is usually not written (fatfs fails with disk initialization failure). It only happens when I use a new generation 32Gb U3 and U1 micro SD cards, the issue is not present for older versions (with 16Gb U1 works fine).

I tried to change the RF module (Dongle), cables, and tested the setup with 3 different kind of micro SD card extensions, for all of them I received the same result. Also tested the SPIM and SPIS separately and like that both works fine (even the fatfs example works flawlessly).

Is there any difference in the PIN configuration or setup between the nRF52840-DK and Dongle that might cause this issue? Or do you have any PIN layout recommendations that might solve this issue if I intend to use SPIM and SPIS at the same time for the nRF52840 Dongle?

Thank you in advance for your support!

Parents
  • Hi

    Yes, it should absolutely be possible to use SPIS, SPIM, and the radio simultaneously. Just remember to have the SPIS and SPIM in different instances so they don't conflict with one another.

    I would suggest starting with your DK to find suitable GPIOs for the SPIS and SPIM, as there are way more GPIOs available there. Here is a list of GPIOs that can be used in high drive/frequency mode without interfering with radio performance:

    P0.04
    P0.05
    P0.06
    P0.07
    P0.08
    P0.11
    P0.12
    P0.13
    P0.14
    P0.15
    P0.16
    P0.17
    P0.18 (configurable as pin reset as well)
    P0.19
    P0.20
    P0.21
    P0.22
    P0.23
    P0.24
    P0.25
    P1.00
    P1.08
    P1.09

    Regarding debugging on the Dongle, you should be able to do so by soldering a 10-pin header onto the P1 header footprint on the bottom side of the Dongle (see section 6.3.2 in the Dongle user guide or the Dongle programming tutorial for details).

    Best regards,

    Simon

  • Hello Simon,

    I started to test the high drive GPIOs, but I might be missing some configuration because if I reconfigure the pin connections of the micro SD extension it does not work at all. I configured the following pins:

    • SCK: P0.20
    • MOSI: P0.21
    • MISO: P0.22
    • CS: P0.23

    I also tested several other high drive pins, but neither of them now working as expected. The HFCLK is started when I initialize the used clocks.

    I saw that the SPIM driver has the following configuration:

        nrf_gpio_cfg(p_config->sck_pin,

                     NRF_GPIO_PIN_DIR_OUTPUT,

                     NRF_GPIO_PIN_INPUT_CONNECT,

                     NRF_GPIO_PIN_NOPULL,

                     NRF_GPIO_PIN_S0S1,

                     NRF_GPIO_PIN_NOSENSE);

    Should I modify the 5th parameter to NRF_GPIO_PIN_H0H1 in order to make it work?

    Also thank you for the suggestion of soldering a 2x5 pin connector on the Dongle, I will definitely try it later to troubleshoot the issue further.

    Thank you in advance for your answer.

    Br,

    Bertalan

Reply
  • Hello Simon,

    I started to test the high drive GPIOs, but I might be missing some configuration because if I reconfigure the pin connections of the micro SD extension it does not work at all. I configured the following pins:

    • SCK: P0.20
    • MOSI: P0.21
    • MISO: P0.22
    • CS: P0.23

    I also tested several other high drive pins, but neither of them now working as expected. The HFCLK is started when I initialize the used clocks.

    I saw that the SPIM driver has the following configuration:

        nrf_gpio_cfg(p_config->sck_pin,

                     NRF_GPIO_PIN_DIR_OUTPUT,

                     NRF_GPIO_PIN_INPUT_CONNECT,

                     NRF_GPIO_PIN_NOPULL,

                     NRF_GPIO_PIN_S0S1,

                     NRF_GPIO_PIN_NOSENSE);

    Should I modify the 5th parameter to NRF_GPIO_PIN_H0H1 in order to make it work?

    Also thank you for the suggestion of soldering a 2x5 pin connector on the Dongle, I will definitely try it later to troubleshoot the issue further.

    Thank you in advance for your answer.

    Br,

    Bertalan

Children
No Data
Related