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

Solving an INTERRUPTing puzzle

Posted by ammaree on September 5, 2015

In an application I am developing I have come across a puzzling situation. The background is as follows: Hardware is standard CC3200 LaunchPad Software using CC3200 SDK v1.1.0 and FreeRTOS 8.2.2, Environment using latest Code Composer Studio (CCS) v6.1.0.104

ASSERT is enabled for all my code as well as the SDK driverlib, simplelink and oslib components and tested to trigger everywhere. configASSERT is enabled for FreeRTOS and tested to trigger if I on purpose change (to an invalid value) configMAXSYSCALLINTERRUPT_PRIORITY.

Although the CC3200 is M4 architecture (without FPU) the official SDK ships with an older version of FreeRTOS (8.0.1) and provides a ARMCM3 port as opposed to an ARMCM4 port.

In order to overcome some challenges with the CM3 implementation I adapted the latest official FreeRTOS CCS ARM_CM4F port by simply removing the VFP related code, nothing else.

Originally I only used taskENABLEINTERRUPT() and taskDISABLEINTERRUPT() function and everything worked perfectly

I then decided to change all references to taskENTERCRITICAL() and taskEXITCRITICAL() and that is where the mystery started.....

The application now fails in various places, stages and modes, but always in a way where debugging is impossible, no debug exception handler triggering, no stack trace, nothing.

  • Stack size is not a problem, all tasks have at all times a minimum of 972 to 2848 bytes unused.
  • I have tried module by module to determine if the problem only occurs in s certain function, no luck.
  • If I use tasKENTER/EXIT_CRITICAL() anywhere it crashes.
  • Change all references to taskEN/DISABLE_INTERRUPTS and it runs rock solid.
  • Only xTaskNotifyFromISR and portYIELDFROMISR is used in 1 routine, no other API calls from ISRs

What am I missing since I did not touch any of the related code in the port...

All help appreciated.

Andre


Solving an INTERRUPTing puzzle

Posted by rtel on September 5, 2015

Thanks for proving information on what you have already tried - it would be nice if more people did that.

First - we don't have an official ARMCM3 port for CCS, so originally you are using third party and unsupported code. We do have an official ARMCM4F port for CCS, so guess the code you adapted is from the official code base - altbeit that you have made the ataptions yourself so we can't discount that being a potential source of error.

Although the CC3200 is M4 architecture (without FPU) the official SDK ships with an older version of FreeRTOS (8.0.1) and provides a ARMCM3 port as opposed to an ARMCM4 port.

It is correct to use the ARM_CM3 port if the part does not have an FPU, but as mentioned about, there isn't official for for CM3 and CCS. With the other supported compilers the only difference between the CM3 and CM4F ports is the FPU support.

Originally I only used taskENABLEINTERRUPT() and taskDISABLEINTERRUPT() function and everything worked perfectly

Normally we would advice against using those macros directly, in favour of using the taskENTERCRITICAL() and taskEXITCRITICAL() macros as the latter count the nesting depth...

...and maybe this could be a clue to what your problem is?

When you call taskENABLEINTERRUPTS() interrupts will get fully enabled no matter what. When you call taskEXITCRITICAL() interrupts will only get fully enabled if the critical section nesting count is zero. Although I can't say why that would prevent you from being able to debug - you should be able to debug easily even when in a critical section.

How long does it take for this issue to occur? Does it occurr immediately, or after a while.

.... if it occurs immediately can you inspect the value of uxCriticalNesting in FreeRTOSSourceportableCCSARM_CM4F. To start with, when main() is called, it should be 0xaaaaaaaa. If it is not that value then it is not being initialised correctly. When the first task starts running (on entry to the first task, which could be the timer task created by FreeRTOS itself) it should be 0.

.... if it occurs after some time, is it always after a particual function is called, or after a particular event occurs (interrupt executes, etc.)? If so, could it be something inside one of the libraries is accessing interrupt masks in a way that is not compatible with FreeRTOS? FreeRTOS uses the BASEPRI register, so it is ok for libraries to globally enable/disable interrupts in the processor itself (provided they are enabled again), but there could be problems if a libary leaves BASEPRI in an unexpected state, or enables all interrupts when FreeRTOS expects them to be partially masked.

Regards.


[ 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