Logo
MSP PMBus Library Users Guide  v1.00.00.00
Examples

This section describes the examples included with the PMBus library.

Supported Devices

The PMBus library examples were developed and tested in the following MSP430™ families of devices:

Device I2C Interface
MSP430FR59xx Enhanced Universal Serial Communication Interface (eUSCI)
MSP430G2xx3 Universal Serial Communication Interface (USCI)

MSP430 devices supported by PMBus library examples

The code examples and PMBus library can be implemented in different derivatives of the same family with little effort, and they can be migrated to other MSP430™ devices with the same I2C interface with some considerations such as pin usage, memory and timeout-timer availability.

Summary of the examples

Each example in this software package is provided with full source code and includes the necessary project files to build the project in IAR and CCS.

Each of the examples are written as PMBus master application communicating to a TPS544C20.

Name Description
PMBus_Master01_TPS544C20 Basic PMBus communication
PMBus_Master02_TPS544C20_SMBAlert PMBus with SMBALERT
PMBus_Master03_TPS544C20_Control PMBus with device on/off through CONTROL line

PMBus library examples

The hardware setup and their funtionality are described in more detail in the following sections.

Running the examples

Obtaining Code Composer Studio (CCS) or IAR Kickstart

The PMBus library and examples build and run on both the IAR and CodeComposer Studio(CCS) environments for MSP430™ microcontrollers. See the Release Notes in the PMBus library package for specific IAR and CCS version information.

IAR and CCS are both available in free, code-size-limited versions (8K and 16k, respectively, of object code). Applications that require less than 8K of memory can be run on both free versions. Applications that require more than 8K of memory cannot be build using the free IAR Ickstart tool. Instead, the free version of CCS can be used, or a licensed version of either environment.

Hardware support

Most of the examples can run on any hardware TI sells in the eStore, supporting the devices mentioned in the Supported DevicesSupported Devices"". This includes:

  • FR5969 LaunchPad (MSP-EXP430FR5969)
  • MSP430™ Value Line Launchpad (MSP-EXP430G2)
  • Any FET target board for supported MSP430™ derivatives

Every example has a HAL layer which can be used to initialize ports, clocks and any other hardware used by the application and PMBus/SMBus layers.

The following tables list the resources used by the examples:

Description Resource
I2C eUSCI_B0
I2C_SDA P1.6/USCB0SDA
I2C_SCL P1.7/USCB0SCL
SMBAlert P1.5
Control1 P1.4
Control2 P1.3
LED0 P1.0
LED1 P4.6

MSP430FR59xx examples

Description Resource
I2C USCI_B0
I2C_SDA P1.7/USCB0SDA
I2C_SCL P1.6/USCB0SCL
SMBAlert P2.5
Control1 P2.4
Control1 P2.3
LED0 P1.0
LED1 P2.0

MSP430G2xx3 examples

Obtaining and building the examples

The PMBus Library examples have the following structure:

<install>
  |--smbuslib           <- SMBus Library source code
  |    |--driverlib     <- MSP430 driverlib used to access the microcontroller peripherals
  |--src                <- Contains the PMBus Library source code
  |--examples
       |--MSP430*       <- MSP430 device supported by examples
            |--CCS
            |    |--PMB*.projectspec  <-- Individual project files for CCS  
            |
            |--IAR
            |    |--PMB*
            |         |--*.{ewd,ewp}  <-- Individual project files for IAR
            |         |--*.eww        <-- Project workspace file for IAR
            |--Src
                 |--PMB*
                      |-- main.c           <-- The example main code
                      |-- Master_HAL.{h,c} <-- Hardware abstraction layer for example
                      |-- *.{h,c}          <-- Other source files used by example

IAR projects

Each IAR project has a workspace. To use the examples in IAR, open the corresponding workspace file (*.eww) by selecting File->Open->Workspace.

The project can be build using the F& key, Menu->Project->rebuild All, or clicking on the Make icon. Projects can be downloaded to the MSP430™ microcontroller using Ctrl+D, Menu->Project->Download, or by clicking the Download and Debug icon.

IAR_build.png
IAR project build and debug icons

CCS projects

CCS project must be imported into a CCS workspace. The projects are defined by *.projectspec files, which contain the information CCS needs to import the project.

Open CCS, and choose Project->Import CCS Projects. Browse to the examples/MSP430*/CCS directory (containing the *.projectspec) files). CCS will show a list of all the projects that were discovered in this directory.

Select any projects and click "Finish". The project(s) should appear in the Project Explorer view.

CCS_project_import.png
Importing CCS projects

The active project can be selected by simply left-clicking on the project and it will be highlighted with bold letters as shown in the following figure:

CCS_project_view.png
Active project in CCS

The project can be built using Ctrl+B, Menu->Project->Build All, or by clicking the Build icon. Projects can be downloaded to the MSP430™ microcontroller using F11, Menu->Run->Debug, or by by clicking the Debug icon.

