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


[PIC32] DMA + Int + Rtos: advices wanted

Posted by Erupter on February 3, 2012
I have a working application that is getting complicated and I'm thinking about moving it to FreeRTOS.
Now my main concern is that it uses DMA triggered by UartRX INT to move a bunch of bytes to an array which then gets shuffled to an SD via SPI.

What are the problems I may face by leaving this mechanism as it is while integrating the rest of the app in FreeRTOS?
I could set up the buffers as global variables, so that they wouldn't bog any process' stack (I use 4K buffers, so quite big to shuffle around). Would this be sufficient?

I currently use FatFS and it takes about 5 ms to write an entire buffer.
It is pure code flowing, no DMA as I couldn't find a working implementation and I couldn't make my own (if anyone wanted to share one, I would be most appreciating!).
So it must (i think) remain operational for the whole transfer, I don't know what would happen if the process got preempted.

RE: [PIC32] DMA + Int + Rtos: advices wanted

Posted by MEdwards on February 4, 2012
Where are your 4K buffers allocated now? If they are on the stack, then you could leave them on the stack in your FreeRTOS version so long as you create the task with a big enough stack. It would probably be easier to have them as file scope variables though to make sure the stack variable does not vanish when the DMA is still using it.

The mechanism you describe is quite normal I think, and FreeRTOS will work fine with that. The DMA will do its own thing whatever, you just have to consider how the DMA interrupt is handled. How you do that will depend on its time criticality, and which FreeRTOS port you are using.

If you are using SPI to the SD card then getting interrupted should not be a problem. What will be a problem is having two tasks access the SD card at the same time, and in FreeRTOS you can prevent that using a simple mutex.

[ 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