SLAA908A September   2019  – September 2021 MSP430FR2032 , MSP430FR2032 , MSP430FR2033 , MSP430FR2033 , MSP430FR2153 , MSP430FR2153 , MSP430FR2155 , MSP430FR2155 , MSP430FR2310 , MSP430FR2310 , MSP430FR2311 , MSP430FR2311 , MSP430FR2353 , MSP430FR2353 , MSP430FR2355 , MSP430FR2355 , MSP430FR2422 , MSP430FR2422 , MSP430FR2433 , MSP430FR2433 , MSP430FR2475 , MSP430FR2475 , MSP430FR2476 , MSP430FR2476 , MSP430FR4131 , MSP430FR4131 , MSP430FR4132 , MSP430FR4132

 

  1.   Trademarks
  2. 1Introduction
  3. 2Implementation
  4. 3UART Message Format
    1. 3.1 Write N Bytes to Slave Device
    2. 3.2 Read N Bytes From Slave Device
    3. 3.3 Repeated Start (Read After Write)
    4. 3.4 Repeated Start (Write After Write)
    5. 3.5 Write to Internal Register
    6. 3.6 Read From Internal Register
  5. 4Internal Registers Available
    1. 4.1 Register Summary
    2. 4.2 Baud Rate Generator (BRG)
    3. 4.3 I2C Bus Clock Rates (I2CClk)
  6. 5Performance
  7. 6Application Examples
    1. 6.1 Test With I2C Slave Device
    2. 6.2 Read and Write EEPROM
  8. 7Reference
  9. 8Revision History

Implementation

Figure 2-1 shows the block diagram for the UART-to-I2C bridge. The MSP-TS430PW20 target development board was used to connect the peripherals to the MSP430FR2311 MCU. Set the jumpers as listed here:

  • Populate jumpers JP14, JP15, JP17, and JP18
  • Do not populate jumper JP13
  • Set jumper JP16 to UART
  • Set jumpers JP3 to JP8 all on 1-2
  • Set jumper JP11 on 1-3 and 2-4

These jumper settings allow the back-channel UART interface on the MSP-FET programmer and debugger to simulate the UART device that will communicate with the bridge. At the same time, the 10k resistor is used as a pullup on the I2C pins. To communication with an I2C device, connect the SCL pin of the I2C device to J4.19 (P1.3) and connect the SDA pin to J4.20 (P1.2). A simple I2C slave project was implemented on an MSP430FR2311 LaunchPad™ development kit to demonstrate the functionality of the UART-to-I2C bridge. The UART-to- I2C bridge functions in I2C master mode.

GUID-DC81865C-6E4F-4237-9DCD-14E6D7F48EEA-low.gif
NOTE: Pullup resistors are required on the I2C bus.
Figure 2-1 UART-to-I2C Bridge Block Diagram

Using a PC, open a new serial connection with a terminal program, and connect to the back-channel UART interface on the MSP-FET by selecting the COM port called MSP Application UART1. In the terminal window, change the baud rate to 115200. To demonstrate the functionality of the UART-to-I2C bridge, enter a string of bytes into the terminal window follow command formats and send it. It will be sent to the I2C slave device, and whatever value was in the TX buffer of the I2C slave device will be displayed in the serial terminal.

Figure 2-2 shows the flowchart for the I2C and UART code.

When an I2C packet is received, the UCRXIFG interrupt flag is set, and the data is read from the I2C RX buffer and stored in the internal buffer (default size is 100 bytes). Next when the data is receive completed, write this data to UART TX buffer and send it through the UART.

When a UART packet is received, it is stored in the internal buffer (the default size is 100 bytes), and then the application analyzes the UART packet command format. Different steps are performed for these two command formats: read or write data through the I2C interface, or read or write internal register data.

GUID-E82F9046-6B5B-483F-B8C7-87BE81766C3A-low.png Figure 2-2 I2C and UART Code Flow