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

IRQs being disabled

Posted by Geoffrey McRae on July 19, 2010
I am having a problem with a STM32 and USART ISRs with the queue API. From what I understand, I should be able to fill a queue till it blocks by specifying portDELAY_MAX and having INCLUDE_vTaskDelay defined to 1.

What is occuring is it works fine for the first 5-6 or so iterations, when it then enters an infinite loop in list.c on line 150.

I read the commented warning, I have increased stack size heaps to be sure its not an overflow, and set my NVIC priority group to 4. The NVIC IRQ handler preemption priority is set to configLIBRARY_KERNEL_INTERRUPT_PRIORITY which is defined as 15.

Here is the code that I am using:
http://www.spacevs.com/usart.c

I have been desperately stuck on this problem for the last week and I am sure its a face palm type error.... If someone can please look at it and tell me where I have gone wrong it would be GREATLY appreciated.

Thanks in advance

RE: IRQs being disabled

Posted by Geoffrey McRae on July 19, 2010
Oh, and ill add that when it gets into the infinite loop, my breakpoint on the systick hook no longer fires indicating that interrupts have been left disabled....

RE: IRQs being disabled

Posted by Dave on July 19, 2010
“ortDELAY_MAX and having INCLUDE_vTaskDelay defined to 1”


portMAX_DELAY will be an indefinite block time if INCLUDE_vTaskSuspend is set to 1, not INCLUDE_vTaskDelay.

“and set my NVIC priority group to 4”


I think the examples just leave that at 0.


“Oh, and ill add that when it gets into the infinite loop, my breakpoint on the systick hook no longer fires indicating that interrupts have been left disabled....”


Not necessarily. To know if interrupts were disabled or not check the relevant status bits. If a low priority interrupt is not firing then maybe you are just looping in a higher priority interrupt.

RE: IRQs being disabled

Posted by Richard Damon on July 19, 2010
One thing that looks suspicious to me is this code in usart_read


portENTER_CRITICAL();
while(USART_GetFlagStatus(h->port, USART_FLAG_RXNE) == RESET)
return USART_ERR_NODATA;

*byte = USART_ReceiveData(h->port) & 0x7F;
portEXIT_CRITICAL();
return USART_ERR_OK;


If the condition of the while loop is true, then the function immediately exits with an error return code, leaving you in a critical section (and the while loop will NEVER repeat, because it exits with a return).

RE: IRQs being disabled

Posted by Geoffrey McRae on July 19, 2010
Sorry, yes, I ment INCLUDE_vTaskSuspend, it is defined.

Nope, the examples all set it to group_4.

Further investigation shows that portNVIC_PENDSVSET is being set, but setting a breakpoint on the IRQ handler never triggers once the application gets stuck in its loop. I think I have narrowed it down...

My application starts an init task which sets up IRQ's and then creates the other tasks, which once done, it then calls vTaskDelete(NULL). According to docs this should be safe, could this be the issue?

RE: IRQs being disabled

Posted by Geoffrey McRae on July 19, 2010
@richard_damon: That is an issue, thanks for the heads up, however the USART_MODE_IRQ flag is set in my test app with the issue, so that code is not actually running.

RE: IRQs being disabled

Posted by Geoffrey McRae on July 19, 2010
Found the problem, and yes it was a facepalm one.... had an extra taskEXIT_CRITICAL in a function that never called ENTER... caused all sorts of weirdness


[ 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