Quality RTOS & Embedded Software

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


Loading

I found a BUG in IAR LPC2129 PORT

Posted 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 PORT

Posted 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 PORT

Posted 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 PORT

Posted 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 PORT

Posted 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 PORT

Posted 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 PORT

Posted 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


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


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

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

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

Xilinx Microblaze and Zynq partner