AnsweredAssumed Answered

F_mount function is not working with STM32F401ReTx

Question asked by Elman Karimli on Jun 6, 2018
Latest reply on Jun 6, 2018 by Clive Two.Zero

I have written some simple code (with the help of STM32CubeMx) for STM32F407VGTx to create a file in SDcard. Although it works perfectly with 407, it is not working with STM32F401ReTx. To be clear, I have generated code with CubeMx specifically for 401(did not use the code for 407).

Even for 407, I am able to work with only Version 21 of CubeMx and firmware version 16. I have added the code below. Any ideas?

int main(void){   /* USER CODE BEGIN 1 */   /* USER CODE END 1 */   /* MCU Configuration----------------------------------------------------------*/   /* Reset of all peripherals, Initializes the Flash interface and the Systick. */  HAL_Init();   /* USER CODE BEGIN Init */   /* USER CODE END Init */   /* Configure the system clock */  SystemClock_Config();   /* USER CODE BEGIN SysInit */   /* USER CODE END SysInit */   /* Initialize all configured peripherals */  MX_GPIO_Init();  MX_DMA_Init();  MX_SDIO_SD_Init();  MX_FATFS_Init();   /* USER CODE BEGIN 2 */  if(f_mount(&myFatFS,SD_Path,1)==FR_OK)  {      HAL_Delay(1000);      f_open(&myFil,"new document.txt\0",FA_CREATE_ALWAYS | FA_WRITE);      f_close(&myFil);  }   /* USER CODE END 2 */   /* Infinite loop */  /* USER CODE BEGIN WHILE */  while (1)  {  /* USER CODE END WHILE */   /* USER CODE BEGIN 3 */   }  /* USER CODE END 3 */}

Outcomes