Quality RTOS & Embedded Software

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


FreeRTOS Critical Section issue on OR1200

Posted by avamsi on July 19, 2012
We are running freeRTOSV6.1.1 on Openrisc1200. There is a problem with the critical section execution. Actually, we created three tasks with same prority(same time slice). In the task functionality, we called some print functions that internally calls portENTERCRITICAL & portEXITCRITICAL to protect the data to send on uart(console prints). The tasks executed for some time(printed the text on console). Later only one task is running fine. We are unable to find the control of the other tasks(even did not hit break point). Some times that task is also not running, control jumping to unknown location.With out this critical section part in the tasks, we are sure that tasks are running fine all the time. The same issue raised in the ISR execution also. When ever we used this critical section part, control did not return form ISR to task. Can some one explain how to make use of this critical sections with out effecting the task.


RE: FreeRTOS Critical Section issue on OR1200

Posted by Richard on July 19, 2012
I have absolutely no idea about the OpenRISC architecture, or the port you are using, so I'm afraid I cannot give an authoritative answer, but from experience check to ensure your print functions are not themselves manipulating the interrupt state through any means other than calls to taskENTER_CRITICAL() and taskEXIT_CRITICAL() - assuming your implementation of these functions takes care of critical section nesting, any other interrupt manipulation will break the nesting count.

You can also consider using a simple mutex() to access the print function, ensuring the buffers a flushed before the mutex is returned, or using scheduler locking (vTaskSuspendAll() and xTaskResumeAll()) in place of a critical section.


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

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

Latest News

FreeRTOS v10.2.0 is available for immediate download. MIT licensed, and including RISC-V and ARMv8-M (Cortex-M33) demos.

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Cadence Tensilica Cortes

Espressif ESP32

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

Xilinx Microblaze and Zynq partner