1. Need to interface pen drive with stm32f205rbt6 for logging data in text file in pen drive.
2. Generated code from stm32cube & link for total code is here:
https://drive.google.com/open?id=1oJSXOmWXzn_xduLmcJWXdiNxtMTpdmtP3. Made changes in fatfs.c file generated as below.
4. Problem is code always struk in if(FR_OK != res) & return disk_error always. What error I am doing.
5. is there any example code for STM32F2 using pen drive for storage purpose to see exactly where changes are to be made.
#include "fatfs.h"
uint8_t retUSBH; /* Return value for USBH */
char USBHPath[4]; /* USBH logical drive path */
FATFS USBHFatFS; /* File system object for USBH logical drive */
FIL USBHFile; /* File object for USBH */
FRESULT res;
/* USER CODE BEGIN Variables */
/* USER CODE END Variables */
void MX_FATFS_Init(void)
{
/*## FatFS: Link the USBH driver ###########################*/
retUSBH = FATFS_LinkDriver(&USBH_Driver, USBHPath);
/* USER CODE BEGIN Init */
/* additional user code for init */
/* USER CODE END Init */
res = f_mount(&USBHFatFS , USBHPath ,0U);
if(FR_OK != res)
{
while(1);
}
res = f_setlabel("DATA DISK");
if(FR_OK != res)
{
while(1);
}
res = f_open(&USBHFile, "/_SERIAL.txt", FA_OPEN_ALWAYS);
if(FR_OK != res)
{
while(1);
}
}
/**
* @brief Gets Time from RTC
* @param None
* @retval Time in DWORD
*/
DWORD get_fattime(void)
{
/* USER CODE BEGIN get_fattime */
return 0;
/* USER CODE END get_fattime */
}