Quality RTOS & Embedded Software

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


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