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




Loading

Interrupts on Stellaris Launchpad LM4F

Posted by bremans on January 22, 2014

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


Interrupts on Stellaris Launchpad LM4F

Posted by rtel on January 22, 2014

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.


[ 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