2023-07-14 09:32 AM
Hi,
I'm looking for a working example for STM32L496 that uses threadx, filex, usbx and creates a mass storage device using SD card. I also need the filesystem to work locally. Bonus is a dual device that does CDC for a virtual serial port.
I have tried making a project with cubeIDE and can get a working RAM file system. The usb enumerates as a drive, but explorer doesn't show a drive or any files.
I ported a lot of code from the Azure repo for the STM32L4R9 Discovery sample project, that got me to this point, but am stuck.
A complete working example would be a great help.
2023-07-18 04:37 AM
Hi @mnowell129
First, is STM32L496 a USB Host or Device ?
If it is Device, then you, normally, need no file system, since the USB Host would generally manage the file system. If you locally have a file system, it will interfere and collide with the Host file system.
Then, did you generate the code from STM32CubeIDE/STM32CubeMX or did you use the existing examples?
If you look for device mode, and if you did generate the code, then I would advise you instead to combine (merge) these two or three examples:
Using the existing, already working examples instead of generating from STM32CubeIDE/STM32CubeMX will spare you the time of debugging configuration issues. Then you can port the low layer related to your specific board/application.
Differences between STM32L4R and STM32L49 are not huge, so the porting should go smoothly (and you already have the base of it in your current project).
I hope it helps ?
2023-07-18 06:55 AM
Thanks for the feedback. I'm using device only mode. I have tried creating examples in IDE/MX, neither of which run. One of the issues is the issue with DMA on the L496 requiring manual updates to the SD driver. I tried diffing the L4R project with the L49 and made them basically identical but found no joy.
I realize that I don't need filesystem to run MSC, but I need both and different times during operation so they coexist. Note: I got the CDC/threadx project to run successfully. I also got the combined filesystem/MSC application to run properly using FreeRTOS and the older drivers, which unfortunately don't support multi-device (MSC and CDC at the same time).
I've ordered a 4R eval board to make sure the 4R application works for me then I'll try to merge.
Thanks for the suggestions. If you happen to have an .ioc that creates a MSC/CDC combo on the L496 that would be helpful.
2023-07-28 02:58 PM - edited 2023-07-28 02:58 PM
So I got the L4R9 Disco board and got the MSC threadx example to run. I merged the CDC example and now it enumerates and the file system shows up. The serial port shows up. I looped the serial port back so it would echo to the PC, I get an incoming character from CDC, but it's not transmitting. The two devices classes are interfering with each other.
The MSC seems to be stuck in a semaphore wait in _ux_dcd_stm32_transfer_request, apparently waiting for input, but this seems to block the CDC from gaining access to transmit.
TIA
2023-07-28 11:58 PM - edited 2023-07-29 12:05 AM
> The usb enumerates as a drive, but explorer doesn't show a drive or any files.
The Windows explorer has option to hide empty drives. Is there any file?
> The two devices classes are interfering with each other.
You need a composite device with two functions. Of course two separate independent device flows will interfere.