MSP432 Online Training Series - Part 12

advertisement
MSP432™ MCU RTOS Solutions
1
MSP432 RTOS
RTOS Options
TI-RTOS
Middleware
Connectivity
File Systems
Wi-Fi
User Application
Tasks
freeRTOS
RTX (CMSIS-RTOS)
Power
Manager
Real-time Kernel
Drivers
Micrium OS
MCU
Sensors
2
MSP432 RTOS
Broad Middleware
offering from TI-RTOS
& CMSIS
Unique to TI-RTOS:
Simplify power
management for MCU
Middleware
Connectivity
File Systems
Wi-Fi
Power
Manager
Broad offering from TIRTOS Drivers
User Application
Tasks
Real-time Kernel
Drivers
MCU
Sensors
“RTOS Core” standard offering from all RTOSes
3
RTOS Features Comparison
TI-RTOS
By TI
Scheduler
Type
CMSIS
compliant
• Pre-emptive
X
Services
Interrupt
Latency
Device
Specific
Support
Device
Drivers
Flash
Size
Low
Power Support
• Systick
• Interrupts
• Exception
Handling
• SPI
• SPI-SD
• I2C
• UART
• Timer
• RTC
• Timestamp
• Watchdog
4K to 10K
•
•
Tick Suppression,
Device specific
Power Manager
• Tasks
• Swis
• Hwis
• Software
Timers
• Semaphores
• Mutex
• Mailbox
• Events
• Zero-latency
interrupts
supported
(115 cycles for
ISRs with TIRTOS calls)
ARM RTX
By Keil
• Round-robin
(default)
• Pre-emptive
• Cooperative
√
• Tasks
• SWIs
• Software
Timers
• Semaphores
• Mutex
• Mailbox
• Events
• Zero-latency
interrupts
supported
• Systick
X
<4K
•
•
Tick Suppression,
Device specific
support coming
soon
FreeRTOS
By Real
Time
Engineers
Ltd
• Pre-emptive
• Cooperative
X
• Tasks
• Co-routines
• Software
Timers
• Semaphore
• Mutex
• Events
• Zero-latency
interrupts
supported
• Systick
X
5K to 10K
•
•
Tick Suppression,
Pre and post sleep
macros for
customization,
Idle task hook.
Micrium OS
By Micrium
• Pre-emptive
• Semaphores
• Mutex
• Mailbox
• Events
• Unknown
(task share
stack)
• Direct TASK
notifications
X
• Tasks
• Software
Timers
•
• Systick
X
5K to 24K
• Idle Task Hook
• Tick suppression
coming soon
4
RTOS Tools Comparison
Object
Viewer
Execution
Graph
Logging
RTOS
Config
Tool
Signal Plots
Compiler
support
Examples
License
Certified
Cost
TI-RTOS
By TI
√
√
√
√
√
(GUI
composer)
• CCS
• IAR
• GCC
> 50
• BSD
Free
ARM RTX
By Keil
√
√
X
√
√
•
•
•
•
IAR
Keil
GCC
Cosmic
2
• BSD
Free
FreeRTOS
By Real Time
Engineers Ltd
√
3rd party
Standalone
√
3rd party
Standalone
√
3rd party
Standalone
X
√
3rd party
Standalone
•
•
•
•
•
CCS
IAR
Keil
GCC
Tasking
1
• Modified GPL
• SafeRTOS
Free
Micrium OS
By Micrium
√
√
√
X
√
• CCS
• IAR
2
• Micrium
• SIL3/SIL4
Contact
Micrium
5
MSP432 & TI-RTOS
Components Supported
Kernel
• Developed and maintained by TI
• Fully supported on MSP432 with
> 50 examples. Out of the box
examples for supported boosterpacks.
• Power Manager to simplify &
optimize power during runtime
• Power-aware Drivers that work
with TI-RTOS kernel or can even
be used with another RTOS
• Underlying structure for Energia
MT - first hobbyist-oriented multithread IDE supporting MSP432
Wi-Fi
FAT File System
Device Drivers
Power Manager
Instrumentation
IDE: CCS, IAR, & GCC Tools
Device Drivers
Real-time clock NEW!
Timer
UART
I2C
SPI
SPI-SD
BoosterPack Supported
PWM NEW!
CC3100 Booster Pack
Watchdog
SD-Card BoosterPack
GPIO
TMP006 BoosterPack
Sharp Memory LCD BoosterPack
RF430CL330 NFC Transponder
TPL0401EVM Board
6
TI-RTOS Power Manager
MSP432 Power Sequence
Using MSP432 DriverLib
Using TI-RTOS Power Manager
FlashCtl_setWaitState(FLASH_BANK0, waitsNew);
FlashCtl_setWaitState(FLASH_BANK1, waitsNew);
AM1_DCDC
AMx_DCDC
1MCLK
AM1_LDO
AMx_LDO
3MCLKs
AM0_DCDC
SLx_DCDC
1MCLK
3MCLKs
AM0_LDO
SLx_LDO
RESET
Active-mode
Sleep-mode Transition
AM1_LPR
AMx_LPR
1MCLK
3MCLKs
AM0_LPR
SLx_LPR
/* now change clocks and dividers */
CS_setDCOCenteredFrequency(
PowerMSP432_perfLevels[level].DCORESEL);
CS_initClockSignal(CS_MCLK,
PowerMSP432_perfLevels[level].clockSource,
PowerMSP432_perfLevels[level].DIVM);
CS_initClockSignal(CS_HSMCLK,
PowerMSP432_perfLevels[level].clockSource,
RTC_C_holdClock();
PowerMSP432_perfLevels[level].DIVHS);
WDT_A_holdTimer();
CS_initClockSignal(CS_SMCLK,
PCM_setPowerState(PCM_LPM3);
PowerMSP432_perfLevels[level].clockSource,
PowerMSP432_perfLevels[level].DIVS);
FlashCtl_enableReadBuffering(FLASH_BANK0,
FLASH_DATA_READ);
FlashCtl_enableReadBuffering(FLASH_BANK0,
FLASH_INSTRUCTION_FETCH);
FlashCtl_enableReadBuffering(FLASH_BANK1,
FLASH_DATA_READ);
FlashCtl_enableReadBuffering(FLASH_BANK1,
FLASH_INSTRUCTION_FETCH);
changedStateOK = PCM_setPowerState(stateNew);
Power_sleep()
Power_setPerformanceLevel(level)
Energia MT
??
Single sketch code hard to write for
multiple LEDs at different rates
Multiple sketches makes code clean and easy to write
•
•
•
•
•
Complex single sketches to simple multiple sketches
See video!
Run sketches in parallel
Automagic low power
The power of an RTOS for everybody without the complexity!
Easy to create interactive component libraries
8
Energia MT – Reuse of framework
TI-RTOS enables Energia to be
ported to new devices rapidly!
Energia MT
Sketches
Energia
Libraries
Sketches
Energia/Wiring API
Libraries
TI-RTOS
UART
I2C
SPI
Device
Energia/Wiring API
PWM
UART
I2C
SPI
Device
PWM
MSP432 & ARM RTX
• Download Keil IDE from
http://www.keil.com/mdk5/instal
• Free for all
Royalty Free
CMSIS
compliant
• ARM RTX details
http://www.keil.com/rl-arm/kernel.asp
• Run examples today on the
MSP432 LaunchPad
www.keil.com/appnotes/docs/apnt_276.asp
Small footprint
<4K
Flexible
Scheduling
• Full suite of examples and CMSIS
drivers coming soon
10
MSP432 & FreeRTOS
• Download FreeRTOS from
http://www.freertos.org/
MPU support
• See the demo that runs on the
MSP432 LaunchPad at
http://www.freertos.org/TI_MSP432_Free_RT
OS_Demo.html
Tickless
Free, Modfiied
GPL licence
11
MSP432 & Micrium OS
Built-in
benchmarks
• Download Micrium µC/OS-II from
http://micrium.com/downloadcenter/downloadresults/?searchterm=mimsp432p401r&supported=true
• Contact Micrium for pricing
questions.
Certified for
safety!
12
Backup
13
MSP432 TI-RTOS – Power Manager
•
Power Manager helps applications with
• entering/exiting various LPM modes,
• choosing among the various performance levels – AM_LDO_VCORE0, AM_DCDC_VCORE1 etc
• Drivers can give inputs to Power Manager on which sleep mode or performance level they can
handle at any given time.
• Drivers can get notified by the Power Manager when sleep or performance events occur.
•
Application can pick the sleep mode and performance level and then the Power Manager will manage
the rest in a thread-safe way.
• Power and performance decisions are made in ONE place.
• Clocks get configured based on requested performance level.
• Flash wait states and buffering modes set automatically based on performance level.
• RTC and Watchdog are managed to enter LPM3
•
Simply ask power Manager these questions – “What are my clocks right now?” “What is my performance
level?” “ Why can’t my system enter LPMx.5? What are my latencies to enter/exit LPM modes?” etc.
•
All TI-RTOS drivers use the Power Manager services.
14
MSP432 TI-RTOS – Power Manager APIs
•
Init and setup
Power_init(); - Call once before other APIs at
init time.
Power_enablePolicy();
Enable Power Manager – call once at init
time.
Power_idleFunc(); - Add to idle loop or
forever while(1).
•
Get/Set
Power_set/getPerformanceLevel();
Use this API to set various
performance levels such as
AM_DCDC_VCORE1,
AM_DCDC_VCORE0 etc. This API
also manages flash wait wait and
buffering modes. Constarints are
taken into account before entering
a new performance level.
Power_register/unregisterNotify();
Register a function with the power
manager to get notified on power
events such as “about to sleep”,
“waking up”. Apps can then
manage their state/resources
accordingly.
Power_set/releaseConstraint();
Use this API to prevent entry into
Low Frequency Mode or prevent
entry into LPMx.5.
•
Getters
Power_getConstraintMask(); Get constraints that can
prevent power manager from
entering a particular sleep
state or performance level.
This API will tell the application
why the power Module did not
allow entry into a particular
sleep or performance state.
•
Goto to LPM
Power_shutdown();
API to enter LPMx.5.
Power_sleep();
API to enter LPM0, LPM3 or
LPM4.
15
TI-RTOS Development Tools
16
ARM RTX Development Tools
• Leverage ARM standard CMSIS-DSP library
17
Download