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

Port to TI CC2538

Posted by peretuset on June 15, 2014

Hello all,

I am about to finish porting FreeRTOS v8.0.1 to the Texas Instruments CC2538 SoC (Cortex M3 + 802.15.4 radio) for an IoT platform named OpenMote (http://www.openmote.com/). The basics are already working just fine (I have a demo with tasks and semaphores using SysTicks), but I am stuck trying to get tickless support to work. I developed my own vPortSetupTimerInterrupt, vPortSuppressTicksAndSleep and SleepTimerHandler functions based on those of the Atmel SAM examples but replacing the ASF functions from the Atmel library with those of the Texas Instruments library (which by the way is not as great since it does no comply to CMSIS). I have also installed the SleepTimerHandler to the interrupt table.

If I try my RTC code outside of FreeRTOS it works just fine, the uC goes to low-power mode until the RTC expires and the process is repatead on and on without problems. However, when I integrate it with FreeRTOS it stops working. It looks like the interrupt is fired the first time but does not continue to fire any more. The FreeRTOSConfig.h looks like the following:

define configCPUCLOCKHZ 16000000
define configSYSTICKCLOCKHZ 32768
define configUSETICKLESSIDLE 1
define configTICKRATEHZ ( ( TickType_t ) 128 )
ifdef _NVICPRIO_BITS
 #define configPRIO_BITS               __NVIC_PRIO_BITS
else
 #define configPRIO_BITS               4        /* 15 priority 

levels */

endif
define configLIBRARYLOWESTINTERRUPT_PRIORITY 0x0F
define configLIBRARYMAXSYSCALLINTERRUPTPRIORITY 10
define configKERNELINTERRUPTPRIORITY (

configLIBRARYLOWESTINTERRUPTPRIORITY << (8 - configPRIOBITS) )

define configMAXSYSCALLINTERRUPT_PRIORITY (

configLIBRARYMAXSYSCALLINTERRUPTPRIORITY << (8 - configPRIO_BITS) )

If I disable the configUSETICKLESSIDLE and configure the appropriate values for the clocks then the demo works just fine, so I asume the vector table and the interrupt priorities are fine.

Any other ideas where I could look at?

Regards,

Pere


Port to TI CC2538

Posted by rtel on June 15, 2014

Are you using a critical section inside your SuppressTicksAndSleep function? If so, are you using the taskENTER/EXIT_CRITICAL() macros, or are you globally disabling and enabling interrupts by setting the appropriate bit in the status register? You must use the latter for it to work...

The taskENTER/EXIT_CRITICAL() macros don't disable interrupts on the Cortex-M core, they only mask off up to a certain interrupt priority. If the RTC interrupt is masked off by this priority then it can't bring the Cortex-M out of low power mode.

On the other hand, by way of some magic in the Cortex-M core, if you leave the interrupt mask such that it does not mask off any interrupts, but instead globally disable interrupts, the RTC interrupt will be able to bring the Cortex-M core out of low power mode, although the interrupt won't actually be executed until interrupts are globally enabled again.

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