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

How to make demo work on AVR Atmega128

Posted by voidlizard on October 23, 2008

Greetings,

Did anybody make the FreeRTOS Demo for on Atmega128 ?

I have the following installation:

AVR_ATMega232_WinAVR demo to use
STK500/STK501 board

Linux AVR toolchain: avr-gcc, avrdude, etc.

I have patched the demo to compile for atmega128: some changes to use UART0 in demo's sources, makefile to use proper platform.

So the demo is compiled and programmed OK (but with a strange PORTB LEDs blinking during the programming) and that's all. No LED blinking, no port output.

If I try to make and program minimalistic application which blinks LED inside a cycle with linked FreeRTOS sources - it also does not work - just setup DDRB and PORTB outside the main loop (LEDs works as expexted) and it's does not nothing in main loop (may be something is wrong with delays or so. Although it worked OK without FreeRTOS)

Sorry if it's a silly question, but I kind a noob in embedded programming.

So could anybody point me on a minimal FreeRTOS/Atmega128 GCC example that works?

Thank you for any help,

--
Dmitry




RE: How to make demo work on AVR Atmega128

Posted by maor on February 11, 2009
I'm having the same problem on Atmega644....

RE: How to make demo work on AVR Atmega128

Posted by maor on February 11, 2009
for start, check this topic -" Using the ATmega323 port for ATmega8515" on this forum.
now leds [1:3] blinks but there still a problem (led 5 & 7 doesn't blinks)

RE: How to make demo work on AVR Atmega128

Posted by Mik Lamming on February 23, 2009
I've managed to get the leds to flash on the AT128, but still struggling with the serial port. Has anyone cracked this yet?

RE: How to make demo work on AVR Atmega128

Posted by Mik Lamming on February 24, 2009
I figured out how to port the FreeRTOS demo to the ATMega128. Happy to share if anyone is still wondering how to do it.


RE: How to make demo work on AVR Atmega128

Posted by circlemtn on February 24, 2009
Thanks,
I'm just starting down this road, needing the Atmega128 on Frtos - and would love to know what you've found.

RE: How to make demo work on AVR Atmega128

Posted by Mik Lamming on February 25, 2009
Here's what I did to get the FreeRTOS demo running on my atmega128 system.

The LEDs on my hardware are on port C, so I had to make 4 single-character changes to ParTest.c. They are so obvious that I'll skip them.

I changed my tick speed. Not sure if it matters for the demo. So in FreeRTOSConfig.c:
#define configCPU_CLOCK_HZ( ( unsigned portLONG ) 7372800 )

I think the atmega323 has only one usart, but the atmega128 has two. My hardware uses USART #1. So I made the following file-wide substitutions to usart.c
UCSRB -> UCSR1B
UCSRC -> USSR1C
UBRRL -> UBRR1L
UBRRH -> UBRR1H
UDR -> UDR1
If you use usart#0 then (I think) you can probably change "1" -> "0" in the above, but best check!

To make things a little easier for me to understand, I changed the following constants to reference the constants defined by ATMEL in the header file iom128.h.

/* Constants for writing to UCSR1B.
#define serRX_INT_ENABLE( ( unsigned portCHAR ) (1<<RXCIE1) )
#define serRX_ENABLE( ( unsigned portCHAR ) (1<<RXEN1) )
#define serTX_ENABLE( ( unsigned portCHAR ) (1<<TXEN1) )
#define serTX_INT_ENABLE( ( unsigned portCHAR ) (1<<UDRIE1) ) // Notice that this is NOT the TX interrupt!

/* Constants for writing to UCSR1C. */
#define serUCSRC_SELECT( ( unsigned portCHAR ) (1<<UCSZ00) )// MIK
#define serEIGHT_DATA_BITS( ( unsigned portCHAR ) (1<<UCSZ01) )// MIK


Finally, note that the demo sends out a bunch of characters "A...X" and expects to receive the same chars back on the serial input, and records an error if it doesn't. (I wonder if the test code expects a loop-back link connecting pins 2 and 3? Does the documentation mentions that somewhere?) I connected my USART to my PC and fired up Hyperterminal to see what it did. (Settings: 38400, 8,N and no flow control). I typed "ABC..." and saw one of the leds toggle on/off with each input.

Hope that helps.

//Mik


[ 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