2021-11-19 02:10 AM
i am using STM32F429ZIT6U board does the board support the mounting of SD card and USB at a time
The main problem is both the devices get detected or get mounted when i use f_mount but the file that is get be stored in SD card is will be get stored in USB and SD card not have any file
void sd_card_write()
{
FATFS_LinkDriver(&USER_Driver, USERPath);
fresult = f_mount(&sd_fs, (TCHAR const*)USERPath, 1);
if (fresult != FR_OK)
{
HAL_GPIO_WritePin(GPIOG, GPIO_PIN_14, 1);
HAL_GPIO_WritePin(GPIOG, GPIO_PIN_13, 0);
}
else
{
HAL_GPIO_WritePin(GPIOG, GPIO_PIN_13, 1);
HAL_GPIO_WritePin(GPIOG, GPIO_PIN_14, 0);
}
fresult = f_open(&sd_file, "0:FILE.TXT", FA_OPEN_EXISTING | FA_WRITE| FA_WRITE | FA_OPEN_APPEND);
sprintf(buffer,"Temperature:%f\n",Temp);
fresult = f_write(&sd_file, (const void *)buffer, strlen(buffer), &bw);
f_close(&sd_file);
clear_buffer();
FATFS_UnLinkDriver(USERPath);
}
void UsbTest_Write(void)
{
f_open(&sd_file, "0:FILE.TXT", FA_READ);
f_open(&usb_file, "1:FILE1.TXT", FA_OPEN_EXISTING |FA_WRITE | FA_OPEN_APPEND);
f_lseek(&sd_file, 0);
f_read(&sd_file, (void *)buffer1, strlen(buffer1), (void *)&bw1 );
f_write(&usb_file, buffer1, strlen(buffer1), (void *)&bw1);
f_close(&sd_file);
f_close(&usb_file);
}
switch(Appli_state)
{
case APPLICATION_IDLE:
break;
case APPLICATION_START:
FATFS_LinkDriver(&USBH_Driver, USBHPath);
if(f_mount(&usb_fs, (TCHAR const*)USBHPath, 0) == FR_OK)
{
HAL_GPIO_WritePin(GPIOG, GPIO_PIN_11, 1);
}
break;
case APPLICATION_READY:
{
UsbTest_Write();
HAL_GPIO_WritePin(GPIOG, GPIO_PIN_12, 1);
HAL_Delay(5);
}
break;
case APPLICATION_DISCONNECT:
HAL_GPIO_WritePin(GPIOG, GPIO_PIN_11, 0);
FATFS_UnLinkDriver(USBHPath);
break;
}
2021-11-19 02:32 AM
That's a chip number, not board, and technically yes with the right software stack and settings two drive instances can work concurrently.
Is strlen() appropriate for a string you haven't read yet?
2021-11-19 03:08 AM
STM32F429I-Disco
i am using User define fatfs for SD card and Usb Disk for Usb Drive.
strlen() is correct. same code working fine for individual interfacing.
2021-11-19 05:01 AM
>>strlen() is correct. same code working fine for individual interfacing.
I'll defer to your knowledge on the string library..
You might want to review what errors/status the FatFs library throws, and if the top-level stuff is all in order start instrumenting the DISKIO and ST's dispatch methods.