MSP432 Lab1 Introduction

TI MSP432 Labs, technical summary and important links

  • TI MSP432 (Introduced in 2015)
    • Main website: [link]
    • MSP432P401R datasheet: [link]
    • The MSP432 is a mixed signal microcontroller family from Texas Instruments. 
    • It is based on a 32-bit ARM Cortex-M4F CPU, and extends their 16-bit MSP430 line
    • The MSP432 is similar to the Stellaris LM4F120 and Tiva-C TM4C123 parts previously available from TI.
    • In 2017 the Tiva TM4C129 was rebranded as MSP432 “E-series”.
    • Device name MSP432P401R consists of the following pieces
      • P: Indicates a Performance and Low Power series device. ‘E’ denotes parts with built-in communication interfaces such as Ethernet, USB, CAN and SPI; those parts have significantly higher power envelope
      • 4: First digit ‘4’ indicates a flash 48 MHz device.
      • 0: Second digit ‘0’ indicates a General Purpose class, ‘1’ has expanded peripherals such as an LCD controller
      • 1: Third digit ‘1’ denotes peripheral configuration including 1 MHz 14-bit ADC
      • R: Fourth digit ‘R’ indicates 256 KB of Flash and 64 KB of SRAM
  • SimpleLink™ MSP432P401R high-precision ADC LaunchPad™ Development Kit
    • Main website: [link].
    • The SimpleLinkTM MSP‐EXP432P401R LaunchPad development kit is an easy-to-use evaluation module for the SimpleLink MSP432TM low-power + performance Arm® 32-bit Cortex®-M4F microcontroller (MCU).
Major diagram

MSP432 board photo
  • Pins exposed @ the MSP-EXP432P401R LaunchPad BoosterPack connector
BoosterPack pin definition
J1-J5 definition

TI MSP432 Lab1: CCS Cloud and Quick Start

You will learn the CCS Cloud development IDE and understand the usage of General Purpose Input Output (GPIO).

  • Go to TI Cloud Tools
    • You will see the following page.
    • Install the TI CLOUD AGENT
  • After you installed the TI CLOUD AGENT, if you connect the MSP432 board to the computer, the system will recognize the connected device on the left side of the TI Cloud Tools page.
  • You will see two COM ports in the device manager.
  • Only using the COM4 Application/User UART
  • Open TI Cloud Tools->TI Resource Explorer, we can search for the MSP432P401R LaunchPad using the search bar on the top-left corner.
  • After clicking on the development kit, the resource explorer will filter the content related to the board. Developers can browse the available resources provided in TI Resource Explorer, which is broken up into 3 categories: Software, Device Documentation & Development Tools.
  • Two options of using resources: 1) any of the delivered content can be downloaded locally onto your machine (i.e. to import code examples into a traditional IDE like Code Composer Studio); 2) stay in the cloud & import code examples into TI’s cloud-connected CCS Cloud IDE
  • In this lab, we will utilize the CCS Cloud IDE (you need to apply one TI account to continue)

Task1 Import the project and Blink the LED

  • Look inside the “Software” category in TI Resource Explorer.
  • Expand the SimpleLink MSP432SDK->Example->DriverLib
Under DriverLib
  • Select example “gpio_toggle_output”->CCS Compiler, and click the button of “import to CCS cloud” (right side)
gpio_toggle_output sample
  • The following code in the GPIO_toggle_output.c configures the P1.0 (LED1) as output
/* Configuring P1.0 as output */
    MAP_GPIO_setAsOutputPin(GPIO_PORT_P1, GPIO_PIN0);
  • The following code toggles the LED1 output
MAP_GPIO_toggleOutputOnPin(GPIO_PORT_P1, GPIO_PIN0);
  • Click the “Build the project” to build the project.
  • Click the “Run” button in the CCS cloud to download the code into the board. You will see the LED in the board is blinking.
  • To enable breakpoint debug, right click the mouse in the code to add “breakpoint”, then click the “Debug” button in the CCS cloud.

The Texas Instruments MSP432 Driver Library (DriverLib) is a set of fully functional APIs used to configure, control, and manipulate the hardware peripherals of the MSP432 platform.

The DriverLib is meant to provide a “software” layer to the programmer in order to facilitate higher level of programming compared to direct register accesses. Nearly every aspect of a MSP432 device can be configured and driven using the DriverLib APIs

With all MSP432 devices, a copy of DriverLib is included within the device’s ROM space. This allows programmers to take advantage of using high level APIs without having to worry about additional memory overhead of a flash library. In addition to a more optimized execution, the user can drastically cut down the memory footprint requirement of their application when using the software Driver Libraries available in ROM.

Accessing Driver Library APIs in ROM is as easy as including the rom.h header file, and then replacing normal API calls with a ROM_ prefix.

While the majority of DriverLib APIs are available in ROM, due to architectural limitations some APIs are omitted from being included in ROM. In addition, if any bug fixes were added to the API after the device ROM was programmed, it is desirable to use the flash version of the API. An “intelligence” has been created to account for this problem. If the user includes the rom_map.h header file and uses the MAP_ prefix in front of the API, the header file will automatically use preprocessor macros to decide whether to use a ROM or flash version of the API.

DriverLib user guide
  • If you want to read the source code of the DriverLib, you can download it under the SimpleLinkSDK->Development Tools->MSP432 LaunchPad->derverlib_empty_project_from_source [link].

Task2 GPIO Register Access

In the previous task, we utilized the DriverLib API provided by TI to access the GPIO. The DriverLib simplifies the development efforts and makes the hardware access just like calling the software API. To understand the internal of the GPIO hardware and know the low-level access of the hardware, we should utilize the second hardware access method: register access. Actually, all the components inside the microcontroller (MCU) requires the register access.

  • Input Registers (PxIN)
    • Each bit in each PxIN register reflects the value of the input signal at the corresponding I/O pin when the pin is configured as I/O function. These registers are read only.
    • Bit = 0: Input is low; Bit = 1: Input is high
  • Output Registers (PxOUT)
    • Each bit in each PxOUT register is the value to be output on the corresponding I/O pin when the pin is configured as I/O function, output direction. Bit = 0: Output is low; Bit = 1: Output is high
    • If the pin is configured as I/O function, input direction and the pullup or pulldown resistor are enabled; the corresponding bit in the PxOUT register selects pullup or pulldown. Bit = 0: Pin is pulled down; Bit = 1: Pin is pulled up
  • Direction Registers (PxDIR)
    • Each bit in each PxDIR register selects the direction of the corresponding I/O pin when it is configured for I/O function.
    • Bit = 0: Port pin is switched to input direction
    • Bit = 1: Port pin is switched to output direction
  • Pullup or Pulldown Resistor Enable Registers (PxREN)
    • Each bit in each PxREN register enables or disables the pullup or pulldown resistor of the corresponding I/O pin. The corresponding bit in the PxOUT register selects if the pin contains a pullup or pulldown.
    • Bit = 0: Pullup or pulldown resistor disabled
    • Bit = 1: Pullup or pulldown resistor enabled
  • Output Drive Strength Selection Registers (PxDS)
    • There are two type of I/Os available. One with regular drive strength and the other with high drive strength.
    • Bit = 0: High drive strength I/Os are configured for regular drive strength
    • Bit = 1: High drive strength I/Os are configured for high drive strength
  • Function Select Registers (PxSEL0, PxSEL1)
    • Port pins are often multiplexed with other peripheral module functions.
    • Each port pin uses two bits to select the pin function – I/O port or one of the three possible peripheral module function.
    • The following table shows how to select the various module functions.
IO function selection
  • In the Datasheet(online) of MSP432, you can check the Port P1 (P1.0 to P1.7) Input/Output Diagram With Schmitt Trigger
Port P1 (P1.0 to P1.7) Input/Output Diagram With Schmitt Trigger
  • The following diagram shows the internal structure when you setup the P1.1 as input
    • Set 0 to register PxSEL0, PxSEL1 in order to select the GPIO function
    • Set 0 to PxDIR register to set P1.1 as input
  • The following diagram shows how get the value of the GPIO input
    • Get the data from the PxIN register
  • The following diagram shows how to set the pin as output
    • Set 0 to register PxSEL0, PxSEL1 in order to select the GPIO function
    • Set 1 to PxDIR register to set pin as output
    • Using the PxOUT register to send the output value, e.g., P1->OUT = (P1- >OUT&(~0x01))|newvalue;
  • In your previous GPIO code (gpio_toggle_output), replace MAP_GPIO_setAsOutputPin(GPIO_PORT_P1, GPIO_PIN0); with the following register access code:
    P1->SEL0 &= ~0x01;
    P1->SEL1 &= ~0x01;
    P1->DIR |= 0x01;
  • Using the following code to turn on the LED
P1->OUT=(P1->OUT&(~0x01)) | 1;
  • Replace the previous MAP_GPIO_toggleOutputOnPin(GPIO_PORT_P1, GPIO_PIN0); code inside the while loop to toggle the LED
P1->OUT=(P1->OUT&(0x01)) ^ 1;
  • You will find that the register-level access can achieve the same function provided by the DriverLib. But, register-level access requires you to understand the hardware and related registers.
  • This ends the Lab1.

Leave a Reply

Your email address will not be published. Required fields are marked *