2020-08-13 02:49 AM
I generate the code for FATFS. But functions in user_diskio.c not populated.
for example
DRESULT USER_write (
BYTE pdrv, /* Physical drive nmuber to identify the drive */
const BYTE *buff, /* Data to be written */
DWORD sector, /* Sector address in LBA */
UINT count /* Number of sectors to write */
)
{
/* USER CODE BEGIN WRITE */
/* USER CODE HERE */
return RES_OK;
/* USER CODE END WRITE */
}
What should I set to populate these functions?
2020-08-13 03:14 AM
You are supposed to implement the backend yourself.
For a SD specific backend, there is sample code here: https://github.com/STMicroelectronics/STM32CubeF0/tree/master/Drivers/BSP/Adafruit_Shield
And the original FATFS authors docs: http://elm-chan.org/fsw/ff/00index_e.html
2020-08-13 03:35 AM
I see. Thank you. To implement myself - it's better be in IAR with simple and clear code.
2020-08-13 03:41 AM
Well. You sure have a specific backend for your design. FATFS is "just" a translation from file ops to block level IO. What is your target hardware?
2020-08-13 04:02 AM
It's B-L475E-IOT01A with STM32L475vc inside.
2020-08-13 04:34 AM
If you wanna use QSPI check here https://github.com/STMicroelectronics/STM32CubeL4/tree/master/Drivers/BSP/B-L475E-IOT01
SD card is nearby (Adafruit Shield)
You still have to write some glue code.
2020-08-13 07:36 AM
That's the problem, why I drifted to STM32CubeIDE. No BSP driver for regular SPI. :))
2020-08-13 07:43 AM
search the forum for stm32_spi_flash_fatfs ?
2020-08-13 07:47 AM
Thank you.