2023-07-27 9:09 AM
Hello,
I am building and application with a STM32U575 and a 4Gb NAND Flash. What I am trying to achieve now is to upload files from my PC through USB and then used these file within the STM32 using FileX.
I already managed to set up FileX and LevelX to create and manipulate files within the MCU. Then I managed to get a USBX MSC device to appead in windows, with correct capacity, name etc..
Finally I tried to implement the read/write functions in ux_device_msc.c by using the FileX function fx_media_read and fx_media_write. And not I have some issues in the wrinting method.
If I implement the read function "USBD_STORAGE_Read" only, leaving the write function empty, everyting works fine. I am able to find and read my files from windows.
From the moment I implement the USBD_STORAGE_Write function, nothing works anymore. In this configuration, the USB MSC apprears in windows with a capacity of 0 octets and windows stalls if I try to access it. After some digging, I found out that windows tries to write at block 0, which is prevented by the fx_media_write function.
What am I doing wrong here?
Thank you in advance for your help.
Solved! Go to Solution.
2025-10-17 9:11 AM - edited 2025-10-17 9:11 AM
Hi @Pepils @RemiNao @RB4020 @Mr_Ducer,
thanks for this rich exchange, I'd like to share with you a draft application running on the STM32U575_EVAL, that uses the NOR Flash memory embedded on the board as media storage for the USB Device Class.
Hope this Helps.
PS: the .ioc file is there any updated for the project, but some code, has been added manually outside the /* USER CODE */ section may get overridden if the project is regenerated. track the original code under a local git repo.
regards
Haithem.