In the latest version of CherryUSB (most likely as of commit 2660af5), the function usb_osal_timer_start is called from within an ISR during host-side device enumeration.
As of the v1.1.2 release, in the FreeRTOS port (usb_osal_freertos.c) this function just calls xTimerStart. Doing that is not safe from within an ISR, and will cause an assertion to be thrown.
One fix for this is to modify the function as follows:
void usb_osal_timer_start(struct usb_osal_timer *timer)
{
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
int ret;
if (xPortIsInsideInterrupt()) {
ret = xTimerStartFromISR(timer->timer, &xHigherPriorityTaskWoken);
if (ret == pdPASS) {
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
}
} else {
xTimerStart(timer->timer, 0);
}
}
I've had to make this change in my local codebase to get CherryUSB working in my environment.
In the latest version of CherryUSB (most likely as of commit 2660af5), the function
usb_osal_timer_start
is called from within an ISR during host-side device enumeration.As of the v1.1.2 release, in the FreeRTOS port (
usb_osal_freertos.c
) this function just callsxTimerStart
. Doing that is not safe from within an ISR, and will cause an assertion to be thrown.One fix for this is to modify the function as follows:
I've had to make this change in my local codebase to get CherryUSB working in my environment.