Using DW1001C-dev (nrf52832) with sd card (Adafruit)

Hello!

I´m using dw1001C-dev board (with nrf52832) and i am trying to save some data to my sdcard (Adafruit). The sdcard communicates via SPI.
I am defining SPI pins like this:
#define SDC_SCK_PIN 4 ///< SDC serial clock (SCK) pin.
#define SDC_MOSI_PIN 6 ///< SDC serial data in (DI) pin.
#define SDC_MISO_PIN 7 ///< SDC serial data out (DO) pin.
#define SDC_CS_PIN 3 ///< SDC chip select (CS) pin.

To communicate i am using the nrf52 example code fatfs (from nordic's nrf52 DK).
Every time i try do initialize the disk it fails and starts the code over and over again.
My code is attached (I am programming in SEGGER). Can you please help me?

ss_twr_init_id_hx_adc_rtc - Cópia.zip

Parents
  • Hello! 

    Thank you for the quick response!

    I took a step back and tried using the nrf52 DK board to run the fatfs example from nordic. At first it wasn´t working the SPI, but then, i changed a configuration from sdk_config.h. From: #define NRF_SPI_DRV_MISO_PULLUP_CFG 1 to: #define NRF_SPI_DRV_MISO_PULLUP_CFG 3. Then the SPI worked and didn´t have to change the UART pins. 

    Going back to DW1001C board and doing the sames steps, it still didn´t work. It looks like de SPI that it uses to communicate the UWB works fine, but when it tries to use de SPI for the SDCARD communication it restarts the program. I have just migrated the fatfs example code to my project.

    I have noticed that the datasheet from this board says that the board uses SPI M1 to UWB and SPI S2 to pins connection with other devices.

     

    The fatfs example from nordic uses the SPI master from nrf52 dk , so i think that the problem is that i am trying to use the same master SPI??

    I also tried to change the spi instance to 2 in the sdk_config.h file...but it still didn´t work.

    Do you suggest any other hypothesis ?

    Best regards,

    Rui Ferreira

Reply
  • Hello! 

    Thank you for the quick response!

    I took a step back and tried using the nrf52 DK board to run the fatfs example from nordic. At first it wasn´t working the SPI, but then, i changed a configuration from sdk_config.h. From: #define NRF_SPI_DRV_MISO_PULLUP_CFG 1 to: #define NRF_SPI_DRV_MISO_PULLUP_CFG 3. Then the SPI worked and didn´t have to change the UART pins. 

    Going back to DW1001C board and doing the sames steps, it still didn´t work. It looks like de SPI that it uses to communicate the UWB works fine, but when it tries to use de SPI for the SDCARD communication it restarts the program. I have just migrated the fatfs example code to my project.

    I have noticed that the datasheet from this board says that the board uses SPI M1 to UWB and SPI S2 to pins connection with other devices.

     

    The fatfs example from nordic uses the SPI master from nrf52 dk , so i think that the problem is that i am trying to use the same master SPI??

    I also tried to change the spi instance to 2 in the sdk_config.h file...but it still didn´t work.

    Do you suggest any other hypothesis ?

    Best regards,

    Rui Ferreira

Children
  • Hi,

    The SPI instances and pins are configurable in the application (also at runtime), but the SPI instance used for the UWB transceiver might be hardcoded in the software delivered for the module.

    Rui Ferreira said:
    but when it tries to use de SPI for the SDCARD communication it restarts the program.

    Like I said in my initial reply, this is typically caused by an error being returned by a function passed on to the APP_ERROR_CHECK macro, or an assert/HardFault. Can you check the log from the device or run the debugger to read out any potential error codes?

    Rui Ferreira said:
    The fatfs example from nordic uses the SPI master from nrf52 dk , so i think that the problem is that i am trying to use the same master SPI??

    Do you enable/initialize the UWB when running your FatFS test? Since the SPI instances are configurable at runtime, it will be no issues unless you enable the same instance at the same time. If possible, try to disable the UWB part of the application to see if there are any compatibility issues.

    Rui Ferreira said:
    I also tried to change the spi instance to 2 in the sdk_config.h file...but it still didn´t work.

    Which config did you change in your sdk_config.h file?

    Rui Ferreira said:
    Do you suggest any other hypothesis ?

    Can you please check the SPI pins to the SD-Card with a scope or a logic analyzer, to see if there is any activity?

    Best regards,
    Jørgen

Related