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

Problem with USB driver and FreeRTOS

Posted by Paul Coleman on March 6, 2012
II'm developing an app for the Atmel UC3C1512 using their AVR Studio 5 development environment and also their software framework (ver 2.5.1-17860.53) and I have an interaction problem between their USB stack and the FreeRTOS scheduler.

Basically, the problem is that when I enable the scheduler the USB starts sending out spurious characters anywhere between 1 and 15 seconds apart. If I don't enable the scheduler it works as expected. It makes no difference whether I create a task for the sceduler to run it still does it and I'm not using any other features of FreeRTOS i.e. I'm not creating any message queues or semaphores etc.

This is my test code...

#include
#include
#include
#include

void USBRxNotifyCallback(void)
{
int charIn;

while(udi_cdc_is_rx_ready())
{
charIn = udi_cdc_getc();
udi_cdc_putc(charIn);
}
}

bool USBEnabledCallback(void)
{
return true;
}

void USBVbusCallback(bool b_vbus_high)
{
if (b_vbus_high)
{
udc_attach();
}
else
{
udc_detach();
}
}


int main(void)
{
pcl_switch_to_osc(PCL_OSC0, FOSC0, OSC0_STARTUP);

udc_start();

if (!udc_include_vbus_monitoring())
{
udc_attach();
}

// !!! with the following line enabled the USB will send spurious characters out !!!
vTaskStartScheduler();

for(;;);
}


Has anybody else experienced problems with the USB at all?

Thanks, Paul.

RE: Problem with USB driver and FreeRTOS

Posted by Richard on March 6, 2012
I know nothing about this driver - but how does it interface to the hardware? Is it using any interrupts or system calls other than the single USB peripheral interrupt?

Have you tried initialising the peripheral after the scheduler has started? Take care not to start the device with the scheduler in an inconsistent state.

Regards.

RE: Problem with USB driver and FreeRTOS

Posted by Paul Coleman on March 6, 2012
Thanks for the reply.

I can't answer the question off the top of my head as it's a large framework written by Atmel that I have very little knowledge about.

I had tried initialising the USB after the scheduler has started but it made no difference. I'd trimmed the app down to try and eliminate things and that was what I ended up with.

I will continue to investigate but I just wanted to see if anybody else had had similar issues.

Regards, Paul.


[ 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