Quality RTOS & Embedded Software

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




Loading

configTICK_RATE_HZ in ATmega16

Posted by Nobody/Anonymous on May 15, 2007
Hello :-)

My name is Jorge Pinto from Portugal. I have FreeRTOS working and I am happy, because I started about 8 months ago looking for a RTOS with just FreeSoftware, and realy like GCC-AVR and FreeRTOS :-)

Well, the problem, I have one test code that flash a LED every some time, but, I would like to change the configTICK_RATE_HZ for a lower value, however, If I change it, It does not have result :-(

My config:
#define configCPU_CLOCK_HZ( ( unsigned portLONG ) 8000000 )

#define configTICK_RATE_HZ( ( portTickType ) 20 ) // 20 instead of original 1000!!

The task the flash the LED:
/*-----------------------------------------------------------*/
/*
#
# Task que vai ligar ou desligar o LED.
#
*/

static void vFlashLED( void *pvParameters )

{



/* The parameters are not used. */

( void ) pvParameters;


portTickType xLastWakeTime;
const portTickType xFreq_ligado = 2000; // 2 segundos
const portTickType xFreq_desligado = 1000; // 1 segundo


/* Cycle for ever. */

for( ;; )

{


// Ligar LED
PortCLatch = PORTC;
PORTC = (PortCLatch | (1 << 0));

// Initialise the xLastWakeTime variable with the current time.
xLastWakeTime = xTaskGetTickCount();
vTaskDelayUntil( &xLastWakeTime, xFreq_ligado );


// Desligar LED
PortCLatch = PORTC;
PORTC = (PortCLatch & (0 << 0));

// Initialise the xLastWakeTime variable with the current time.
xLastWakeTime = xTaskGetTickCount();
vTaskDelayUntil( &xLastWakeTime, xFreq_desligado );

}

}

If I change xFreq_ligado and xFreq_desligado, the flash time alters, but not If I change configTICK_RATE_HZ :-(

---

Another question, I have this macro:

#define #define FlashLED (0); (0);

and If a do: PORTC = (PortCLatch & (0 << (FlashLED) )); I get an error?? Why?? - I am doing this instead: PORTC = (PortCLatch & (0 << 0));

Thanks in advance.

Jorge Pinto
http://www.Casainho.net

RE: configTICK_RATE_HZ in ATmega16

Posted by Richard on May 16, 2007
Take a look at the function prvSetupTimerInterrupt() in port.c for the GCC/AVR port. It might be that the compare match value written to the timer peripheral is overflowing because you are dividing the clock frequency by such a low number (20 instead of 1000). If this is the case then you might need to adjust the timer prescale, or do something similar.

Regards.

SOLVED!! RE: configTICK_RATE_HZ in ATmega16

Posted by Nobody/Anonymous on May 17, 2007
I figured it out :-) After trying change same values on the prvSetupTimerInterrupt(), I did discover the real problem :-) LOL

I work on Linux and I was on this directory: "/media/data/05_assembly/ATMEL/FreeRTOS/Demo/AVR_ATMega323_WinAVR" and I also had this one "/media/data/05_assembly/ATMEL/FreeRTOS/Demo/AVR_ATMega323_WinAVR-copy". I don't know why, but looks like the system was using the "FreeRTOSConfig.h" from directory "AVR_ATMega323_WinAVR-copy" instead of that where I was working "AVR_ATMega323_WinAVR"!!

Now all works ok after delete "AVR_ATMega323_WinAVR-copy" ;-) :-)

Thank you and please continue with this great work - FreeRTOS. I am using and have good experiences so I recommend to all my friends :-)

RE: configTICK_RATE_HZ in ATmega16

Posted by casainho on May 30, 2007
Oh men, I was wrong ;-) :-)

I must do "make clean" after change "FreeRTOSConfig.h" file!! If I don't do "make clean", changes in "FreeRTOSConfig.h" file don't have effect.

---
http://www.Casainho.net


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

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