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] [January 2014 Threads]
Hi,
I'm using the freertos-demo for stellaris launchpad lm4f and I'm trying to activate a task when an interrupt occurs.
I've been testing it on two different scenarios; when I press the left button the xSemaphoreGiveFromISR works and also the task responds but when I use this in the interrupthandler (GPIOPortDIntHandler) then xSemaphoreGiveFromISR works but the task isn't responding and the system freezes after the amount of counts has reached its max? Could it be that the interrupts are coming too fast? I already set the xSemaphore to a counting semaphore..
I'm also using xSemaphoreTake because the xSemaphoreTakeFromISR is not available in this version.
Here is the code:
define DHTTASKSTACKSIZE 128
define DHTINTTASKSTACKSIZE 128
extern xQueueHandle gpLEDQueue;
extern xSemaphoreHandle gpUARTSemaphore;
extern xSemaphoreHandle xCountingSemaphore;
static
void DHT_Task(void *pvParameters){
unsigned char cMessage;
portTickType ulWakeTime;
unsigned long ulLEDToggleDelay;
ulLEDToggleDelay = 250;
ulWakeTime = xTaskGetTickCount();
while(1)
{
if(xQueueReceive(g_pLEDQueue, &cMessage, 0) == pdPASS)
{
if(cMessage == LEFT_BUTTON)
{
xSemaphoreGiveFromISR(xCountingSemaphore, NULL);
}
}
vTaskDelayUntil(&ulWakeTime, (ulLEDToggleDelay) / portTICK_RATE_MS);
}
}
void GPIOPortDIntHandler(void){
if(xSemaphoreGiveFromISR(xCountingSemaphore, NULL)){
UARTprintf("|");
}
}
void DHTIntHandler(void *pvParameters){
while(1){
if(xSemaphoreTake(xCountingSemaphore, portMAXDELAY)){
UARTprintf(".");
}
}
}
//DHT Task Initialisation
unsigned long
DHTTaskInit(void)
{
if(xTaskCreate(DHTTask, (signed portCHAR *)"DHT", DHTTASKSTACKSIZE, NULL, tskIDLEPRIORITY + PRIORITYDHTTASK, NULL) != pdTRUE)
{
return(1);
}
if(xTaskCreate(DHT_IntHandler,(signed portCHAR *)"DHT_INT", DHTINTTASKSTACKSIZE, NULL, tskIDLE_PRIORITY + PRIORITY_DHT_INT_TASK, NULL) != pdTRUE){return(1);};
//
// Success.
//
return(0);
}
With kind regards,
Bart
freertos-demo for stellaris launchpad lm4f
I'm not familiar with that demo - is it something TI distribute, or did you make it yourself.
Could it be that the interrupts are coming too fast?
From a button push? I don't understand the scenario as I don't know the demo.
I'm also using xSemaphoreTake because the xSemaphoreTakeFromISR is not available in this version.
Really? You must be using an old version. If you are inside an ISR then definitely don't use xSemaphoreTake().
It might be that looking through the help sub-page of the FAQ will highlight something to you - but as you are using an old version of FreeRTOS most of the newer features put in to catch interrupt misconfigurations on Cortex-M chips won't be available to you.
Regards.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.