Quality RTOS & Embedded Software

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


Loading

PIC32 lower configTICK_RATE_HZ -> LCD problem

Posted by Ralf Anders on January 23, 2009
Hi,

I start a new thread, because I think, my final question in a former thread got overlooked.

I wanted to lower the "academic value" of configTICK_RATE_HZ=1000.
But I got problems with the LCD-Display (via xLCDQueue).

Scenario to quickly reproduce some of the problems:
- Take the PIC32-Demo
- Remove the Blocktime-Task from project (3 locations in main.c)
- set configTICK_RATE_HZ (in FreeRTOSConfig.h) to a lower value !

Samples:
1. configTICK_RATE_HZ = 50
- the LCD is updated every second (like in error cases), but with "Pass 1", "Pass2", ...
- the LCD line-switch does not work properly
(If the BlockTime-Task was not removed, their supervising fires errors)

2. configTICK_RATE_HZ = 20
- "Error: Int queue" is shown permanent
- but sometimes (very rarely) the "E" is missuing and You see "rror: Int queue"
- the LCD line-switch does not work properly

Is there a knwon reason?
ralf

RE: PIC32 lower configTICK_RATE_HZ -> LCD pro

Posted by Richard on January 23, 2009
> 1. configTICK_RATE_HZ = 50
> - the LCD is updated every second (like in error cases), but
> with "Pass 1", "Pass2", ...


The delay periods are defined at the top of the file using:

#define mainNO_ERROR_PERIOD( 3000 / portTICK_RATE_MS )
#define mainERROR_PERIOD ( 500 )

The second definition should really be:
#define mainERROR_PERIOD ( 500 / portTICK_RATE_MS )



With a tick of 1KHz portTICK_RATE_MS is 1000 / 1000 = 1.
With a tick rate of 50Hz portTICK_RATE_MS is 1000 / 50 = 20.


> - the LCD line-switch does not work properly (If the
> BlockTime-Task was not removed, their supervising fires errors)


The block time task takes various measurements and flags an error if it finds these to be outside of what it considers to be an acceptable threshold. Changing the tick frequency will change what the thresholds are so it is not unexpected for the block time task to complain. It is nothing to worry about.


The timer is setup to generate the tick interrupt using:

const unsigned portLONG ulCompareMatch = ( (configPERIPHERAL_CLOCK_HZ / portTIMER_PRESCALE) / configTICK_RATE_HZ ) - 1;

With a tick rate of 1000 ulCompareMatch will be 4999.
With a tick rate of 50 ulCompareMatch will be 99999 - which is greater than a 16bit value hence the timing error you are seeing. To use such a low value you will have to change the portTIMER_PRESCALE setting (it is 8 by default).

> 2. configTICK_RATE_HZ = 20
> - "Error: Int queue" is shown permanent

No surprising as per my previous comment regarding the block time task.


> - but sometimes (very rarely) the "E" is missuing and You see
> "rror: Int queue"
> - the LCD line-switch does not work properly


I would guess just timing problems when writing to the LCD.

#define lcdSHORT_DELAY( 4 / portTICK_RATE_MS )
#define lcdLONG_DELAY( 15 / portTICK_RATE_MS )

Are both going to eval to 0 with such a large portTICK_RATE_MS value.

Regards.

RE: PIC32 lower configTICK_RATE_HZ -> LCD pro

Posted by Ralf Anders on January 23, 2009
Thanks Richard,

I think I'll go deeper into the sources to solve my problems and I hope, You gave me the right keywords...

Generally I plan a project, where the MCU should sleep nearly all the time. It should be waked up by
some external events like UART-Rcv, Input-Capure only by interrupt. A minimal power consumption is
important. A wake-up by timer-interrupt is intended in "very large intervalls" (0.1 s to 10 min). It is for
some idle operations, reading some analogue values (pressure, temeperature, ...).

May be, Your demonstration program is not the optimal startpoint for this kind of application?
On the other side this could be a good test for the behavior in situations, that You have not tested yet.

regards, ralf


[ 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