FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [July 2010 Threads] TaskYIELD in critical section Posted by Joseph Dupre on July 13, 2010 Is it appropriate/allowed to call taskYIELD() in a critical section??? I am attempting to have a UART send a break signal for a time period less than the tick frequency if possible. portENTER_CRITICAL(); U2LCR |= serBREAK;
timestamp = timer3GetValue(); while (timer3GetValue() - timestamp < 500) { taskYIELD(); }
U2LCR &= ~serBREAK; portEXIT_CRITICAL(); If this code is bogus, is there a way to have my break sent for a period less than the tick frequency without halting everything for the duration?
RE: TaskYIELD in critical section Posted by Richard Damon on July 14, 2010 I am not sure if it will work on all ports, but it will (sort of) on many. Where it works, the YIELD effectively ends the critical section until that task restarts (so it might not be doing what you want). A few comments though, only tasks of the same priority will be able to get time from the YIELD, lower priority tasks will stay blocked. Also, if there are other tasks on this level that are ready, this task won't get restarted from the YIELD until all of them YIELD themselves from either an explicit YIELD, blocking for something, or running when a timer tick expires, do it may well be longer than a timer tick before it get restarted.
A second comment, is that your probably don't really need a critical section, you may just need to disable that serial ports interrupt and set a flag for the transmit routine to not try to send during the break.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|