MSPM33C321A: Modbus supports

Part Number: MSPM33C321A
Other Parts Discussed in Thread: SYSCONFIG, MSPM0G3507

Hi experts,

1: Is there any progress on the release schedule for Modbus software for the MSPM33 series?
:(+) MSPM33C321A: Motor-Control SDK - Arm-based microcontrollers forum - Arm-based microcontrollers - TI E2E support forums 

2: Am I correct in understanding that the MSPM33C321A is functionally capable of supporting Modbus?

3: Is there an application note available for porting the Modbus software from the MSPM0 SDK to the MSPM33 series?

Best regards,
O.H

  • Hi OH,

    1. we are not seeing too many requests for this so it's not been prioritized with the releases of the SDK. I'll send a note to our SW team as this has been requested twice.

    2. Yes it should be able to see teh code example from the M0 SDK here: https://dev.ti.com/tirex/explore/node?isTheia=false&node=A__ALC9N7F92MDAw5vRBVdBlg__MSPM0-SDK__a3PaaoK__LATEST&search=modbus

    3. There's not a specific app not on how to port from M0 -> M33 for Modbus software. They should be simple to go from one to the other as the UART API's are very similar. The main changes that may need to be made are in the sysconfig GUI.

  • Hi Erik Vaughn,

    Thank you for your rely. I understood.

    Best regards,
    O.H

  • Hello Erik Vaughn,

    I created an MSPM33-based project based on the MSPM0 Modbus_controller project.
    Although I have not yet verified the runtime operation, the project builds successfully.
    I would appreciate it if you could point out any areas that may need improvement or any potential issues.
    [Environment]
    • Device: MSPM33C321A
    • Board: LP_MSPM33C321A
    • SDK: mspm33_sdk_1_03_00_01
    • IDE: Code Composer Studio Theia / CCS 20.5.1
    • Compiler: TI ARM Clang 4.0.4.LTS
    • Build configuration: NoRTOS, ticlang
    [Summary of changes made for porting from MSPM0G3507 to MSPM33C321A]
    • Import "empty_LP_MSPM33C321A_nortos_ticlang" and "modbus_controller_LP_MSPM0G3507_nortos_ticlang"
    • Copy followind .c/h file to "empty_LP_MSPM33C321A_nortos_ticlang".
      modbus_controller.c/h
      ModbusRTU.c/h
      ModbusRTU_priv.h
    • Sysconfig is attached file withc is based on "modbus_controller_LP_MSPM0G3507_nortos_ticlang".
    • Cretate new file "modbus_msp33_compat.h", witch is to avoid modifying TI’s ModbusRTU.c / ModbusRTU.h, I added a compatibility header:
      typedef UNICOMM_Inst_Regs UART_Regs;
    • Add Compiler option: "-include <workspase>/empty_LP_MSPM33C321A_nortos_ticlang/modbus_msp33_compat.h"
    • Then the add include in "modbus_controller.h" as follows:
      #include "modbus_msp33_compat.h"

    Please let me know if this isn't a linker issue at all.

    Best regards,
    O.H

    /* --COPYRIGHT--,BSD
     * Copyright (c) 2025, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     * --/COPYRIGHT--*/
    
    #include "modbus_controller.h"
    
    /* Data buffer for MODBUS ADU transmission and reception */
    uint8_t data[MODBUS_MAX_ADU_SIZE];
    
    /* Length of valid data in the buffer */
    uint8_t dataLen = 0;
    
    /* Exception code returned by last MODBUS operation */
    uint8_t expCode = 0;
    
    /* Counter for failed responses */
    uint8_t errorResponseCounter = 0;
    
    /*!
     * @brief Checks the response exception code from the last MODBUS operation.
     *        - If successful (expCode == MODBUS_NO_EXCEPTION), toggles the user LED.
     *        - Otherwise, increments the error counter.
     *        A breakpoint is placed for debugging to inspect the data buffer.
     */
    void checkResp()
    {
        /* Check MODBUS response and indicate result */
        if (expCode == MODBUS_NO_EXCEPTION)
        {
            /* Toggle user LED to indicate success */
            DL_GPIO_clearPins(GPIO_LEDS_PORT, GPIO_LEDS_USER_LED_1_PIN);
            /* Delay for visual indication */
            delay_cycles(MODBUS_LED_DELAY_IN_RSP);
            DL_GPIO_setPins(GPIO_LEDS_PORT, GPIO_LEDS_USER_LED_1_PIN);
        }
        else
        {
            /* Increment error counter on exception */
            errorResponseCounter++;
        }
        /* Breakpoint to analyze the result */
        /* User can match the expected and actual result by looking at the contents of data. */
        __BKPT(0);
    }
    
    /*!
     * @brief Runs a sequence of MODBUS controller tests.
     *        Each test sends a MODBUS request, checks the response, and provides visual feedback via the user LED.
     *        After all tests are complete, toggles the LED in an infinite loop to indicate completion.
     */
    void Modbus_runTests()
    {
        /* Start with WRITE_COIL test */
        Modbus_Tests modbusTest = WRITE_COIL;
    
        while (1)
        {
            switch (modbusTest)
            {
                /* Each case prepares the data buffer and sends a MODBUS request */
                case WRITE_COIL:
                    data[0] = 0x00; data[1] = 0x00; data[2] = 0xFF; data[3] = 0x00;
                    dataLen = 4;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_WRITE_SINGLE_COIL, data, dataLen, &expCode);
                    break;
                case READ_COIL1:
                    data[0] = 0x00; data[1] = 0x00; data[2] = 0x00; data[3] = 0x01;
                    dataLen = 4;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_READ_COILS, data, dataLen, &expCode);
                    break;
                case WRITE_MULTIPLE_COIL:
                    data[0] = 0x00; data[1] = 0x00; data[2] = 0x00; data[3] = 0x01;
                    data[4] = 0x01; data[5] = 0x00;
                    dataLen = 6;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_WRITE_MULTIPLE_COILS, data, dataLen, &expCode);
                    break;
                case READ_COIL2:
                    data[0] = 0x00; data[1] = 0x00; data[2] = 0x00; data[3] = 0x01;
                    dataLen = 4;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_READ_COILS, data, dataLen, &expCode);
                    break;
                case READ_DISCRETE_IP:
                    data[0] = 0x00; data[1] = 0x00; data[2] = 0x00; data[3] = 0x01;
                    dataLen = 4;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_READ_DISCRETE_INPUTS, data, dataLen, &expCode);
                    break;
                case WRITE_HOLDING_REG:
                    data[0] = 0x00; data[1] = 0x00; data[2] = 0x00; data[3] = 0xFF;
                    dataLen = 4;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_WRITE_SINGLE_REGISTER, data, dataLen, &expCode);
                    break;
                case READ_HOLDING_REG1:
                    data[0] = 0x00; data[1] = 0x00; data[2] = 0x00; data[3] = 0x01;
                    dataLen = 4;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_READ_HOLDING_REGISTERS, data, dataLen, &expCode);
                    break;
                case WRITE_MLP_HLD_REG:
                    data[0] = 0x00; data[1] = 0x00; data[2] = 0x00; data[3] = 0x01;
                    data[4] = 0x02; data[5] = 0x00; data[6] = 0xFF;
                    dataLen = 7;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_WRITE_MULTIPLE_REGISTERS, data, dataLen, &expCode);
                    break;
                case READ_HOLDING_REG2:
                    data[0] = 0x00; data[1] = 0x00; data[2] = 0x00; data[3] = 0x01;
                    dataLen = 4;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_READ_HOLDING_REGISTERS, data, dataLen, &expCode);
                    break;
                case RW_MLP_HLD_REG:
                    data[0] = 0x00; data[1] = 0x00; data[2] = 0x00; data[3] = 0x01;
                    data[4] = 0x00; data[5] = 0x00; data[6] = 0x00; data[7] = 0x01;
                    data[8] = 0x02; data[9] = 0x00; data[10] = 0xFF;
                    dataLen = 11;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_RW_MULTIPLE_REGISTERS, data, dataLen, &expCode);
                    break;
                case MASK_WRITE_REG:
                    data[0] = 0x00; data[1] = 0x00; data[2] = 0x00; data[3] = 0x00;
                    data[4] = 0x00; data[5] = 0x00;
                    dataLen = 6;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_MASK_WRITE_REGISTER, data, dataLen, &expCode);
                    break;
                case READ_INP_REG:
                    data[0] = 0x00; data[1] = 0x00; data[2] = 0x00; data[3] = 0x01;
                    dataLen = 4;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_READ_INPUT_REGISTERS, data, dataLen, &expCode);
                    break;
                case READ_FIFO_QUEUE:
                    data[0] = 0x00; data[1] = 0x00;
                    dataLen = 2;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_READ_FIFO_QUEUE, data, dataLen, &expCode);
                    break;
                case WRITE_FILE:
                    data[0] = 0x09; data[1] = 0x06; data[2] = 0x00; data[3] = 0x01;
                    data[4] = 0x00; data[5] = 0x00; data[6] = 0x00; data[7] = 0x01;
                    data[8] = 0xFF; data[9] = 0xFF;
                    dataLen = 10;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_WRITE_FILE_RECORDS, data, dataLen, &expCode);
                    break;
                case READ_FILE:
                    data[0] = 0x07; data[1] = 0x06; data[2] = 0x00; data[3] = 0x01;
                    data[4] = 0x00; data[5] = 0x00; data[6] = 0x00; data[7] = 0x01;
                    dataLen = 8;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_READ_FILE_RECORDS, data, dataLen, &expCode);
                    break;
                case READ_EXCEPTION_STATUS:
                    dataLen = 0;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_READ_EXCEPTION_STATUS, data, dataLen, &expCode);
                    break;
                case GET_COMM_EVENT_COUNTER:
                    dataLen = 0;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_GET_COM_EVENT_COUNTER, data, dataLen, &expCode);
                    break;
                case GET_COM_EVENT_LOG:
                    dataLen = 0;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_GET_COM_EVENT_LOGS, data, dataLen, &expCode);
                    break;
                case GET_TARGET_ID:
                    dataLen = 0;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_REPORT_SERVER_ID, data, dataLen, &expCode);
                    break;
                case RET_QUERY_DATA:
                    data[0] = (MODBUS_RETURN_QUERY_DATA >> 8) & 0xFF;
                    data[1] = MODBUS_RETURN_QUERY_DATA & 0xFF;
                    data[2] = 0x12; data[3] = 0x34;
                    dataLen = 4;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_DIAGNOSTICS, data, dataLen, &expCode);
                    break;
                case RESTART_COMM1:
                    data[0] = (MODBUS_RESTART_COMM_OPTION >> 8) & 0xFF;
                    data[1] = MODBUS_RESTART_COMM_OPTION & 0xFF;
                    data[2] = 0x00; data[3] = 0x00;
                    dataLen = 4;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_DIAGNOSTICS, data, dataLen, &expCode);
                    break;
                case RET_DIAG_REGISTER:
                    data[0] = (MODBUS_RETURN_DIAG_REG >> 8) & 0xFF;
                    data[1] = MODBUS_RETURN_DIAG_REG & 0xFF;
                    data[2] = 0x00; data[3] = 0x00;
                    dataLen = 4;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_DIAGNOSTICS, data, dataLen, &expCode);
                    break;
                case FORCE_LISTEN_ONLY_MODE:
                    data[0] = (MODBUS_FORCE_LISTEN_ONLY_MODE >> 8) & 0xFF;
                    data[1] = MODBUS_FORCE_LISTEN_ONLY_MODE & 0xFF;
                    data[2] = 0x00; data[3] = 0x00;
                    dataLen = 4;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_DIAGNOSTICS, data, dataLen, &expCode);
                    break;
                case RESTART_COMM2:
                    data[0] = (MODBUS_RESTART_COMM_OPTION >> 8) & 0xFF;
                    data[1] = MODBUS_RESTART_COMM_OPTION & 0xFF;
                    data[2] = 0xFF; data[3] = 0x00;
                    dataLen = 4;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_DIAGNOSTICS, data, dataLen, &expCode);
                    break;
                case BUS_MSG_COUNT:
                    data[0] = (MODBUS_RETURN_BUS_MSG_COUNT >> 8) & 0xFF;
                    data[1] = MODBUS_RETURN_BUS_MSG_COUNT & 0xFF;
                    data[2] = 0x00; data[3] = 0x00;
                    dataLen = 4;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_DIAGNOSTICS, data, dataLen, &expCode);
                    break;
                case BUS_COMM_ERROR_CNT:
                    data[0] = (MODBUS_RETURN_BUS_COMM_ERR_CNT >> 8) & 0xFF;
                    data[1] = MODBUS_RETURN_BUS_COMM_ERR_CNT & 0xFF;
                    data[2] = 0x00; data[3] = 0x00;
                    dataLen = 4;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_DIAGNOSTICS, data, dataLen, &expCode);
                    break;
                /* This will cause error to increase exception count */
                case EXC_READ_COIL1:
                    data[0] = 0x00; data[1] = 0x01; data[2] = 0x00; data[3] = 0x01;
                    dataLen = 4;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_READ_COILS, data, dataLen, &expCode);
                    break;
                case BUS_EXP_ERROR_CNT:
                    data[0] = (MODBUS_RETURN_BUS_EXP_ERR_CNT >> 8) & 0xFF;
                    data[1] = MODBUS_RETURN_BUS_EXP_ERR_CNT & 0xFF;
                    data[2] = 0x00; data[3] = 0x00;
                    dataLen = 4;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_DIAGNOSTICS, data, dataLen, &expCode);
                    break;
                case SRVR_MSG_COUNT:
                    data[0] = (MODBUS_RETURN_SRVR_MSG_CNT >> 8) & 0xFF;
                    data[1] = MODBUS_RETURN_SRVR_MSG_CNT & 0xFF;
                    data[2] = 0x00; data[3] = 0x00;
                    dataLen = 4;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_DIAGNOSTICS, data, dataLen, &expCode);
                    break;
                case SRVR_NO_RSP_CNT:
                    data[0] = (MODBUS_RETURN_SRVR_NO_RSP_CNT >> 8) & 0xFF;
                    data[1] = MODBUS_RETURN_SRVR_NO_RSP_CNT & 0xFF;
                    data[2] = 0x00; data[3] = 0x00;
                    dataLen = 4;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_DIAGNOSTICS, data, dataLen, &expCode);
                    break;
                case SRVR_NAK_CNT:
                    data[0] = (MODBUS_RETURN_SRVR_NAK_CNT >> 8) & 0xFF;
                    data[1] = MODBUS_RETURN_SRVR_NAK_CNT & 0xFF;
                    data[2] = 0x00; data[3] = 0x00;
                    dataLen = 4;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_DIAGNOSTICS, data, dataLen, &expCode);
                    break;
                case SRVR_BUSY_CNT:
                    data[0] = (MODBUS_RETURN_SRVR_BUSY_CNT >> 8) & 0xFF;
                    data[1] = MODBUS_RETURN_SRVR_BUSY_CNT & 0xFF;
                    data[2] = 0x00; data[3] = 0x00;
                    dataLen = 4;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_DIAGNOSTICS, data, dataLen, &expCode);
                    break;
                case BUS_CHR_OVRRN_CNT:
                    data[0] = (MODBUS_RETURN_BUS_CHR_OVRRN_CNT >> 8) & 0xFF;
                    data[1] = MODBUS_RETURN_BUS_CHR_OVRRN_CNT & 0xFF;
                    data[2] = 0x00; data[3] = 0x00;
                    dataLen = 4;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_DIAGNOSTICS, data, dataLen, &expCode);
                    break;
                case CLR_OVRRN_CNTR_AND_FLG:
                    data[0] = (MODBUS_CLR_OVRRN_CNTR_AND_FLG >> 8) & 0xFF;
                    data[1] = MODBUS_CLR_OVRRN_CNTR_AND_FLG & 0xFF;
                    data[2] = 0x00; data[3] = 0x00;
                    dataLen = 4;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_DIAGNOSTICS, data, dataLen, &expCode);
                    break;
                case CLR_CNTR_AND_DIAG_REG:
                    data[0] = (MODBUS_CLR_CNTR_AND_DIAG_REG >> 8) & 0xFF;
                    data[1] = MODBUS_CLR_CNTR_AND_DIAG_REG & 0xFF;
                    data[2] = 0x00; data[3] = 0x00;
                    dataLen = 4;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_DIAGNOSTICS, data, dataLen, &expCode);
                    break;
                case USER_DEFINED_FC:
                    dataLen = 0;
                    Modbus_sendCommand(MODBUS_TARGET_ADDR, MODBUS_USER_DEFINED_FC, data, dataLen, &expCode);
                    break;
                default:
                    modbusTest = WRITE_COIL;
                    break;
            }
            /* Check MODBUS response and indicate result */
            checkResp();
            modbusTest++;
            if (modbusTest >= END_OF_TESTS)
            {
                /* All tests complete: toggle LED forever to indicate completion */
                while (1)
                {
                    DL_GPIO_togglePins(GPIO_LEDS_PORT, GPIO_LEDS_USER_LED_1_PIN);
                    delay_cycles(MODBUS_LED_DELAY_ON_COMPLETE);
                }
            }
            /* Clear data buffer */
            memset(data, 0, MODBUS_MAX_ADU_SIZE);
            /* Delay before next test */
            delay_cycles(MODBUS_LED_DELAY_IN_INST);
        }
    }
    
    /*!
     * @brief Main entry point for MODBUS RTU controller application.
     *        Initializes hardware, sets timers, and runs a sequence of MODBUS controller tests.
     *        Each test sends a MODBUS request and checks the response.
     *        After all tests, the LED toggles in an infinite loop.
     *        Note: User must set baud rate, CPU clock frequency, and timer frequency correctly,
     *        as configured in SysConfig as these values are used to calculate MODBUS timer values.
     */
    int main(void)
    {
        SYSCFG_DL_init();
    
        Modbus_init();
    
        /* Set UART baud rate */
        Modbus_setUartBaudRate(MODBUS_UART_BAUD_RATE);
    
        /* Set timer frequency */
        Modbus_setTimerClkFreq(MODBUS_TIMER_FREQ);
    
        /* Set CPU frequency */
        Modbus_setCpuClkFreq(MODBUS_CPU_CLK_FREQ);
    
        /* Initialize MODBUS controller with timer and UART instances */
        Modbus_configController(MODBUS_TIMER_INST, MODBUS_UART_INST);
    
        /* Set controller turn-around timer */
        Modbus_setControllerTurnAroundTimer(MODBUS_TURNAROUND_TIMER);
    
        /* Set controller response timeout */
        Modbus_setControllerRspTimer(MODBUS_RESPONSE_TIMER);
    
        /* Set controller trials to get response */
        Modbus_setNumberOfTries(MODBUS_NUMBER_OF_TRIES);
    
        /* Enable UART interrupt for MODBUS */
        NVIC_ClearPendingIRQ(MODBUS_UART_INT_IRQ);
        NVIC_EnableIRQ(MODBUS_UART_INT_IRQ);
    
        Modbus_runTests();
    }
    
    /*!
     * @brief UART interrupt handler for MODBUS controller.
     *        Delegates to the MODBUS protocol handler.
     */
    void UART_0_INST_IRQHandler(void)
    {
        Modbus_IRQHandler();
    }
    
    modbus_controller.hmodbus_msp33_compat.h

    modbus_controller_m33.syscfg

    /**
     * These arguments were used when this file was generated. They will be automatically applied on subsequent loads
     * via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments.
     * @cliArgs --device "MSPM33C321X" --part "Default" --package "LQFP-100(PFA)" --product "mspm33_sdk@1.03.00.01"
     * @v2CliArgs --device "MSPM33C321A" --package "LQFP-100(PFA)" --product "mspm33_sdk@1.03.00.01"
     * @versions {"tool":"1.27.1+4634"}
     */
    
    /**
     * Import the modules used in this configuration.
     */
    const GPIO   = scripting.addModule("/ti/driverlib/GPIO", {}, false);
    const GPIO1  = GPIO.addInstance();
    const GPIO2  = GPIO.addInstance();
    const TIMER  = scripting.addModule("/ti/driverlib/TIMER", {}, false);
    const TIMER1 = TIMER.addInstance();
    const UART   = scripting.addModule("/ti/driverlib/UART", {}, false);
    const UART1  = UART.addInstance();
    
    /**
     * Write custom configuration values to the imported modules.
     */
    GPIO1.$name                          = "GPIO_LEDS";
    GPIO1.associatedPins[0].$name        = "USER_LED_1";
    GPIO1.associatedPins[0].assignedPort = "PORTA";
    GPIO1.associatedPins[0].assignedPin  = "0";
    GPIO1.associatedPins[0].initialValue = "SET";
    
    const Board                       = scripting.addModule("/ti/driverlib/Board", {}, false);
    Board.peripheral.$assign          = "DEBUGSS";
    Board.peripheral.swclkPin.$assign = "PA20";
    Board.peripheral.swdioPin.$assign = "PA19";
    
    GPIO2.$name                   = "GPIO_DE_TX";
    GPIO2.associatedPins.create(2);
    GPIO2.associatedPins[0].$name = "TRANSMITTER";
    GPIO2.associatedPins[1].$name = "RECEIVER";
    
    const SYSCTL                 = scripting.addModule("/ti/driverlib/SYSCTL", {}, false);
    SYSCTL.forceDefaultClkConfig = true;
    SYSCTL.peripheral.$assign    = "SYSCTL";
    
    TIMER1.$name       = "TIMER_0";
    TIMER1.timerMode   = "PERIODIC";
    TIMER1.timerClkSrc = "LFCLK";
    TIMER1.timerPeriod = "100ms";
    
    UART1.$name                    = "UART_0";
    UART1.setExtDriverSetup        = 5;
    UART1.setExtDriverHold         = 5;
    UART1.enableFIFO               = true;
    UART1.uartMode                 = "RS485";
    UART1.stopBits                 = "TWO";
    UART1.rxFifoThreshold          = "DL_UART_RX_FIFO_LEVEL_ONE_ENTRY";
    UART1.txFifoThreshold          = "DL_UART_TX_FIFO_LEVEL_3_4_EMPTY";
    UART1.enabledInterrupts        = ["OVERRUN_ERROR","RX"];
    UART1.peripheral.$assign       = "UC13_0";
    UART1.peripheral.rxPin.$assign = "PB9";
    UART1.peripheral.txPin.$assign = "PB8";
    UART1.txPinConfig.$name        = "ti_driverlib_gpio_GPIOPinGeneric0";
    UART1.rxPinConfig.$name        = "ti_driverlib_gpio_GPIOPinGeneric1";
    
    const ProjectConfig              = scripting.addModule("/ti/project_config/ProjectConfig", {}, false);
    ProjectConfig.migrationCondition = true;
    
    /**
     * Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future
     * version of the tool will not impact the pinmux you originally saw.  These lines can be completely deleted in order to
     * re-solve from scratch.
     */
    GPIO1.associatedPins[0].pin.$suggestSolution = "PA0";
    GPIO2.associatedPins[0].pin.$suggestSolution = "PA1";
    GPIO2.associatedPins[1].pin.$suggestSolution = "PA28";
    TIMER1.peripheral.$suggestSolution           = "TIMA0_0";

  • Hi OH,

    I believe this looks good for the configuration. The API's should be pretty similar for the HAL layer. If you have any issues or concerns let me know and I can help debug it.

    If you have the MSPM0G3507 LP you can compare the outputs to see if it's as expected.

  • Hello Erik Vaughn,

    Thank you for your comment. If any problems arise during actual operation, we will contact you again.

    Best regrads,
    O.H