Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


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 ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

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

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

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner