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

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 ]    [ 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