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

SD Card CMD0 response not as expected by app_sdcard

I have a custom board on which I am running the fatfs example from SDK15.2.

On SD Card Initialisation the CMD0 response is unexpected: -

ScreenShot showing 0xBF where NCR expected

Where the NCR would be expected, there is a return of 0xBF. This does not look like R1 with 0 NCR as R1 should have the first bit 0. 

The impact of this is the app_sdcard.c rejects the response as R1 & 0x3 is non-zero (app_sdcard.c:533) and the thread is terminated.

     SDC_RESP_CHECK(SDC_PT, r1);

Any idea why this is happening? I've tried the same code on the nRF52-DK and it works as expected.

Additional Information:-

- MOSI is P0.09 and MISO is P0.10. I have disabled the NFC protection circuitry in UICR.
- I have tried the same pins on the nRF52-DK (moving resistors R25/R26 to R27/R28 to allow the pins to connect to the P6 connector.
- There is one other SPI device on the board but I have disabled this it's CS=1. (I've also tried CS=0)

Thanks in advance for any help. 

 

  • I think the configuration for MISO should be PULLUP? In the example it's set to PULLDOWN (at least if I look at the P0 configuration in SES it shows it as pulldown, and if I change it at that point to be PULLUP it seems to work). 

    I'll try putting a proper fix in to see if that changes things.

  • Yes - that fixed things. I found this was in the sdk_config.h file

    //  NRF_SPI_DRV_MISO_PULLUP_CFG  - MISO PIN pull-up configuration.
     
    // <0=> NRF_GPIO_PIN_NOPULL 
    // <1=> NRF_GPIO_PIN_PULLDOWN 
    // <3=> NRF_GPIO_PIN_PULLUP 
    
    #ifndef NRF_SPI_DRV_MISO_PULLUP_CFG
    #define NRF_SPI_DRV_MISO_PULLUP_CFG 1
    #endif


    So I changed it to

    // <o> NRF_SPI_DRV_MISO_PULLUP_CFG  - MISO PIN pull-up configuration.
     
    // <0=> NRF_GPIO_PIN_NOPULL 
    // <1=> NRF_GPIO_PIN_PULLDOWN 
    // <3=> NRF_GPIO_PIN_PULLUP 
    
    #ifndef NRF_SPI_DRV_MISO_PULLUP_CFG
    #define NRF_SPI_DRV_MISO_PULLUP_CFG NRF_GPIO_PIN_PULLUP
    #endif


    Perhaps I should put a pull-up on the board...

Related