Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

Problems using lwIP and USB host together

Posted by cremonese on August 1, 2014

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


Problems using lwIP and USB host together

Posted by rtel on August 1, 2014

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.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists