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] [February 2009 Threads] Interrupt and task synchronizationPosted 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 synchronizationPosted 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 synchronizationPosted 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 synchronizationPosted 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.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|