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

Issues integrating SD card and FatFS with nRF52833 ble_app_uart example

OS: Windows 10 64bit

SW: Segger Embedded Studio 5.10 nRF SDK 17.0.2 Softdevice S140

HW: nRF52833 2020.6

Hello,

I had found an example integrating the ble_app_uart example and the fatfs library to read data from an SD card and sent it via BLE notification posted by a member here Jørgen Holmefjord

This example is made for the nRF52840 and SDK 16.0. I made the necessary changes to get it working on SDK 17.0.2 which is what I'm currently using. I've been able to successfully flash this example onto the nRF52840 and get data sent over from an SD card to a client. However, when trying to implement this example with an nRF52833, I'm having issues initializing the disk. I made all the necessary changes in my project (FLASH/RAM size,etc), and I'm able to compile and flash to the 52833. However, it seems to get stuck indefinitely when disk_initalization(0) is called in the fatfs_init function on line 23 in the main.c:

I've tried debugging this, however I'm still new to embedded development(I'm a student), so I'm having trouble understanding where my issue might be. If I simply let it run with no breakpoints and then pause the execution, I end up in the default_wait_func in diskio_blkdev.c. If I set breakpoints at the disk_initalization(0) and step through, I end up in nrfx_spim_init in nrfx_spin.c:

I'm wondering if it's an issue with my SPI instances in the sdk_config.h, but I'm not sure either way. I understand these are probably things I should be able to figure out on my own, but I've spent a lot of time on this and I'm not getting anywhere so I hope I'm not wasting anyone's time with this. If you can help me then I would really appreciate it, if not I understand and thank you for taking the time to look.

I'll include my current example below if it is of any help. Thank you.ble_app_uart_fatfs_52833.zip

Parents
  • Hi,

    I cannot see any obvious issues in the code/project that should cause this.

    Are you testing with the same SD card on both board? Are you using a card socket without a level converter? Some card adapters are made for Arduino and 5V, where small differences in board voltage levels may make it work with some boards but not others.

    You may also try to add a MISO pullup by changing NRF_SPI_DRV_MISO_PULLUP_CFG to 3. Some SD cards require pullup during the init sequence.

    Best regards,
    Jørgen

Reply
  • Hi,

    I cannot see any obvious issues in the code/project that should cause this.

    Are you testing with the same SD card on both board? Are you using a card socket without a level converter? Some card adapters are made for Arduino and 5V, where small differences in board voltage levels may make it work with some boards but not others.

    You may also try to add a MISO pullup by changing NRF_SPI_DRV_MISO_PULLUP_CFG to 3. Some SD cards require pullup during the init sequence.

    Best regards,
    Jørgen

Children
  • Hi Jørgen,

    Thank you for your example and your response. I am testing with the same SD card and breakout board on the nRF52840 as well as the nRF52833. I'm using this MicroSD breakout by Adafruit. It's a 3.3V power and logic breakout without any level shifting or power regulation. I tried changing the NRF_SPI_DRV_MISO_PULLUP_CFG to 3, but it doesn't seem to have made a difference.

  • Hi,

    There seems to be a bug in pca10100.h board header file that defines ARDUINO_8_PIN to ARDUINO_13_PIN being defined to non-existing GPIOs.

    You can either change the definitions in the file to this:

    '

    Or you can use different GPIOs in the application.

    Best regards,
    Jørgen

  • Jørgen,

    Thank you so much for this! I didn't even think to check if the pins were mapping correctly. I appreciate you looking into this and again thank you for your previous example.