Home
Using the RTOS on TI`s MSP430
Contents
1. 0000005931 0000005982 0000005983 0000006482 0000006483 nronn7n7n7n7nnnnnnwnn TalkUSB Acquired USB MHX I F TalkUSB Sending to USB TalkUSB Released USB MHX I F DetectUSB USB disconnected DetectUSB USB connected TalkUSB Acquired USB MHX I F TalkUSB Sending to USB TalkUSB Released USB MHX I F TalkMHX Acquired USB MHX I F TalkMHX 5V_SW is ON TalkMHX 5V_SW is OFF TalkMHX Released USB MHX I F USART1 sending ambient temp information via USB FM430 Tx1 FM430 Tx1 FM430 Tx1 FM430 Tx1 FM430 Tx1 0000004587 0000004687 0000004787 0000004887 0000005452 USB disconnected USB re connected FM430 Tx1 0000005924 U Ur U UU Ambi Ambi Ambi Ambi Ambi Amb ent ent ent ent ent temp temp temp temp temp ient temp 19 LS 19 20 20 Or Ot OO 20 C The Salvo RTOS on TI s MSP430 26 for USB for USB for MHX Thank you for your interest in Salvo The RTOS that www pumpkininc com 750 Naples Street San Francisco CA 94112 USA tel 415 584 6360 fax 415 585 7948 web http www pumpkininc com email info pumpkininc com The Salvo RTOS on TI s MSP430 28 Speaker Information Dr Kalman is Pumpkin s president and chief software architect He entered the embedded programming world in the mid 1980 s After co founding a su
2. 0 MSP430 Real world Results Suitability e MSP430 s 2K RAM and 60K ROM are ideal for Salvo applications 20 task 30 event application consumes under 15 RAM and 5 ROM leaving plenty of RAM and ROM for user application e Salvo runs on every member of the MSP430 family Low Power e Salvo s event driven multitasking allows application to sleep at all times waking only for activity i e internal or external events Performance e MSP430 s highly orthogonal instruction set and comprehensive addressing modes mean rapid execution of Salvo services Tools e Non intrusive easy to debug e Works seamlessly with all major toolsets e Pumpkin and MSP430 compiler vendors are actively involved in further integrating Salvo into their toolsets The Salvo RTOS on TI s MSP430 10 Conclusion e Using Salvo on the MSP430 helps the embedded designer in e Implementing new designs quickly e Enhancing functionality using existing on chip resources e Improving real time performance e Multitasking e Using memory efficiently e Minimizing costs e Managing complexity e Reducing time to market let me say that the RTOS has exceeded all of our expectations and we are grateful for your excellent support Mark Mayernick Salvo MSP430 user Datex Ohmeda The Salvo RTOS on TI s MSP430 pees Ui Jee PART Il Example Salvo Application MSP430F149 based Design Example e Hardware Details e P6 shared between e USB tran
3. PUMPKIN REAL TIME SOFTWARE Using the amp Salvo The RTOS that runs in tiny places RTOS on TI s MSP430 Presented at TI s 2 Annual MSP430 Advanced Technical Conference Ft Worth Texas Nov 11 13 2003 PART Introduction to Salvo The Source Pumpkin Inc e An embedded solutions company e Established 1995 in San Francisco California e Focused on providing highest quality tools for embedded system designers e Active in both hardware and software design for a variety of end user clients e Works closely with chip and compiler vendors to assure maximum value for Salvo users The Salvo RTOS on TI s MSP430 Salvo A Unique RTOS e Minimal on chip resource requirements e Designed expressly for use in single chip C s e Event driven priority based cooperative multitasking e Certified for use with all major MSP430 compilers mesi chose RA e Available in different flavors e Salvo Lite freeware demo evaluation e Salvo tiny included with some compilers IDES e Salvo SE available from certain compiler vendors e Salvo LE all supported functionality e Salvo Pro Salvo LE source code e Portable cross compiler and cross target e Highly configurable written 98 in C e Easy to learn e Royalty free The Salvo RTOS on TI s MSP430 lt 3 Who Uses It and How e World wide user base e Large Corporations e Smaller Companies e Individual Consultants e Applications include e Milita
4. Runs independently of others i e loosely coupled e Runs at a moderate priority e Uses minimal run time resources During the 5s period that transceiver power is on no CPU cycles are expended on TaskTalkMHX and other tasks are free to run e A binary semaphore is used to control access to a shared resource the USB transceiver interface e Additional Features e Like TaskDetectUSB TaskTalkMHX must acquire the USB transceiver interface before proceeding etc e During the 5s period when TaskTalkMHX has acquired the USB transceiver interface all other tasks wishing to use the interface must wait e TaskTalkMHX is incomplete It would likely be expanded to wait on an event that signifies that data is ready to be transmitted After transceiver power is enabled and the transceiver has completed its power on sequence TaskTalkMHX could signal another task to begin transmitting data packet wise over the USB transceiver interface When finished TaskTalkMHX would receive a signal to power down the transceiver and release the USB transceiver interface and resume waiting for a transmit data event The Salvo RTOS on TI s MSP430 2T Entering and Exiting Low Power Modes Sleep whenever there are no eligible tasks void OSIdlingHook void __low_power_mode_1 OSIdlingHook is called only when no tasks are eligible to run Therefore it s the ideal place to sleep the processor until an
5. ccessful Silicon Valley high tech startup he founded Pumpkin with an emphasis on software quality He has also been involved in a variety of other hardware and software projects Copyright Notice 2003 Pumpkin Inc All rights reserved Pumpkin and the Pumpkin logo Salvo and the Salvo logo and The RTOS that runs in tiny places are all trademarks of Pumpkin Inc All other trademarks and logos are the property of their respective owners No endorsements of or by third parties listed are implied vii viii xi xii xiii xiv XV Local auto variables are not preserved across context switches Note that the use of using static variables in tasks does not impact overall RAM requirements when compared to a typical preemptive or cooperative RTOS Disabling timeouts reduces tcb size to 10 bytes Optional tcb extensions Salvo Pro only require additional RAM per tcb Can be reduced to 4 bytes by disabling event types Salvo v3 2 0 b with IAR MSP430 C v1 26B In bytes Does not include interrupt vectors In bytes Does not include RAM allocated to the stack Includes 2 bytes from the CDATAO section Includes 2 bytes on the IDATAO section Includes 2 bytes from the CDATAO section Includes 2 bytes on the IDATAO section As measured with tu4lite Salvo Pro only A bus powered USB device is one that gets its power from the USB host i e over the USB cable This is the total system sleep current and includes the quiescent curr
6. ding e Run additional periodic tasks at multiples of system tick period e Use messages and message queues for intertask communications e Multiple asynchronous sampling tasks pass data to a single task that logs captured data to NVRAM e Highest priority tasks wait on critical events e Use free running system timer for timestamps e Handle lost events via wait with timeout The Salvo RTOS on TI s MSP430 OA Example Application Results e Application Configured For Uses e 10ms system tick period e Multiple interrupt sources e LPM1 e MCLK SMCLK e sprintf 16 bit multiply amp divide e Subsystems e Timer_A USARTO USART1 ADC12 WDT Digital I O e Salvo Configured For e 16 bit delays e Priority based multitasking e Binary semaphores e 15 tasks e 32 bit system timer e 1 event e Salvo s Memory Requirements on MSP430F149 for this Application e 1132 bytes ROM 1 8 for Salvo services e 171 bytes RAM 8 3 for Salvo s global objects e Default of 90 bytes RAM 4 4 for stack is more than sufficient e Application s Power Consumption e Over 97 of the time in LPM The Salvo RTOS on TI s MSP430 25 Example Application Runtime Behavior USARTO sending debug information via RS 232 M430 Tx0 M430 Tx0 M430 Tx0 M430 Tx0 M430 Tx0 M430 Tx0 M430 Tx0 M430 Tx0 M430 Tx0 M430 Tx0 M430 Tx0 M430 Tx0 Ho ono ee nannini 0000005451 0000005458 0000005459 0000005535 0000005860 0000005923 0000005930
7. e Tasks can be created started stopped destroyed etc e A context switch always results in the most eligible task running e Constraints e Context switch may only occur at the task level e A tasks local auto variables are usually replaced with static variables Events e Binary semaphores semaphores messages message queues and event flags are supported e Events can be created and signaled from anywhere Tasks can wait events with optional timeouts Timers e Single system timer controls all task delays and timeouts as well as system tick services e OSTimer can be called from any periodic timer The Salvo RTOS on TI s MSP430 8 MSP430 Port Memory Requirements e RAM usage per task control block 14 bytes max e RAM usage per event control block 6 bytes max e Stack size Similar to typical foreground background application e ROM usage 400 1700 bytes tutorial memory usage total ROM total RAM culle 450 22 audace 596 22 tu3lite 638 24 tud4lite 1148 34 EWS ILaLice 1562 50 tu6lite 1678 coli tu6pro 1550 48 Table 1 ROM and RAM requirements for Salvo Applications built with IAR s MSP430 C Compiler Context Switching 25us MCLK 8MHz with priorities events etc Interrupt Control e Default configuration is for GIE to be disabled during critical sections e Interrupt latency can be minimized via user re configuration of interrupt control The Salvo RTOS on TI s MSP430
8. ent of voltage regulators leakage across power control and level shifting FETs etc IAR MSP430 C v2 10A The Salvo RTOS on TI s MSP430 29
9. event i e an internal or external interrupt occurs Exit LPM after each interrupt that calls a Salvo service pragma vector TIMERAO_VECTOR __ interrupt void Timer_A void CCRO 10000 OSTimer low_power_mode_off_on_exit Don t re enter LPM until Salvo s scheduler has processed event s ISRs that are independent of Salvo can resume LPM on exit The Salvo RTOS on TI s MSP430 2 Putting it All Together Initialize create tasks and events begin multitasking void main void user init Init Salvo init OSInit several enable i 1 create tasks interrupts are used interrupt OSCreateTask TaskStatusMonitor OSTCBP OSCreateTask TaskDetectUSB OSTCBP OSCreateTask TaskTalkUSB OSTCBP OSCreateTask TaskTalkMHX OSTCBP OSCreateTask TaskMeasureAmbientTemp OSTCBP create events OSCreateBinSem Fg Ff for ey OSSched BINS EM_US B_MHX_AVAI E P Li The Salvo RTOS on TI s MSP430 94 Completing the Application e Use additional binary semaphores and task priorities to manage access to resources e Analog sampling tasks wait for P6 shared with USB transceiver interface to be available before proceeding e User USART1 task waits for USART1 used by TaskTalkUSB and TaskTalkMHX to be available before procee
10. ibutes e Runs independently of others i e loosely coupled e Runs at a moderate priority System should detect USB connections quickly e Uses minimal run time resources During the 250ms period between testing for USB presence no CPU cycles are expended on TaskDetectUSB and other tasks are free to run e A binary semaphore is used to control access to a shared resource the USB transceiver interface e Additional Features e TaskDetectUSB will be held off until the USB transceiver interface is available If the interface is not available i e another task is using it TaskDetectUSB will acquire it when the interface is released and TaskDetectUSB is the highest priority task waiting to use the interface The Salvo RTOS on TI s MSP430 19 Task to Enable Transceiver Power During Transmission When Interface is Available Turn on Transceiver for 5s void TaskTalkMHX void for proceed if USB MHX I F is not in use OS_WaitBinSem BINSEM_USB_MHX_AVAIL_P OSNO_TIMEOUT label OpenUSBMHXIF MHX turn on power to transceiver Enable_5V_to_MHX leave it on for 5s length of transmission OS_Delay 500 label release USB MHX I F CloseUSBMHXIF MHX OSSignalBinSem BINSEM_USB_MHX_AVAIL_P The Salvo RTOS on TI s MSP430 20 TaskTalkMHX e Attributes e
11. ry e Avionics e Recreation e Data logging e Safety devices e GPS equipment e Medical devices e Handheld devices e Industrial process control e U S Military e Educational Institutions e Governmental Organizations e Space e Telecom e Wireless e Robotics e Food handling e Transportation e Instrumentation e Alternative energy e Autonomous vehicles The Salvo RTOS on TI s MSP430 As What s Included e Comprehensive user manual over 500 pages e Every distribution contains e Configurable installer e Salvo libraries e Tutorial and example projects e Getting started application notes e Compiler reference manuals e Additional resources for Salvo users e Responsive tech support e Web forums The Salvo RTOS on TI s MSP430 H Compared to other Programming Methodologies Interrupt latency Interrupt response Task response Stack requirements RAM requirements ROM requirements Intrusiveness Coupling Extensibility Handles complexity Effort to learn Foreground Background low low low low varies user user tight poor poorly least Preemptive RTOS moderate high fast high high high high loose excellent well most The Salvo RTOS on TI s MSP430 f Cooperative RTOS low low moderate moderate moderate moderate moderate loose excellent well more Salvo RTOS low low moderate low low moderate low loose excellent well more The RTOS Approach
12. sceiver handshake control interface e Transceiver isolation e Analog sampling channels e g temp sensors e USART1 shared between e Serial to USB converter e 2 4GHz spread spectrum wireless transceiver e User off board e Mixed 3 3V 5V design e Level translators amp buffers provide isolation incl unpowered states e USB 5V bus powered interfaces to MCU at 3 3V via isolator e Transceiver 5V interfaces to MCU via isolators amp level shifters e MCU controls 0E s on isolators amp level shifters e MCU controls power to 5V transceiver e Low Power e Sleep at lt 30uA operate at lt 2mA Tx occasionally at gt 750mA e Powered via internal 5V or via USB The Salvo RTOS on TI s MSP430 lt 43 e Block Diagram 5V_USB VCC 5V OQ N o 2 or LDO MSP 430 VA Transceiver 4 UART1 UARTO VREF h s 5V_USB H 3 A USB lt gt Serial ca PSE Reset 2 Le RS 232 a 5V_SW VCC Nun o 0 0 0 0 o o o 0 5V_USB 5V The Salvo RTOS on TI s MSP430 sja e Software Requirements e USART1 e Manage isolation amp interface to USB transceiver user to avoid contention e USB e Detect when USB I F is present e Acquire amp release USB interface e Transceiver e Tx R
13. to System Software Features e Loosely coupled Each task can run independently of others e Priority based The highest priority eligible task is always running or will run as soon as the current task yields i e context switches e Event driven While a task is waiting delayed or stopped no processing i e 0 CPU cycles is expended in maintaining the task e Inter task Communications Distributed program execution based on task to task or ISR to task actions Benefits e Loose Coupling Adding and or removing tasks from the application even during runtime is very simple Application features can be easily compartmentalized enabled tested etc Especially beneficial where multiple programmers are involved in creating a single large application e Priority based Task Execution Important time critical tasks get CPU resources when they need them Less important do whenever tasks get the CPU only when appropriate e Event driven Behavior System exhibits excellent overall system responsiveness because there is no polling CPU resources are always directed towards the highest priority eligible task System is always primed waiting for an event and can sleep between events e Inter task Communications Connect loosely coupled processes in a well defined manner The Salvo RTOS on TI s MSP430 i pe Features and Operational Details Tasks e 16 dynamic task priority levels e Run forever task structure
14. unning immediately after its 2s delay expires e Uses minimal run time resources During the 2s period between successive reads of ADC12MEMO no CPU cycles are expended on TaskMeasureAmbientTemp and other tasks are free to run e No inter task communications because it runs alone accessing global variables e Additional Features e Salvo s ability to context switch at any place in the task allows other tasks to run while TaskMeasureAmbient Temp is waiting for 10ms delay during ADC 12 initialization The Salvo RTOS on TI s MSP430 17 Task to Detect if USB is Connected Check for USB every 250ms signal system if present void TaskDetectUSB void for proceed if USB MHX I F is not in use OS_WaitBinSem BINSEM_USB_MHX_AVAIL_P OSNO_TIMEOUT label OpenUSBMHXIF USB XE H FM430status USBpresent amp amp PIIN amp BIT7 FM430status USBpresent 1 FM430Msg0 DetectUSB USB connected else if FM430status USBpresent amp amp P1IN amp BIT7 FM430status USBpresent 0 FM430Msg0 DetectUSB USB disconnected release USB MHX I F CloseUSBMHXIF USB OSSignalBinSem BINSEM_USB_MHX_AVAIL_P come back in 25 ticks 7 OS_Delay 25 label The Salvo RTOS on TI s MSP430 218 TaskDetectUSB e Attr
15. x when requested e Acquire amp release transceiver interface including the control of transceiver power when Tx ing Rx ing e PG e Sample at a variety of rates via A D inputs e Handshake control to USB transceiver interface e Other Processes e Perform a myriad of other simultaneous operations e g data processing system status reporting storing and retrieving data to from external NVRAM etc e Power Consumption e Sleep whenever no activity is warranted The Salvo RTOS on TI s MSP430 1 5 Task to Read Ambient Temperature Configure ADC12 and read internal temperature sensor at 1 2Hz unsigned int ADCresult unsigned long int DegC void TaskMeasureAmbientTemp void setup ADC12 to read ch 10 etc ADC12CTLO ADC120N REFON REF2_5V SHTO_6 ADC12CTL1 SHP ADC12MCTLO INCH_10 SREF_1 wait 10ms for reference startup OS_Delay 1 label enable conversions ADC12CTLO ENC for ADCI2CTLO ADCI2S start conversion OS_Delay 200 label wait 2s ADCresult ADC12MEMO read result DegC long ADCresult 1615 704 4095 calc DegC The Salvo RTOS on TI s MSP430 16 TaskMeasureAmbientTemp e Attributes e Runs independently of others i e loosely coupled e Runs at a low priority Ambient temp sensing is not a high priority issue in this system OK if other higher priority tasks prevent it from r
Download Pdf Manuals
Related Search
Related Contents
Centrífuga - Cook Eletroraro Installation and user manual Ecosun IRC LN 24 MCS W TOP - Lamborghini Calor Hama Pen Miele WT2796 washer dryer Braun 197s-1 VX-212U D3 User Manual with MVP Copyright © All rights reserved.
Failed to retrieve file