cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO-L432KC SPI SD Card Error (FR_NOT_READY) - MISO (PA6) stuck at Low?

Raphael716
Associate

Github link to code 

 

Hi everyone,

I am currently working on a project with the NUCLEO-L432KC board, trying to interface a generic SPI MicroSD Card module (the standard blue one, powered via 5V).

I am stuck with the FatFS error FR_NOT_READY (Error 3) during f_mount. After extensive troubleshooting, I suspect a hardware failure on the MISO pin (PA6), but I would like a sanity check on my diagnosis before I remap the pins.

Hardware Setup:

  • Board: NUCLEO-L432KC (STM32L432)

  • SD Module: Generic SPI adapter (Powered via 5V VIN pin)

  • Wiring:

    • CS: PB6 (D5)

    • SCK: PA1 (A1)

    • MOSI: PA7 (A6)

    • MISO: PA6 (A5) <-- The problematic pin

Software Configuration:

  • IDE: STM32CubeIDE

  • FatFS: _MAX_SS and _MIN_SS set to 512.

  • SPI1: Master, Prescaler 256 (Low speed for init), CPOL Low, CPHA 1 Edge.

The Issue & Diagnostics: The communication fails at the very beginning. When sending CMD0 to wake up the card, the SPI RX buffer always returns 0x00 instead of 0xFF (Idle) or 0x01 (Success).

To isolate the issue, I performed a hardware test on the MISO pin (PA6):

  1. I modified stm32l4xx_hal_msp.c to enable the internal Pull-Up on the MISO pin:

    // In HAL_SPI_MspInit
    GPIO_InitStruct.Pin = GPIO_PIN_6; // MISO (PA6)
    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
    GPIO_InitStruct.Pull = GPIO_PULLUP; // Force High if floating
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
    GPIO_InitStruct.Alternate = GPIO_AF5_SPI1;
    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  2. I physically disconnected the wire from PA6 (Pin A5 on the Nucleo).

  3. I ran a debug loop printing the received SPI byte (sending 0xFF dummy bytes).

Result: Despite the Internal Pull-Up being enabled and the pin being physically disconnected (floating), the MCU still reads 0x00. Logically, with a Pull-Up and no load, I should be reading 0xFF (All 1s).

My Question: Is there any specific configuration on the NUCLEO-L432KC (clock gating, conflict with other peripherals, or analog interference) that could force PA6 to read 0 internally despite a Pull-Up? Or is it safe to conclude that the PA6 pin on my MCU is physically dead/shorted to Ground?

I am planning to remap MISO to PA11 (D10) as a workaround.

Thanks for your help!

téléchargement.png

SD Card 32gb from ADATA, (fat32) Allocation unit 8ko

téléchargement (1).png

 

1 REPLY 1
TDK
Super User

See the restrictions on A5/PA6 in the user manual. If you have default solder bridges, PA6 must be left as input.

TDK_0-1769821862569.jpeg

 

If you feel a post has answered your question, please click "Accept as Solution".