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?
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)
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!
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.