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


AVR32 UC3A0512 + Free RTOS

Posted by Richard Frisch on April 14, 2009
Hi everybody,

I'm using the FreeRTOS port AVR32 UC3A0512 (Atmel EVK1100 Starter Kit)! In my application i two interrupt service routines which manage the RS232 traffic like in the demo application. Everything works fine with no RS232 traffic. With RS232 traffic Free RTOS crashes after an undefined time. Sometimes the Application runs half an hour with a lot of RS232 traffic before RS232 crashes. When a crash occours and i stop the Application in debug mode (Jtag mk II) one of the following execptions is viewed:
"Bus error data fetch" or "Bus error instruction fetch"
Has any one a solution for this problem or can anyone give me a help to isolate the failure!?!

Thanks in advance!

RE: AVR32 UC3A0512 + Free RTOS

Posted by Samuel Tardieu on April 14, 2009
Have you checked the usual suspects? If your interrupt routines use API calls, do they use the "FromISR" versions? And if they do, do you correctly put a critical section around your ISR as directed in http://www.freertos.org/portAVR32.html?

RE: AVR32 UC3A0512 + Free RTOS

Posted by Richard Frisch on April 15, 2009

here is my ISR! It's the same as in the example so i dont't think there is something wrong.

__attribute__((__naked__)) static void xUSART_0_ISR(void)

__attribute__((__naked__)) static void xUSART_1_ISR(void)

__attribute__((__noinline__)) static void xUSART_ISR_NON_NAKED(xusartData *xUsart)

int rx_char;
signed char cchar;
unsigned portLONG ulStatus;
portBASE_TYPE queuestatus;
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;

ulStatus = xUsart->usart->csr & xUsart->usart->imr;

if (ulStatus & AVR32_USART_CSR_RXRDY_MASK)
cchar = xUsart->usart->rhr;
rx_char = (int) cchar;
if ( rx_char )
xQueueSendFromISR( xUsart->hRXQueue, &cchar, ( portTickType ) 5 );
if (ulStatus & AVR32_USART_CSR_TXRDY_MASK)
queuestatus = xQueueReceiveFromISR( xUsart->hTXQueue , &cchar, &xHigherPriorityTaskWoken );
rx_char = (int) cchar;
if (queuestatus == pdTRUE)
xUsart->usart->thr = cchar;
xUsart->usart->idr = AVR32_USART_IDR_TXRDY_MASK;


RE: AVR32 UC3A0512 + Free RTOS

Posted by John Bowker on April 15, 2009
I'm seeing the same problem using ATSAM7x and the Atmel eval kit (256KB part). I'm using FreeRTOS 5.3 and see a prefetch abort error.

I debugged it yesterday and I've been able to catch it sometimes. The crash happens during portRESTORE_CONTEXT. It is on this line:

/* And return - correcting the offset in the LR to obtain the */\
/* correct address. */\
"SUBSPC, LR, #4\n\t"\

The PC is restored incorrectly and then the processor crashes because of bad opcode or data (depending on circumstance). I also notice that r14_irq contains an invalid address (0xe94e7fff) but this may be a derivative problem of the stack crash.

I originally thought it was an issue with using the Queue calls (and, yes, I am using the "FromISR" ones!). But I reduced the UART ISR to just read the byte out of the holding register and exit; the crash still occurs.

RE: AVR32 UC3A0512 + Free RTOS

Posted by John Bowker on April 15, 2009
Clarification - I think my last post suggested I only read in one byte and then it crashes. In fact, it takes several bytes before the crash occurs; exact number seems to be "random".

[ 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