USBMSD Assertion Failed: ret == HAL_OK


I am trying to use the USBMSD library to have an SD card connected via SPI to a NUCLEO-H743ZI2 come up on a PC as a storage device. I have gotten it to work half of the time, but the other half of the time on board reset, or when the USB for the MSD is plugged in I get a crash with the error message “Assertion Failed: ret == HAL_OK”. If I reset the board repeatedly it will eventually work, but I’ll need it to work every time because this can’t happen when it is deployed to customers. Any ideas as to why this may be happening? Also when this does go out to customers it will be using an STM32F767xI MCU instead, with a dedicated SPI flash chip, but until I get the NUCLEO-F767ZI this is the one I am testing with.


the H743 board is not yet enabled for USBDevice. I have fixed some problem that exists with H7 and USB, but in addition also the clock configuration has to be changed. So in general Mbed USB will work with this board, it just takes some time for checking the PR.

targets.json needs an device_has USBDEVICE entry and for the clock check this: