MSP430 and MSP432 MCU Porting Guide: Code Compatibility and DriverLib Usage

Slide Note
Embed
Share

Learn how to port code between MSP430 and MSP432 microcontrollers, ensuring register access compatibility using DriverLib, and adapting interrupt handling. Explore recommendations for developing new code, utilizing system features, and handling data types. Discover portability considerations for various modules like Timer_A, eUSCI, GPIO, AES, ADC14, and more.


Uploaded on Sep 27, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. MSP432 Part 9: Porting between MSP430 and MSP432 MCUs Training Code Compatibility Register Access & DriverLib Interrupt Intrinsics 1

  2. MSP Platform Portability Hardware Software Development Tools Development Kits CCS IDE MSPWare Register- Level LaunchPad MSP 16-bit core IAR IDE Energia GCC Driver Library MSP430 Modules BoosterPacks Target Board 430 430 MSP430 Libraries ULP Tools: ULP Advisor & EnergyTrace Intrinsics & Interrupts MSP Debugger BSL RTOSs MSPWare ARM M4F 32-bit core Register- Level Driver Library 430 430 New MSP432 Modules 432 432 ARM Modules MSP432 Keil ARM ARM ULP Tools: ULP Advisor & EnergyTrace+ Libraries Intrinsics & Interrupts Same as MSP430 New for MSP432 Slight modifications from MSP430 CMSIS

  3. Porting | Code Compatibility Module C-code DriverLib Recommendation Core/CPU New New msp430dna.h, intrinsic support available Power New New Develop new code using DriverLib APIs CORE SYSTEM CS New New Develop new code using DriverLib APIs Flash & RAM New New Develop new code using DriverLib APIs Header file definitions, register names, bits compatible to MSP430 Existing register-access code compatible on MSP432 MSP430 DriverLib APIs also compatible on MSP432 See interrupt/NVIC component below for specific interrupt changes. NVIC New New Develop new code using DriverLib, CMSIS, or MSP432 intrinsics ISR Small changes Small changes Special consideration for flag clearing & power modes when entering/exiting ISRs Intrinsics Some MSP430 intrinsics supported on MSP432 Double-check if code has specific data-type (16-bit vs. 32-bit) requirements New core system configuration code required. No need to develop code from scratch: take advantage of DriverLib APIs and example to quickly configure and bring up system Utilize new core features such as DC-DC, tunable DCO, dual flash banks, SRAM bank controls, etc. CPU: check native data types, different code execution deterministic due to 3-stage pipeline msp430dna.h converts applicable ones, helps guide through changing non-compatible ones to msp432/CMSIS intrinsics Digital: Timer_A, eUSCI, GPIO, AES 100% Portable 100% Portable Port existing code, check & verify data types. Register access code available, but DriverLib APIs recommended for complex module such as DMA DriverLib APIs Similar to Tiva C DriverLib APIs CMSIS register definitions compatible with other ARM devices. Existing applicable MSP430 intrinsics usable on MSP432 Non-compatible MSP430 intrinsics are detected & guided to convert to MSP432 intrinsics CMSIS core intrinsic functions also available. MSP430 ADC14 Portable, new registers added Portable, new APIs added Port existing code, update code utilizing new features (14-bit, flag check, etc.), check & verify data types. COMP_E, REF 100% Portable 100% Portable Port existing code, check & verify data types. AES, CRC 100% Portable 100% Portable Port existing code, check & verify data types. DMA New New Use DriverLib APIs Timer32 New New, similar to TivaC Simple modules: use C-code, DriverLib, or CMSIS ARM SysTick New New, similar to TivaC Simple modules: use C-code, DriverLib, or CMSIS Application Code Take care of data types (16-bit, 32-bit, native int, signs, etc.) Try to use explicit C99 types (uint32_t) if possible.

  4. Porting | Direct Register Access MSP430 MSP432

  5. Porting | DriverLib I2C Master Initialization MSP430 MSP432

  6. Porting | CMSIS Support CMSIS-style device header file msp432_cmsis.h CMSIS core header files Supplied from ARM Provide intrinsic/instruction support CMSIS DSP & Math library 6

  7. Porting | MSP430 DNA & Intrinsic Support Enabled using msp430dna.h & CMSIS standard library Intrinsic functions: __no_operation(); Low-power mode intrinsics Stack pointer, registers, etc. __delay_cycles(); Supported in CCS Incompatible intrinsics are detected & recommended for MSP432 replacement Detects all incompatibility Guides developers through replacement & migration 7

  8. Porting | Interrupts Declaration on MSP432 Option 1: Declare the entire Interrupt Vector table Option 2: MSP430 method Use #pragma vector msp432_startup_ccs.c #pragma vector = USCI_B0_VECTOR __interrupt void USCI_B0_ISR(void) { switch(__even_in_range(UCB0IV,12)) { case 0: break; } //All unused interrupts trapped #pragma vector = unused_interrupts __interrupt void intDefaultHandler(void) { //trap } 1. 2. MSP430 code re-use Interrupt vector & handler function defined together ISR Handlers: stubs defined in table. Treated as regular function, code in user s application 8

  9. Porting | Interrupts Usage on MSP432 Individual module interrupt sources Module interrupt vector in NVIC Reset SysTick NVIC Master Interrupt Ready INT Alarm INT Event INT Osc. Fault TimerA Interrupt Event RTC Pre-scale T0 Pre-scale T1 . . Extra step for MSP432 Port6 RTC interrupt sources 1. Enable module interrupt sources 2. Enable module interrupt in NVIC 3. Enable NVIC Master Interrupt RTCPS1CTL |= RT1PSIE; SCS_NVIC_ISER0 = INT_RTC_BIT; __enable_interrupt(); 9

  10. Porting | Interrupts Usage on MSP432 Individual module interrupt sources Module interrupt vector in NVIC Reset SysTick NVIC Master Interrupt Ready INT Alarm INT Event INT Osc. Fault TimerA Interrupt Event RTC Pre-scale T0 Pre-scale T1 . . Extra step for MSP432 Port6 RTC interrupt sources 1. Enable module interrupt sources 2. Enable module interrupt in NVIC3. Enable NVIC Master Interrupt RTC_enableInterrupt( RTC_CLOCK_READ_READY_INTERRUPT | RTC_CLOCK_ALARM_INTERRUPT | RTC_PRESCALE_TIMER1_INTERRUPT); Interrupt_enableMaster(); Interrupt_enableInterrupt( INT_RTC); 10

Related


More Related Content