This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430I2040: COM port (serial port) not working after modifying EMDC code

Part Number: MSP430I2040
Other Parts Discussed in Thread: MSP430F5529, , MSP-ISO, EVM430-I2040S, MSP-FET

Hi,

I have connected the MSP430I2040S EVM to the Isolation board and that to the HID bridge(MSP430F5529).

I tried and was able to use the EMDC GUI to see the Voltage, Current values..

Then, I modified the code and added a small piece of code to write to the serial port:

void EMLibGUIApp_Engine(void)
{

/* Start Energy Measurement -- Main loop */
while(1)
{
Comm_writeBuffer("GOT_IT", 7);

// EM Lib Foreground process
EM_foregroundProc(&gemResultStatus);

HMI_stateMachine(gemResultStatus);
}
}

I have also modified the code to change the COM port protocol. (Just an FYI)

The Comm_writeBuffer is not working and I am not able to get any print on the Putty(Terminal) on my laptop. I have connected the putty  on my Laptop to baudrate of 9600, N, 8, 1. I also tried with baudrate 115200, N, 8, 1.  However I am not getting any prints on my laptop(putty).

I checked and I have done COM-setup:

void HMI_Init(void)
{
// Initializes command handler for communication with GUI
CommandHandler_setApplicationVersion(
COMMAND_HANDLER_DEVICE_TYPE_i2041,
COMMAND_HANDLER_FIRMWARE_ID_0001);

// Initialize communications
Comm_setup();
// CommandHandler_registerCmdListeners();
DC_User_Params = CommandHandler_getUserParamsPtr();
gHMI = HMI_STATE_IDLE;
#ifdef ENABLE_LCD
results_Reset(LPH);
#endif
}

I am using the COM port9 at my laptop end. I have also tried COM8 which is the Debug port but neither shows any prints.

Can you please tell me what is the mistake I am making.

thanks and regards,

Rajkumar

  • Hello,

    Before making any changes to the UART baud rate, I would make sure the communication works at the default 250-kbaud rate. Also, don't use the USB HID bridge with a terminal. If you want to send and receive that way, you can disconnect the isolation board and the HID board and just connect to the onboard isolated RS232 port. You'll need a USB-to-RS232 adapter, which is a CDC USB device, that should show up under Windows Device Manager as a COM port.

  • Hi James,

    I am still facing the issue.

    I tried using the RS232 interface but nothing is coming on the serial terminal on the laptop.

    I tried using the example, UART echo program and tried using the MSP430I2040 to MSP-ISO to MSP430F5529(HID bridge). Here I did not use the system_pre_init() in my program.

    On the laptop I used realterm. With 9600 baudrate, I am seeing that whenever I transmit something from the PC, I get back some echo on the terminal but it appears to be some other characters. However the same characters keep getting echo' d back whenever I try to send a character. The printed set of characters is always the same.

    Is there something wrong in what I am doing in the 2 projects.

    I finally need to get the EMDC up because it has the energy values. Please let me know where I could be going wrong in both the projects.

    Please help.

    regards,

    Rajkumar

  • Hi James,

    Can you please give some pointers. I have a deadline coming up. Thanks.

    regards,

    Rajkumar

  • Hello,

    You have two threads going at the same time with slightly different topics. Let's focus on the other one for now.

    MSP430I2040: EMDC showing blank values under Results

  • Hi James,

    Can we look at this thread for now. Thanks.

    An update: I tried the UART echo program which echoes back the character on the Tx line. This is supposesd to run at (9600, N, 8, 1) baud rate.

    But when I tried this program, I am getting some other characters on the COM port of the laptop. When I send 'a' I get back some other character.

    (I am using the DB9 connector with a USB to serial cable to connect to the PC.)

    Can you tell me what could be going wrong?

    This is the UART echo program:

    ************************************************************************************************

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    #include "msp430.h"
    void main(void) {
    WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
    P1SEL0 |= BIT2 | BIT3; // P1.2/3 eUSCI_A Function
    P1SEL1 &= ~(BIT2 | BIT3);
    UCA0CTL1 |= UCSWRST; // Hold eUSCI in reset
    UCA0CTL1 |= UCSSEL_2; // SMCLK
    UCA0BR0 = 0xAA; // 9600 baud
    UCA0BR1 = 0x06;
    UCA0MCTLW = 0xD600; // 16.384MHz/9600 = 1706.6667 (See UG)
    UCA0CTL1 &= ~UCSWRST; // Release from reset
    UCA0IE |= UCRXIE; // Enable RX interrupt
    __bis_SR_register(LPM0_bits | GIE); // Enter LPM0
    __no_operation(); // For debugger
    UCA0TXBUF='H';
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    *********************************************************************************************************************

    thanks and regards,

    Rajkumar

  • When posting code, please use the Insert > Code > C option for better readability. I've updated your latest reply accordingly.

    I used the msp430i20xx_euscia0_uart_01.c code example on my EVM430-i2040S, and it worked fine. After programming the EVM in CCS, I stopped the debug session and power cycled the board. Then, I connected my RS232-to-USB adapter to my PC and the EVM's RS232 port. After opening a terminal for that adapter's COM port and setting the baud rate, anything I typed showed up in the terminal as an echo.

    Make sure J8 is set to 1-2 when using the MSP-FET as the power source. Make sure you select the right COM port.

**Attention** This is a public forum