SSDA012 September 2026 MSPM0C1103 , MSPM0C1103-Q1 , MSPM0C1104 , MSPM0C1104-Q1 , MSPM0C1105 , MSPM0C1106 , MSPM0G1105 , MSPM0G1106 , MSPM0G1107 , MSPM0G1505 , MSPM0G1506 , MSPM0G1507 , MSPM0G1518 , MSPM0G1519 , MSPM0G3105 , MSPM0G3105-Q1 , MSPM0G3106 , MSPM0G3106-Q1 , MSPM0G3107 , MSPM0G3107-Q1 , MSPM0G3505 , MSPM0G3505-Q1 , MSPM0G3506 , MSPM0G3506-Q1 , MSPM0G3507 , MSPM0G3507-Q1 , MSPM0G3518 , MSPM0G3518-Q1 , MSPM0G3519 , MSPM0G3519-Q1 , MSPM0H3215 , MSPM0H3216 , MSPM0L1105 , MSPM0L1106 , MSPM0L1117 , MSPM0L1227 , MSPM0L1227-Q1 , MSPM0L1228 , MSPM0L1228-Q1 , MSPM0L1303 , MSPM0L1304 , MSPM0L1304-Q1 , MSPM0L1305 , MSPM0L1305-Q1 , MSPM0L1306 , MSPM0L1306-Q1 , MSPM0L1343 , MSPM0L1344 , MSPM0L1345 , MSPM0L1346 , MSPM0L2227 , MSPM0L2228 , MSPM0L2228-Q1
The base code used for the subsystem is derived from the lin_responder and i2c_controller_rw_multibyte_fifo_interrupts examples provided with the MSPM0 SDK. For a clearer understanding of both examples, please refer to their respective README files.
To present the bridge structure, it is important to highlight the location of each component of the implementation so users know where to make their modifications.
The lin_config.h file serves as the central repository for all structures and global variables used throughout the project, and it is where the bridge structure is declared to capture the various stages the bridge will occupy at specific points in its execution. A global variable labeled gBridgeState is referenced by every source file in the project and is updated as different stages of the LIN or I²C transactions occur.
/*! @enum BRIDGE_STATE - Bridge state machine states */
typedefenum {BRIDGE_IDLE = 0,
BRIDGE_LIN_RX_STATE_ONGOING = 1,
BRIDGE_LIN_RX_STATE_END = 2,
BRIDGE_I2C_TX_STATE_ONGOING = 3,
BRIDGE_I2C_RX_STATE_ONGOING = 4,
BRIDGE_LIN_TX_STATE_ONGOING = 5,
} BRIDGE_STATE;
volatile BRIDGE_STATE gBridgeState;
The lin_config.c file implements the mechanisms required for LIN protocol standards on the MSPM0. Certain functions in the file have been modified to keep track of the LIN‑bus states (e.g., LIN_RX and LIN_TX ongoing states).
Moving to the main file, lin_to_I2C.c, the lin_config.h is called to inherit all defines and structures used across the LIN and I²C modules. Afterwards, the following items are created to implement the bridge:
At startup, SYSCFG_DL_init() configures the peripherals, then the LIN‑EN assigned I/O pin is set high to activate the physical bus driver, and a loop executes to find the PID values of the two messages in the LIN table based on their respective IDs.
Afterward, the table pointer is registered in the global gLIN variable so that the interrupt‑driven LIN driver knows which PIDs to monitor, and the LIN counter‑compare register is loaded with LIN_BREAK_FIELD_MIN_CYCLES to establish the minimum break‑detection window.
Finally, pending interrupts are cleared for the modules used by the bridge (UART‑LIN, timers, and I²C), the red LED that toggles at various bridge states is cleared, and both gBridgeState and gI2cControllerStatus are reset to their idle values.
The main loop operates in an interrupt‑driven manner; the CPU executes __WFI() to enter low‑power sleep and wakes only when a peripheral generates an interrupt.
The first state the bridge reaches is BRIDGE_LIN_RX_STATE_ONGOING, which begins when the bridge’s LIN responder accepts the Subscribe message from an external LIN commander. Once the X‑bytes message is received successfully, the LIN_processMessage_Rx callback is invoked, the bridge state advances to BRIDGE_LIN_RX_STATE_END, and the red LED toggles for one second to indicate that the end state has been reached.
Returning to the main loop after this event, the I²C sequence starts. The state is reset to BRIDGE_IDLE, and, if the received PID matches the Subscribe PID (signaling that a LIN message is ready for I²C transmission), the LIN receive buffer (gLIN.rxBuf) is copied into the I²C hardware TX FIFO. If the number of bytes can be transferred in a single burst, the TXFIFO‑trigger interrupt is disabled; otherwise, the interrupt remains enabled so that the ISR can replenish the FIFO as it drains.
The system then marks the I²C status as TX_STARTED, sets the bridge status to BRIDGE_I2C_TX_STATE_ONGOING, waits for the I²C bus to become idle, and calls DL_I2C_startControllerTransfer to initiate a write of the previously received LIN X‑bytes to the address defined in the I²C configuration (0x48 in this case). The CPU executes __WFI() in a loop until the ISR signals either TX_COMPLETE or ERROR; any error triggers a software breakpoint via __BKPT(0). Upon completion, the red LED toggles again to indicate that the I²C‑TX portion of the bridge operation has finished.
After a short delay, the system marks the I²C status as RX_STARTED, sets the bridge status to BRIDGE_I2C_RX_STATE_ONGOING, and issues a read request from the bridge I²C controller for Y-bytes from the external I²C target. The CPU again executes __WFI() until the ISR signals that the I²C reception has completed, at which point the red LED toggles to indicate that the I²C‑RX portion of the bridge operation has finished.
Finally, an external LIN commander requests the Y-bytes that were retrieved from the I²C target. When the bridge’s LIN responder accepts the Publish message, the bridge status changes to the final state BRIDGE_LIN_TX_STATE_ONGOING. After all the bytes have been transmitted successfully, the LIN_processMessage_Tx callback is invoked, the bridge state returns to idle, and the red LED toggles for one second to indicate that the bridge has completed its cycle. After this, the bridge status and cycle are reset to their initial values, as they are at the beginning of the program.
In the event of an error, the following behaviors are expected (the errors behavior can be modified to fit an application's requirements):