Skip to main content
ATank.1
Associate III
January 11, 2023
Solved

USB mass storage with external flash on QSPI and STM32H745BIT6

  • January 11, 2023
  • 2 replies
  • 2779 views

Hi,

I am using STM32H745BIT6 controller and wish to use the external flash memory as a mass storage device. The external flash memory is connected on QSPI.

The application would be,

user will connect the USB cable to PC and PC should be able to show the external QSPI flash as a drive on PC i.e. as a mass storage device.

Is this possible with STM32H745BIT6 device?.

Please point me to some examples which can be refered.

Thanks

Anuj.

This topic has been closed for replies.
Best answer by gbm

Start with CubeIDE USB mass storage device with storage volume implemented in MCU's RAM - you will find some guides at ST. Then implement and verify QSPI Flash operations. The funniest part is the implementation of your own FTL - Flash Translation Layer, for mapping logical 512 B sectors to blocks in Flash 4 KiB pages. You may skip the FTL and implement 4 KiB sectors directly but this may result in reduced Flash lifetime.

It is important to understand that the MSC-BOT-SCSI protocol does not directly allow for simultaneous file access via USB and locally by the MCU. If you need to access files from both sides at the same time, you must implement another protocol, commonly used by smartphones.

2 replies

gbm
gbmBest answer
Super User
January 11, 2023

Start with CubeIDE USB mass storage device with storage volume implemented in MCU's RAM - you will find some guides at ST. Then implement and verify QSPI Flash operations. The funniest part is the implementation of your own FTL - Flash Translation Layer, for mapping logical 512 B sectors to blocks in Flash 4 KiB pages. You may skip the FTL and implement 4 KiB sectors directly but this may result in reduced Flash lifetime.

It is important to understand that the MSC-BOT-SCSI protocol does not directly allow for simultaneous file access via USB and locally by the MCU. If you need to access files from both sides at the same time, you must implement another protocol, commonly used by smartphones.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
Piranha
Principal III
January 15, 2023