Page 1 of 1

Hard Fault surrounding USB after ChibiOS upgrade

Posted: Wed Jan 13, 2016 2:08 am
by jayalfredprufrock
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:

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.

Re: Hard Fault surrounding USB after ChibiOS upgrade

Posted: Wed Jan 13, 2016 7:46 am
by Giovanni
Hi,

There is a known bug in the serial-usb driver, there will be an update during weekend.

Giovanni

Re: Hard Fault surrounding USB after ChibiOS upgrade

Posted: Wed Jan 13, 2016 8:16 am
by Giovanni
This is the ticket: https://sourceforge.net/p/chibios/bugs/689/

The bug has already been fixed in repository.

Giovanni

Re: Hard Fault surrounding USB after ChibiOS upgrade

Posted: Wed Jan 13, 2016 7:09 pm
by jayalfredprufrock
Awesome, thanks Giovanni. As always, thanks for all your hard work.