Quality RTOS & Embedded Software

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


Loading

Non Blocking Task wont Give CPU To a Periodic

Posted by Muhammed on May 10, 2013
I am Currently Evaluating The FreeRTOS Kernel on an LPCXpresso LPC1114 EVB , Created two tasks ,
a non blocking one using the small printf lib to print out some string and the other is a periodic Task using the vTaskDelayUntil(&xTimeUpdate, (500/portTICK_RATE_MS)) API to have a sharp 500ms Delay , with a priority higher than the non-Blocking one , the Result is having the Periodic Task Executing Once and Leaving THE CPU for the non-Blocking Task forever ,this problem also occurs when using the vTaskDelay() API , I know that this problem may seem silly but im really stuck Please Help !!

RE: Non Blocking Task wont Give CPU To a Periodic

Posted by Richard Damon on May 11, 2013
The two most likely causes are
1) You have preemption turned off, thus the "non-blocking" task will never give up the processor unless you add a yield to the loop.

2) Your timer tick interrupt isn't working for some reason.

You can check the first by adding the yield.
The second by seeing if the tick counter is increasing.

RE: Non Blocking Task wont Give CPU To a Periodic

Posted by Muhammed on May 11, 2013
- Preemtion is turned on , and working with Blocking Tasks Normally
- xTickCount does increment during Runtime , but increments slowly , it Should Reach 1000 Tick within 1 Second But That Does Not Happen

Any Advice?

RE: Non Blocking Task wont Give CPU To a Periodic

Posted by Richard on May 11, 2013
“Any Advice?”


Start by ensuring the tick interrupt is executing at the expected frequency before adding in any additional functionality. You could leave your code as it is, and add in a tick hook function function that just toggles an IO port. Check the frequency at which the IO port toggles matches that expected according to your configTICK_RATE_HZ and configCPU_CLOCK_HZ settings in FreeRTOSConfig.h. Once you have the frequency correct you can then return to look at what your application is actually doing.

Regards.

RE: Non Blocking Task wont Give CPU To a Periodic

Posted by Muhammed on May 11, 2013
- Downloaded NXPs FreeRTOS Example ,
- Experimented the xTickCount Found it incrementing by 1000 Persecond with a CLK Frequency 48000000
- Changed the Tick Frequency found Everything Going fine With Port 0 Pin 7 Led Toggling Frequency
- Switched Off Tick Hook Function , usedThe HeartBeating Task WITH NO BLOCKING And Made Another Led Toggling Task With A Higher Priority and a (configTICK_RATE_HZ / 2 ) Delay

Result is : xTickCount Increments 1 every Second , Higher Priority Task Runs Once and the HeartBeat Task Running Forever Not Giving UP CPU

RE: Non Blocking Task wont Give CPU To a Periodic

Posted by Muhammed on May 11, 2013
using the NXP Example removed all tasks and left the HeartBeat Task and removed the vTaskDelay Blocking function to see the Task Behavior when being continuous , Found That the xTickCount Drops down its rate per second without touching the configuration file .

RE: Non Blocking Task wont Give CPU To a Periodic

Posted by Dave on May 11, 2013
Is the peripheral used to generate the tick (or the configuration of the timer used to feed the peripheral that generates the tick) configured before the scheduler is started or by one of the tasks? If it is configured by one of the tasks then removing the task will stop the hardware being configured.

Can you remove the tasks one at a time to determine when the tick configuration changes.

RE: Non Blocking Task wont Give CPU To a Periodic

Posted by Muhammed on May 11, 2013
The Peripheral Generating the Tick is a core peripheral (SysTick) common in Cortex-M Microcontrollers , and its configuration is standardized through CMSIS wich is used by FreeRTOS , the configuration API SysTick_Config( ) could be found in the xPortStartSchedular( ) API in the M0 Port , and its Arguments are configCPU_CLOCK_HZ and configTICK_RATE_HZ , not configured in one of the Tasks

RE: Non Blocking Task wont Give CPU To a Periodic

Posted by Muhammed on May 11, 2013
*Arguments are (configCPU_CLOCK_HZ / configTICK_RATE_HZ)

RE: Non Blocking Task wont Give CPU To a Periodic

Posted by Richard on May 12, 2013
If all the hardware setup is done before the scheduler is started then I'm afraid I have no explanation why the hardware setup would differ after the scheduler has started just because you didn't create the same tasks.

Are you using the NXP version of the M0 port or the FreeRTOS version (the one in the FreeRTOS download)?

Regards.

RE: Non Blocking Task wont Give CPU To a Periodic

Posted by Muhammed on May 13, 2013
Im Using NXP's Version

RE: Non Blocking Task wont Give CPU To a Periodic

Posted by Muhammed on May 15, 2013
I have Lately realized that the version of NXP Port and Example i am using is buggy , Will be trying an updated one , Thank you very Much Richard Barry for your support and Excellent RTOS Thank you Richard Damon and DaveDors


[ 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