cancel
Showing results for 
Search instead for 
Did you mean: 

Error FR_NOT_READY with SDMMC on STEVAL-STWINKT1B board

Luca4
Associate II

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:

Luca4_0-1730546238620.pngLuca4_1-1730546257603.pngLuca4_2-1730546280063.pngLuca4_3-1730546297071.pngLuca4_4-1730546309719.png

On stmcubeIDE in main project I only entered the function f_mount and f_open:

Luca4_5-1730546449238.png

with the debugger I saw that f_open returns me FR_NOT_READY.

3 REPLIES 3
Ghofrane GSOURI
ST Employee

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

 

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

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:

  • Ensure that all configurations in CubeMX match the requirements for your specific SD card and application. This includes checking the clock settings, bus width (4-bit mode), and any other relevant parameters.
  • I propose to change the bus width(2 bit mode ) and see if it works

Hardware Issues:

  • Even if the card detect pin is functioning correctly, there could still be hardware-related issues such as poor connections or damaged pins on either the SD card socket or the microcontroller.
  • If possible, test with a known working SD card and verify that the power supply to the SD card is stable and adequate.

Rollback Considerations:

  • If you suspect that recent updates are causing these issues, consider rolling back to a previous version of STM32CubeIDE or STM32CubeMX that you know worked well with your project. This can help determine if the problem is indeed related to software changes