cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB55 SD card SPI FR_NOT_READY / PLLCLK - HSE

BNist.1
Associate II

0693W000000X9VdQAK.png0693W000000X9ViQAK.pngHello! I am very new at this and I don't understand a lot, so please be patient.

I have an STM32WB55 to which I need to connect an SD module to store data from some sensors in SPI mode. I basically followed some tutorials and got to the conclusion that fatfs is the way to go.

So, after debugging it step by step I can mount the card, but it does not let me to open it. I always get FR_NOT_READY.

I followed and read all the tutorials on line that I could put my hands on and it is still not working whatever I may do. I suspect that my problem lies within the clock that I need to program. (I don't understand it AT ALL). The guys in the video set one clock to HSE and the other to PLLCLK (check the photos). However when I do this, it returns me some 0xffffff8 error or 0x88888. Is this even possible on this type of microcontroller? Having HSE and PLLCLK together?

This is the tutorial that I am focusing the most on: https://controllerstech.com/sd-card-using-spi-in-stm32/

Here's my code, the clock and my return of FR_NOT_READY.

I am sorry if all of these are stupid questions, but I am so damn lost and I have no clue what to do, as I literally read everything I could find, and it either didn't help much or I didn't understand it enough in order for it to be helpful.

/* USER CODE BEGIN 0 */
 
FATFS fs; //file system
FIL fil; // file
FRESULT fresult; //to store the result
FATFS *pfs;
 
/* USER CODE END 0 */
 
 
/* USER CODE BEGIN 2 */
 
    fresult = f_mount(&fs, "/", 0); //here is either 1 or 0, not sure. on the video it was 0, on the internet it was 1
 
 
    /****************************** PUTS and GETS ************************************************/
 
    //THIS CREATES THE FILE OR IT OPENS IT IF IT WASN'T ALREADY CREATED
    fresult = f_open(&fil, "file1.txt", FA_OPEN_ALWAYS | FA_READ | FA_WRITE);
 
    //WRITING TEXT TO THE FILE
    fresult = f_puts("TEXT HERE FOR THE FILE", &fil);
 
    /* Close file */
    f_close(&fil);
 
    /* Close file */
    f_close(&fil);
    // 
  /* USER CODE END 2 */

0693W000000X9VYQA0.png

0 REPLIES 0