Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

Interrupt and task synchronization

Posted by Gabriel Rivas on February 20, 2009
Hello, I am new to FreeRTOS. I am using the dsPIC port for experimenting with tasks and interrupts synchronization. I tried first experimenting with low speed events like for example, when a button is pressed unblock the task and stuff.
But what I really want to do is for example synchronize the DCI interrupt that gets samples from an audio codec and then unblock the task to process the input audio sample and then send the output audio sample. It sound pretty easy to do but, I have some doubts regarding to timing configuration, I mean, right now I have the default timing configuration of the port that is:

configTICK_RATE_HZ = 1000
portTIMER_PRESCALE = 8

Does it means that the task timing is 1000/8 = 125 Hz?

But let say if my codec is sampling at 16 KHz which means I need a 16 KHz timing to do the processing, I just have to put let say:

configTICK_RATE_HZ = 16000
portTIMER_PRESCALE = 1

??

Or is any other way to accomplish this kind of task with FreeRTOS?

Thanks,
Gabriel

RE: Interrupt and task synchronization

Posted by Richard Damon on February 20, 2009
I think you misunderstand a few things. First, portTIMER_PRESCALE doesn't affect the interrupt rate, but is used to give the program a hint on how to setup the timer to get the desired interrupt rate. Some other ports of freeRTOS compute that value, but the dsPIC requires you to set the prescaler so it can find a valid value for the timer divider.

Second, you do NOT need the timer running at your sampling rate. The proper solution would have the DCI module generate an interrupt, and unblock the task to consume the data (maybe by posting it to a queue). The RTOS timer is only used to measure timeout intervals and to time slice tasks of equal priority so all that need time can eventually get it.

RE: Interrupt and task synchronization

Posted by Gabriel Rivas on February 20, 2009
Ok I understand now, I will try the blocking-unblocking the task by using a semaphore

RE: Interrupt and task synchronization

Posted by Gabriel Rivas on February 25, 2009
Hey, now I have everything working as I espected, after some hours working with the RTOS I understand it better, thanks.


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner