Hard Fault surrounding USB after ChibiOS upgrade

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
jayalfredprufrock
Posts: 36
Joined: Tue Jan 13, 2015 6:33 am
Has thanked: 8 times

Hard Fault surrounding USB after ChibiOS upgrade

Post 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.
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Hard Fault surrounding USB after ChibiOS upgrade

Post by Giovanni »

Hi,

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

Giovanni
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Hard Fault surrounding USB after ChibiOS upgrade

Post by Giovanni »

This is the ticket: https://sourceforge.net/p/chibios/bugs/689/

The bug has already been fixed in repository.

Giovanni
jayalfredprufrock
Posts: 36
Joined: Tue Jan 13, 2015 6:33 am
Has thanked: 8 times

Re: Hard Fault surrounding USB after ChibiOS upgrade

Post by jayalfredprufrock »

Awesome, thanks Giovanni. As always, thanks for all your hard work.
Post Reply