However the MSD driver crashes when connecting to a MacOS or Windows machine. This happens both in the STM32F4 and the STM32H7 example (ChibiOS-Contrib/testhal/STM32/STM32F4xx/USB_MSD and ChibiOS-Contrib/testhal/STM32/STM32H7xx/USB_MSD).
The USB driver crashes in the EP0 setup because it's already transmitting:
Code: Select all
#1 0x08000f2a in usbStartTransmitI (usbp=0x800f6e8 <__func__.9137>, usbp@entry=0x2000d408 <USBD1>, ep=ep@entry=0 '\000', buf=0x800f734 <active_status> "", n=2) at ../../../../../ChibiOS/os/hal/src/hal_usb.c:498
498 osalDbgAssert(!usbGetTransmitStatusI(usbp, ep), "already transmitting");
Backtrace:
Code: Select all
#0 chSysHalt (reason=reason@entry=0x800f6e8 <__func__.9137> "usbStartTransmitI") at ../../../../../ChibiOS/os/rt/src/chsys.c:205
#1 0x08000f2a in usbStartTransmitI (usbp=0x800f6e8 <__func__.9137>, usbp@entry=0x2000d408 <USBD1>, ep=ep@entry=0 '\000', buf=0x800f734 <active_status> "", n=2) at ../../../../../ChibiOS/os/hal/src/hal_usb.c:498
#2 0x080011c2 in _usb_ep0setup (usbp=0x2000d408 <USBD1>, ep=<optimized out>) at ../../../../../ChibiOS/os/hal/src/hal_usb.c:834
#3 0x080024b2 in otg_epout_handler (ep=ep@entry=0 '\000', usbp=0x2000d408 <USBD1>) at ../../../../../ChibiOS/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c:427
#4 0x080027ca in usb_lld_serve_interrupt (usbp=0x2000d408 <USBD1>) at ../../../../../ChibiOS/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c:611
#5 Vector14C () at ../../../../../ChibiOS/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c:685
#6 <signal handler called>
#7 0x55555554 in ?? ()
My own project (on STM32H7) crashes in a similar way in EP0, but because it's already receiving:
Code: Select all
#1 0x08001d86 in usbStartReceiveI (usbp=0x24000448 <USBD1>, ep=0 '\000', buf=0x0, n=0) at ./ChibiOS/os/hal/src/hal_usb.c:459
459 osalDbgAssert(!usbGetReceiveStatusI(usbp, ep), "already receiving");
Backtrace:
Code: Select all
#0 0x08005224 in chSysHalt (reason=0x8009910 <__func__.10090> "usbStartReceiveI") at ./ChibiOS/os/rt/src/chsys.c:198
#1 0x08001d86 in usbStartReceiveI (usbp=0x24000448 <USBD1>, ep=0 '\000', buf=0x0, n=0) at ./ChibiOS/os/hal/src/hal_usb.c:459
#2 0x0800241e in _usb_ep0in (usbp=0x24000448 <USBD1>, ep=0 '\000') at ./ChibiOS/os/hal/src/hal_usb.c:909
#3 0x08003a76 in otg_epin_handler (usbp=0x24000448 <USBD1>, ep=0 '\000') at ./ChibiOS/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c:399
#4 0x0800403e in usb_lld_serve_interrupt (usbp=0x24000448 <USBD1>) at ./ChibiOS/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c:641
#5 0x080040f2 in Vector1D4 () at ./ChibiOS/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c:685
#6 <signal handler called>
#7 0x55555554 in ?? ()
With linux the MSD driver does work, only 'sudo lsusb -v -d 0483:5740' gives errors for the string descriptors and gives the following errors:
Code: Select all
can't get device qualifier: Resource temporarily unavailable
can't get debug descriptor: Resource temporarily unavailable
cannot read device status, Resource temporarily unavailable (11)
I'm using gcc version 9.2.1 20191025 (release) [ARM/arm-9-branch revision 277599] (15:9-2019-q4-0ubuntu1)
Any ideas what might be wrong?