Quality RTOS & Embedded Software

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




Loading

how fast can a task response to a Que on PIC32?

Posted by shalongbasi on May 4, 2015

I am totally new to Freertos and now writing codes on PIC32MX795F512 running on 80MHz. In my code, A timer triggers an interrupt every 10us and timer ISR writes a dummy data to SPI to read an ADC chip. SPI Rx interrupt is then triggered after data ready and write the ADC data to a Queue. Another task will receive the data from the Queue.

With the help of the oscilloscope, I found that SPI writing is finished in 1.6us, and Que writing is started after 2us after SPI writing finish. Que writing takes about 1.8us. All these added together costs about 5.6us. I having another signal toggling to monitor the begin and end of queue reading, but it is not a stable waveform, looks like switching to Queue Receiving task and reading the queque cannot be finished in the rest 4.4us.

Anyone have the idea about how long normally tasking switching takes under 80MHz PIC32? I want to estimate if it is feasible to finish my application with Freertos. After this, I need to add another 4 channel SPI readings at 10K speed. Maybe it is not a good idea to use Freertos with my application. thanks.


how fast can a task response to a Que on PIC32?

Posted by edwards3 on May 6, 2015

How long does? Sounds like you answered your own question. Sounds like you are doing it the slowest way though, do you need the queue? If the isr is writing and the task is reading and the variable is 32-bits then the task can read it directly with no worry about data consistency. Write the data to a variable then use a task notification to tell the task. Its much faster than a queue. Or send the ADC result to the task directly as the value along with the notification, again must faster. Finally just have the interrupt write the data to a RAM buffer (circular probably). If there is too much disturbance in timing then use a interrupt priority above configMAXSYSCALLINTERRUPT_PRIORITY, but then you cant use the FreeRTOS API. I would not plan to switch tasks at that speed though.


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




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

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

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