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
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:
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.
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.