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

ATMega323 port for ATMega16L

Posted by Nobody/Anonymous on May 26, 2005
Hi I use a STK500 board with ATMega16L processor. I have tried the demo program with this microcontroller but nothing works. It feels like the processor is not switched on at all. (I mjean no visual indication on leds connected to portb or activity on the serial port.)

I know the processor is fine as my program using the serial port works fine. I have changed the value of configTOTAL_HEAP_SIZE from 1500 to 800 to accomodate for the 1kByte of SRAM in the mega16. Are there any other changes i need to make? I am running the processor at 8MHz.

RE: ATMega323 port for ATMega16L

Posted by Nobody/Anonymous on May 26, 2005
The demo application uses all the heap - so if you have reduced the heap size it is likely that the scheduler is running out of memory and not starting.

Try reducing the number of tasks that are created - in FreeRTOS/Demo/AVR_ATMega323_WinAVR/main.c comment out the lines:

vStartIntegerMathsTasks()
vAltStartComTestTasks()
vStartPolledQueueTasks()
xTaskCreate( vErrorChecks, ...

This should just leave the LED flash tasks so you can see if anything is running.

RE: ATMega323 port for ATMega16L

Posted by Nobody/Anonymous on May 26, 2005
Thanks it works now! :-) But i am surprised at the number of tasks that can run in parallel with 1KByte of RAM!

Next i plan to use the ATmega128 with 4KBytes of RAM. How many tasks can i run in parallel assuming default default default stack size and Global variables not exceeding 200 bytes?

RE: ATMega323 port for ATMega16L

Posted by Richard on May 26, 2005
Take a look at this page:

http://www.freertos.org/FAQMem.html#RAMUse

it should give you a good idea of the requirements. The numbers actually come from the AVR port, but prior to the V3.0.0 release. V3.0.0 uses a bit less RAM but only very slightly.

Regards.

RE: ATMega323 port for ATMega16L

Posted by Nobody/Anonymous on May 26, 2005
Also... I would like to know if anyone has ever overclocked these processors (the mega128)? What are the effects of doing so?

RE: ATMega323 port for ATMega16L

Posted by Nobody/Anonymous on May 26, 2005
That sounds fun :-)

I have on occassion overclocked various devices and bus systems and normally it still works. This is of coarse using the device out of specification so would not be a good idea for a commercial product.

RE: ATMega323 port for ATMega16L

Posted by Nobody/Anonymous on May 27, 2005
My current setup is like this...

portSHORT main( void )
{
//prvIncrementResetCount();

/* Setup the LED's for output. */
vParTestInitialise();

//vStartIntegerMathTasks( tskIDLE_PRIORITY );
//vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
vStartLEDFlashTasks( mainLED_TASK_PRIORITY );
//vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );

//xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );

/* In this port, to use preemptive scheduler define configUSE_PREEMPTION
as 1 in portmacro.h. To use the cooperative scheduler define
configUSE_PREEMPTION as 0. */
vTaskStartScheduler();

return 0;
}

flash.c has the declaration
#define ledNUMBER_OF_LEDS( 3 )

While reducing this number is ok, increasing it to even 4 stalls the microcontroller. With this number 3 and my current main config, how many threads are running in parallel?

My guess is it is 3 for the flasing leds and 1 for the idle task. I have set the heap size to 750.

RE: ATMega323 port for ATMega16L

Posted by Nobody/Anonymous on May 27, 2005
Yes - 4 tasks will be running. Can you run your code in the AVR Studio simulator? If so then step into the vTaskStartScheduler() function and see what happens. When the idle task is created you will be able to see how much RAM is left. Alternatively try filling the entire heap with a known value - then you will also be able to see in the simulator how much is left.

RE: ATMega323 port for ATMega16L

Posted by Nobody/Anonymous on May 27, 2005
Try uncommenting the vStartIntegerMathTasks line. This will start just 1 extra "known good" task.

RE: ATMega323 port for ATMega16L

Posted by Nobody/Anonymous on May 28, 2005
I do not have access to avr studio as i work on linux. AFAIK the flash led task does not use any additional memory consuming functions yet teh device fails to add any more than 3.

I have tried uncommenting the vStartIntegerMathTasks task but the system does not work unless i reduce the number of led flash tasks from 3 to 1. Even reducing it to 2 does not help.

RE: ATMega323 port for ATMega16L

Posted by Richard on May 29, 2005
I have tried running the project in the simulator with:

+ Stack set to 700
+ Integer math tasks
+ 3 flash tasks
+ no optimisation

and find that everything executes with no problem - and that following the creation of all the tasks (including the idle task) there are 95 bytes of stack remaining. At least enough to create another task.

Have you remembered to change the line:

MCU = atmega323

in the makefile to the correct CPU being used? Maybe there is a linker problem.

Regards.

RE: ATMega323 port for ATMega16L

Posted by Nobody/Anonymous on May 29, 2005
Yes i have. The changes i have made from the demo downloaded to my setup include making

MCU = atmega16

in the makefile and,

#define configTOTAL_HEAP_SIZE( (size_t ) ( 750 ) )

in FreeRTOSConfig.h

I am using the avr tool chain on debian linux, downloaded from the debian repositories.

RE: ATMega323 port for ATMega16L

Posted by Richard on May 29, 2005
I just remembered that I had an ATMega16 lying around so gave it a go.

Having made the two changes (heap size and processor definition) I find that the program still runs with no problems, even with vStartIntegerMathTasks() uncommented.

To try and get it to go wrong I have tried full optimisation, no optimisation, with debug info and without debug info. It is happy with all these configurations.

Which version of GCC do your Linux tools use? WinAVR currently uses V3.4.3. I have used older versions also though.

Other than commenting out some of the tasks, the cpu definition and the heap size definition - have you changed any thing else?

RE: ATMega323 port for ATMega16L

Posted by Nobody/Anonymous on May 29, 2005
Now that you have mentioned, i decided unpack my downloaded FreeRTOS again check and these are the changes i made.

In FreeRTOS.h
changed ProjDefs.h to projdefs.h

In FreeRTOSConfig.h made heap size 750

In the makefile made MCU = atmega16 and setup avrdude
AVRDUDE_PROGRAMMER = stk500v2
AVRDUDE_PORT = /dev/ttyS0

These are all the changes i made. Compiled and flashed the micro and it does not execute.

I am using avr-gcc v3.4.3 and avr-libc v1.2.3


[ 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