FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [August 2014 Threads]
Hi all,
I'm trying to use lwIP and USB host together (LPC1768). The IP is from FreeRTOS sample CORTEXLPC168GCC_RedSuite, and the USB is from the lpcopen 2.10.
Each task works fine if alone, but when they work together, I have problems on the enumerating devices when the USB is detached and reattached: sometimes I get an HardFault and sometimes the enumeration hangs in the function:
static HCDSTATUS WaitForTransferComplete(uint8t EdIdx)
{
while ( HcdED(EdIdx)->status == HCDSTATUSTRANSFERQUEUED ) {}
return (HCDSTATUS) HcdED(EdIdx)->status;
}
where the status> should be updated by the USB's ISR.
It seems an interrupt problem, but I don't understand more.
Any help is greatly appreciated.
Best regards,
Paolo
Parts of the USB protocol have tight timing requirements, and it might be that the USB interrupt is being pre-empted by the lwIP interrupt. Try ensuring the USB interrupt has a much higher priority than the Ethernet interrupt. If the USB interrupt is not using the FreeRTOS API then you can even set it to the highest possible priority (which is zero on an LPC1768) to ensure its timing is not effected at all by anything else that is happening in the system - not even any critical sections that might be in the lwIP code.
Remember that if the USB interrupt is using the [interrupt safe] FreeRTOS API [only API functions that end in 'FromISR' are intended for use in interrupt] then its priority must be at or below that set by configMAXSYSCALLINTERRUPT_PRIORITY: http://www.freertos.org/RTOS-Cortex-M3-M4.html - if you are using a recent version of FreeRTOS then ensuring configASSERT is defined will check this automatically for you at run time http://www.freertos.org/a00110.html#configASSERT
Also make sure, if using the API in the interrupt, that you make use of the pxHigherPriorityTaskWoken parameter to ensure the interrupt returns directly to any unblocked tasks.
Regards.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.