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] [August 2010 Threads] Problem using a minary semaphorePosted by barber colman on August 18, 2010 I have a serial communications task and a display task. The serial task creates a binary semaphore at task initialization vSemaphoreCreateBinary( xPacketReceivedSemaphore ); The receive interrupt gives the semaphore after a packet is received. xSemaphoreGiveFromISR( xPacketReceivedSemaphore, &xHigherPriorityTaskWoken ); The serial task sends a new request for a packet of data after receiving a packet or one second without receiving a packet if( xSemaphoreTake( xPacketReceivedSemaphore, (1000 / portTICK_RATE_MS) ) == pdTRUE ){ This process works well as long as communications is started before the display task starts. If the display task before the first packet is received the serial task get to the xSemaphoretake and never returns.
Any idea what is happening? This processor is not starved. the vApplicationIdleHook is being called. I am using freeRtos 6.03 and a PIC32MX.
RE: Problem using a minary semaphorePosted by Richard Damon on August 18, 2010 The first question is what does the display task have anything to do with the serial operation?
Second, the take you have shown will return after the second (unless you have corrupted something or the time has stopped). If a packet isn't sent and the semaphore raised, it will return pdFALSE and not go into the statements controlled by the if, so that clause should only process the previous packet, and after the if, should be the statement to request the next one..
RE: Problem using a minary semaphorePosted by barber colman on August 19, 2010 It is a very good question. It should not, but it does.
When it works a new packet is sent as soon as the last packet is returned. If a packet is not responded to a new packet will be sent after the 1 second delay.
This does work but only when a packet has been sent and responded to before the graphics task has started. It does not make sense to me. I think my next step is to look in task.c and see why the communications task is not running.
Thanks
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|