Hard Fault surrounding USB after ChibiOS upgrade
Posted: Wed Jan 13, 2016 2:08 am
Hello, I recently upgraded to the latest version of ChibiOS and now am seeing hard faults that seem to be related to the recent changes in the USB driver. To debug I created a simple test case that looks something like this:
I took all the usb configuration, events/callbacks (including the new SOF), etc. right out of the HAL usb test and am using a STM32F411RE-Nucleo board with pretty much all of the stock settings from halconf.h, mcuconf.h, and chconf.h. Stepping through the code before the fault shows that the problem occurs during osalSysUnlock() towards the end of the obqWriteTimeout() function. I've tried turning on CORTEX_SIMPLIFIED_PRIORITY but that didn't solve the problem either. Any ideas what could be causing the problem or how I might get to the bottom of this?? Thanks so much.
Code: Select all
sduStart(&SDU1, &serusbcfg);
usbStart(serusbcfg.usbp, &usbcfg);
usbConnectBus(serusbcfg.usbp);
while (serusbcfg.usbp->state != USB_ACTIVE)
chThdSleepMilliseconds(1000);
//this string is successfully written
chSequentialStreamWrite((BaseSequentialStream*)&SDU1, (void*)test_string, strlen(test_string));
//when I comment the sleep out, both writes succeed
chThdSleepMilliseconds(1000);
//when the thread resumes after the sleep, the second write fails and causes a hard fault
chSequentialStreamWrite((BaseSequentialStream*)&SDU1, (void*)test_string, strlen(test_string));
I took all the usb configuration, events/callbacks (including the new SOF), etc. right out of the HAL usb test and am using a STM32F411RE-Nucleo board with pretty much all of the stock settings from halconf.h, mcuconf.h, and chconf.h. Stepping through the code before the fault shows that the problem occurs during osalSysUnlock() towards the end of the obqWriteTimeout() function. I've tried turning on CORTEX_SIMPLIFIED_PRIORITY but that didn't solve the problem either. Any ideas what could be causing the problem or how I might get to the bottom of this?? Thanks so much.