cancel
Showing results for 
Search instead for 
Did you mean: 

I am trying to implement fatfs usb project for stm32l073RZ board with an external spi flash .

svii
Associate III

where i have enabled fatfs and usb mass storage in cubemx and generated a project,

i have tested the usb mass storage successfuly ,when plugged in my pc it is able to detect the usb as mass storage and prompts to format it.

This is were i am stuck:

I have not integrated fatfs into it , i am using an external spi flash i have the drivers they are tested and working fine(4K min sector erase, byte read,byte write) i have come 

across files (user_diskio.c & usbd_storage_if.c) should i add my spi flash driver function in these files.

The user_diskio.c has functions like: 

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 */

)

{ }

The usbd_storage_if.c has functions like: 

STORAGE_Write_FS(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len)

{ }  

these functions are only for initialize,read,write,card info.Why cant i find function that will use erase function of spi flash. I did refer example with similar application targeting sd card, but still could not get the fatfs to work with spi flash.

Kindly help,if any one has worked on integrating the fatfs to an external spi flash along with the usb, Thanks in advance.

1 REPLY 1
dbgarasiya
Senior II

same thing i want to implement