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


portYIELD() in preemptive mode

Posted by Jeff Smith on October 12, 2005
I'm trying to work out some functions on a board with a port to GCC/HCS12 that is not proven yet. I have been successful with two tasks on different priority, who toggle an LED using vTaskDelay(). I've tested this with either portYIELD() or preemptive mode. It was working after my message
at 2005-08-05 16:35

Now I am apparently stuck on using vApplicationIdleHook(), which may not be execuding, and don't know if I'm using portYIELD() properly.

I use preemptive mode. In a task, priority 1, I have these lines
.while (!(SCISR1 & RDRF))

I think this is supposed to mean that on every kernel tick, it would check for the flag above (because it's the highest priority), and then if not flag it would execute the idle hook for the rest of the tick period. Am I wrong? I don't ever see the output I coded in the idle hook.

RE: portYIELD() in preemptive mode

Posted by Nobody/Anonymous on October 12, 2005
portYIELD() forces a context switch, but if the task calling yield is the highest priority task in the system it will run again immediately as you have not asked it to block, therefore the idle task will never execute. Try using vTaskDelay(1) instead. This will block the calling task until the next tick.

RE: portYIELD() in preemptive mode

Posted by Jeff Smith on October 12, 2005
Yeah, thanks. I guess Yield only has a use in the same-priority group (and cooperative mode).

Someday I hope I can follow this scheduler implementation. Funny, having no background in task swapping, I thought it would be more complex than it is. I'm not the type to rely on school or books, so it has been a challenge getting started.

[ 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