FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [March 2006 Threads] I found a BUG in IAR LPC2129 PORTPosted by Nobody/Anonymous on March 21, 2006 Salam,
in port.c
ulCompareMatch = configCPU_CLOCK_HZ / configTICK_RATE_HZ;
That's wrong cause the clock of the peripherals (include Timer0) is NOT CPU Clock (CCLK) but it's PCLK.
and
PCLK = CCLK / VBP Divider
At reset for LPC2129 VBP Divider = 4
So The above line must be
ulCompareMatch = (configCPU_CLOCK_HZ /4 ) / configTICK_RATE_HZ;
I found this bug when i was trying to blink a led every second using vTaskDelayUntil
Here is my working code.
static void vTaskCode(void *pvParameters) { portTickType xLastWakeTime; const portTickType xFrequency = 1000; xLastWakeTime = xTaskGetTickCount();
for (;;) { Led_Toggle(); vTaskDelayUntil( &xLastWakeTime, xFrequency ); } }
Bye Eng. Amr Ahmed EGYPT
RE: I found a BUG in IAR LPC2129 PORTPosted by Nobody/Anonymous on March 21, 2006 I forgot to mention that configTICK_RATE_HZ must be configure to 1000 in freeRTOSconfig.h to use the above task to blink the led every 1 SEC :-)
Enjoy Amr Ahmed EGYPT
RE: I found a BUG in IAR LPC2129 PORTPosted by Nobody/Anonymous on March 21, 2006 I think, as downloaded, the line should actually be:
ulCompareMatch = ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) - 1;
cpu clock being defined to the correect value for the equation.
You change the value or use different hardware?
RE: I found a BUG in IAR LPC2129 PORTPosted by Nobody/Anonymous on March 21, 2006 AS DOWNLOADED THE LINE IS
/* Calculate the match value required for our wanted tick rate. */ ulCompareMatch = configCPU_CLOCK_HZ / configTICK_RATE_HZ;
THAT IS NOT RIGHTTTTTTTTTTTT
RE: I found a BUG in IAR LPC2129 PORTPosted by Nobody/Anonymous on March 21, 2006 AS DOWNLOADED
ulCompareMatch = configCPU_CLOCK_HZ / configTICK_RATE_HZ;
This is not right !!!
I use Olimex board (LPC2129)
So configCPU_CLOCK_HZ = 14745600 (crystal value)
I didn't use the PLL.
#define configCPU_CLOCK_HZ( ( unsigned portLONG ) 14745600 )
BYE
RE: I found a BUG in IAR LPC2129 PORTPosted by Nobody/Anonymous on March 21, 2006 It is right if you are using the same software and hardware as the demo with no modifications at all. I know because I can time the LED's flashing and they are exactly correct.
I think you are making an assumption as to what configCPU_CLOCK_HZ means. This should be set to the frequency as used by the timer which may but probably will not be the same as some other clocks on the system.
RE: I found a BUG in IAR LPC2129 PORTPosted by Nobody/Anonymous on March 21, 2006 That's right man.
configCPU_CLOCK_HZ must be the clock of the Timer.
So configCPU_CLOCK_HZ must be
configCPU_CLOCK_HZ = configCPU_CLOCK_HZ / VBP Divider
Please look to the datasheet
Bye AmR Ahmed EGYPT
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|