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



Posted by PBXNewbie on July 8, 2007
I am trying to integrate the CDC USB sample code and driver provided with the lwIP_Demo_Rowley_ARM7 sample program into the ARM7_AT91SAM7S64_IAR that I have running on an AT91SAM7S-EK development kit.

I replaced the USBSample.c file from the IAR demo with the USB files provided in the Rowley demo. I also changed the USB ISR prototype and function call as follows:

void vUSB_ISR( void ) __attribute__ ((naked));

void vUSB_ISR( void ) {

changed to:

__arm void vUSB_ISR( void );

__arm void vUSB_ISR( void ) {

I also commented out


because the ISR is still called from USB_ISR.s79

and changed:

portEXIT_SWITCHING_ISR( cTaskWokenByPost )


portEND_SWITCHING_ISR( cTaskWokenByPost )

Finally, in vInitUSBInterface() I changed:



I found that the unit did not even register itself properly - the computer recognized that a USB device was plugged in, but did not recognize the device descriptor. After comparing the code from the previously included HID driver, I found that the original ISR code wrote to pxMessage->ucFifoData[] in reverse order, while the new code writes to it in forward order. By changing it back to reverse order and changing the definitions of data indexes for reading the request from the xISRStatus.ucFifoData[] into xUSB_REQUEST back to reverse order, the unit now registers and my computer installs the correct driver when pointed to it. Deregistering and reregistering now seem to work.

My problem now is that when I try and access the virtual COM port that was created using Hyperterm, Hyperterm hangs up. It never connects and sits there waiting for something and finally times out.

I tried reversing the order of the data back to forward order when copying it to pxControlRx.ucBuffer in prvProcessEndPoint0Interrupt() and tried eliminating optimization, but had no change in symptoms.

Using my JTAG debugger, I verified that I am getting calls to prvHandleClassInterfaceRequest() with requests for usbGET_LINE_CODING and usbSET_CONTROL_LINE_STATE.

Can someone verify that the USB source for the lwIP_Demo_Rowley_ARM7 sample program actually does work, as I was surprised that the AT91F_AIC_ConfigureIt() function was called with the first argument missing and would not even compile.
If someone is familiar with the CDC driver sample program, can you please give me some suggestions on what else I would need to look at or why changing the order of data in ucFifoData and xUSB_REQUEST definitions should fix my registration problem?
Finally, if someone is aware of any subtle differences between the IAR compiler and the Rowley compiler that could shed some light on what else I need to be wary of, that would also be helpful.

Thanks in advance for any help someone can give.



Posted by Richard on July 9, 2007
A brief reply as I'm on a dodgy mobile modem -

The Rowley demo definitely does work, but be aware that the CDC driver is not fully USB compliant. I am told it is fine on Windows but not on Linux.

The Rowley code does not use the library directly as there was some problem with the inlining (can't remember exactly what) so some of the library code was copied into the main code, and the first parameter not used as it was hard coded.


[ 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