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


xQueueTakeMutexRecursive not supported from an ISR

Posted by jon-gordon on October 13, 2016

Using Tracealyzer for FreeRTOS, I'm trying to call a vTracePrintF from inside an ISR. The code works fine for non-ISR and I see my event printed but inside the ISR, I end up with an assert failure because in xQueueTakeMutexRecursive, there is a call to xQueueGenericReceive without checking whether the "fromISR" alternative should be called instead. Is this an oversight or am I missing something?

Cheers, Jon

xQueueTakeMutexRecursive not supported from an ISR

Posted by edwards3 on October 13, 2016

The trace recorder is source code so you can edit the code to check if you are in an interrupt, but also check if vTracePrintF is ok to call from an interrupt. You would not normally want to call the library printf() from there because its slow, stack heavy and not reentrant.

xQueueTakeMutexRecursive not supported from an ISR

Posted by richard_damon on October 13, 2016

Generally it doesn't make sense to use a mutex in an ISR, as the ISR has no way to 'wait' for the shared resource to become available.

As MEdwards said, 'printing' something in a ISR is almost certainly a bad idea,

xQueueTakeMutexRecursive not supported from an ISR

Posted by jon-gordon on October 17, 2016

I had figured it was using its own derived version of a printf routine but alas, no, it uses my compiler's version which attempts to be thread safe by using a mutex - hence the problem.

I'll stick to SEGGER's RTT for printing in an ISR then. Would just have been nice to have the interrupt behaviour observed in Tracealyzer but I must be missing something else there.

[ 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