2024-11-10 02:07 PM
I'm using AL94 library on STM32H7 for USB Composite functionality. The MSC class driver appears practically identical to 'native' MSC Class provided by STM.
However, I am having difficulties running even the simple RAM disk example - the drive is correctly recognized by the system, can be formatted, but after formatting, it just stops responding. If I wait a few minutes, the contents of the drive is correctly displayed (??).
The same example built for STM32F4 discovery board without USB Composite part works just fine.
By comparing the USB traffic logs, I noticed that STM32H7 stops responding after receiving command that is a SCSI read of sector 128 (out of bounds, since only 128 sectors are reported). STM32F4 on the other hand, just stalls the in transfer and continues as nothing has happened...
Any idea on what could be going on? The USB analyzer indicates that the SCSI Read command times out on both Out and In transfers. The line indicated below is the result of the last command received.
2024-11-10 03:22 PM
>>I'm using AL94 library..
Perhaps Work with the developer, and fund some support hours?
I'd suggest instrumenting the code, so you can see what's happening in a more real-time fashion, without jamming up in the debugger.
Instrument the HardFault_Handler so you can see if things die there.
The number of sectors should be available via a GET CAPACITY / MODE PAGE type interaction, the OS should be solid, and not go outside those bounds.
2024-11-10 11:23 PM
I haven't been using the debugger since it throws off the USB driver - the CPU itself doesn't reset, the USB bus resets are triggered by the USB host (PC / Windows).
The same number of sectors was configured in both cases and as can be seen from the USB traffic log on STM32F4, the system tries to access te sector that is out of bound, but gets nothing and ignores it.
I'm not really sure why Beagle USB analyzer shows the failed transactions (with a T for timeout) after the bunch of periodic timeouts, but with the correct timestamp. SCSI read command of sector 128 is received by the MCU (I can trigger a breakpoint via the debugger), but it shows up as timeout!?