2024-11-02 04:25 AM
Hi everyone,
I'm trying to manage the writing and reading of files on the SD card of the STEVAL-STWINKT1B board, but when I run an f_open it gives me FR_NOT_READY, I've tried with different SD cards but the result doesn't change, I ask if anyone has any suggestions on what it could be,
I'm working with stmcubeIDE v 1.16.1 and stmcubeMX v 6.12.1
the configuration on cubeMX is the following:
On stmcubeIDE in main project I only entered the function f_mount and f_open:
with the debugger I saw that f_open returns me FR_NOT_READY.
2024-11-04 03:00 AM
Hello @Luca4
The FR_NOT_READY error you're encountering when trying to use the SD card with the STEVAL-STWINKT1B board typically indicates that the SD card is not properly initialized or that there is an issue with the physical connection. Here are several suggestions to troubleshoot and resolve this issue:
Check Physical Connections:
Ensure that all connections between the SD card and the STM32 microcontroller are secure and correctly wired. Pay special attention to the CMD, CLK, and data lines (D0-D3) as well as any card detect pins.
Card Detect Pin:
If you're using a card detect feature, ensure that the pin is configured correctly in your code. It should be set as an input with a pull-up or pull-down resistor as necessary. If the card detect pin is not configured or wired correctly, it may lead to FR_NOT_READY errors35.
Debugging DISKIO Layer:
If you continue to receive FR_NOT_READY, consider diving into the DISKIO layer of FatFs to check how it handles initialization and whether it detects the card presence correctly
Please check this POST1 it could help you resolve the issue.
THX
Ghofrane
2024-11-04 03:54 AM
Hi @Ghofrane GSOURI,
I debug the project and saw that the issue is in stm32l4xx_hal_sd.c function:
/* Identify card operating voltage */
errorstate = SD_PowerON(hsd);
if(errorstate != HAL_SD_ERROR_NONE)
{
hsd->State = HAL_SD_STATE_READY;
hsd->ErrorCode |= errorstate;
return HAL_ERROR;
}
this is a function inside BSP_SD_Init() in sd_dikio.c file, the card detect pin works great.
I have used the board with the SD card for other projects before, and it was working correctly. I am asking if recent updates in STM32CubeIDE, STM32CubeMX, or STLINK could be causing this issue, or if it is more likely a hardware or software problem.
Thanks for the reply,
Luca
2024-11-04 04:39 AM - edited 2024-11-04 04:41 AM
Hello @Luca4
Given your previous successful experiences with the SD card on the same board, it's essential to consider both hardware and software aspects.
Configuration Changes:
Hardware Issues:
Rollback Considerations: