2026-01-30
11:01 AM
- last edited on
2026-02-02
12:16 AM
by
Lina_DABASINSKA
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):
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);
I physically disconnected the wire from PA6 (Pin A5 on the Nucleo).
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!
SD Card 32gb from ADATA, (fat32) Allocation unit 8ko
2026-01-30 5:11 PM
See the restrictions on A5/PA6 in the user manual. If you have default solder bridges, PA6 must be left as input.