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

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 ]    [ 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