configTICK_RATE_HZ in ATmega16

nobody wrote on Tuesday, May 15, 2007:

Hello :slight_smile:

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 :slight_smile:

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 :frowning:

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 :frowning:

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

rtel wrote on Wednesday, 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.

nobody wrote on Thursday, May 17, 2007:

I figured it out :slight_smile: After trying change same values on the prvSetupTimerInterrupt(), I did discover the real problem :slight_smile: 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" :wink: :slight_smile:

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

casainho wrote on Wednesday, May 30, 2007:

Oh men, I was wrong :wink: :slight_smile:

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