CCS_build.png
CCS project build and debug icons

Example Descriptions

This section contains information that is common to all PMBus examples. Specific information for each example is provided after this section.

Hardware connection

The required basic connection between Master and Slave PMBus devices is shown below.

MasterSlaveConnection.png
Basic connection between Master and Slave

The pins used for SDA and SCL for the supported devies are described in the _Hardware Support_ section.

The value of the pull-up resistors (Rp) will depend on the system VDD and the bus capacitance. Typical values are in the range of 1K-10K ohms.

Building and excuting the examples

  1. Select and example and import the project into CCS or IAR
  2. Connect the master and slave devices. All of the examples are written as PMBus master application communicating to a TPS544C20. With minor modifications, each example could be modified to work with any PMBus compliant device.
                             /|\  /|\
                             Rp    Rp
                Master        |    |        Slave
                MSP430        |    |        TPS544C20
          -----------------   |    |      -------------
         |             SDA*|<-|----+----> |DATA       |
         |                 |  |           |           |--> VOUT
         |             SCL*|<-+---------> |CLK        |
         |       /|\       |              |           |
 LED0 <--|Px.y*   |---Pb.c*|<-------------|SMBAlert   |
 LED1 <--|Pz.a*            |              |           |
         |                 |              |           |
         |         Control*|------------->|CNTL       | 
  1. Open, build and download the example project to the MSP430™ device
  2. Check the results as described in the individual example section below.

Check the comments in the source code for each example for detailed information of the example functions.

PMBus_Master01_TPS544C20

This example configures some parameters of the TPS544C20 to illustrate some basic calls of the PMBus Library.

After initializing the MSP430™ device and GPIO the example will:

  1. Initialize the PMBus library
  2. Verify the DEVICE_CODE for the TPS544C20
  3. Write the PMBus VIN_OFF command to set the value of the input voltage at wich the unit should stop power conversion
  4. Write the PMBus VIN_ON command to set the value of the input voltage at wich the unit should start power conversion
  5. Write the PMBus IOUT_OC_WARN_LIMIT command to set the value of the output current that cause an output overcurrent warning
  6. Write the PMBus ON_OFF_CONFIG and PMB_OPERATION commands to turn on the TPS544C20

PMBus_Master02_TPS544C20_SMBAlert

This example configures the TPS544C20 and enables SMBAlert functionality. When an alert is detected by the slave device, the MSP430 reads the fault and clears the flag. If enabled, MSP430 will send an ARA packet to double-check if the TPS544C20 is the device asserting the SMBAlert line.

The example can be tested by lowering the TPS544C20's VIN.

After initializing the MSP430™ device and GPIO the example will:

  1. Initialize the PMBus library
  2. Clear SMBAlert interrupt flags and eanble SMBAlert interrupts
  3. Verify the DEVICE_CODE for the TPS544C20
  4. Write the PMBus VIN_OFF command to set the value of the input voltage at wich the unit should stop power conversion
  5. Write the PMBus VIN_ON command to set the value of the input voltage at wich the unit should start power conversion
  6. Write the PMBus IOUT_OC_WARN_LIMIT command to set the value of the output current that cause an output overcurrent warning
  7. Write the TPS544C20 device specific PMBus command to unmask all alerts, and enable auto-ARA
  8. Write the PMBus ON_OFF_CONFIG and PMB_OPERATION commands to turn on the TPS544C20
  9. Enter LPM and wake up on a SMBAlert detection. When an alert is detected
    • use ARA to check if the TPS544C20 was the device calling the alert,
    • send PMBus STATUS_WORD to retrieve the fault
    • send PMBus CLEAR_FAULTS to clear the TPS544C20 fault status

PMBus_Master03_TPS544C20_SMBControl

This example configures the TPS544C20 using the CONTROL line. The CONTROL line turns the output ON/OFF together or independently of the OPERATION command. The signal is optional per PMBus spec but it is implemented in many PMBus devices.

After initializing the MSP430™ device and GPIO the example will:

  1. Initialize the PMBus library
  2. Clear SMBAlert interrupt flags and eanble SMBAlert interrupts
  3. Verify the DEVICE_CODE for the TPS544C20
  4. Write the PMBus VIN_OFF command to set the value of the input voltage at wich the unit should stop power conversion
  5. Write the PMBus VIN_ON command to set the value of the input voltage at wich the unit should start power conversion
  6. Write the PMBus IOUT_OC_WARN_LIMIT command to set the value of the output current that cause an output overcurrent warning
  7. Write the TPS544C20 device specific PMBus command to unmask all alerts, and enable auto-ARA
  8. Write the PMBus ON_OFF_CONFIG and PMB_OPERATION commands to COONTROL-only mode.
  9. Set the GPIO CONTROL line to turn the TPS544C20 on.