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.

CCS/LAUNCHXL2-RM57L: UART communication with external device

Part Number: LAUNCHXL2-RM57L
Other Parts Discussed in Thread: HALCOGEN

Tool/software: Code Composer Studio

Hello,

I am trying to connect a CO2 sensor (an external device) to the Hercules MCU board. I connect both devices as they are supposed to, based on each device's schematic; however, after writing the code I do not know how to see if any information has been transferred between these two devices. I was wondering if someone could tell me how to test this and see the results of the interaction between both devices. Also, for anybody to check my code, and tell me a list of steps that I should follow when setting up HALCoGen (I want to ensure that I did it correctly). I am using SCI3. I have pasted my code below and already seen the training for UART using SCI communication multiple times and it is not too helpful. Thank you in advance.

int main(void)

{

/* USER CODE BEGIN (3) */

    //Enables interrupts

    _enable_IRQ();

    //Initializes SCI

    sciInit();

    //Sets up CO2 sensor to streaming mode (commands are processed when received and measurements are recorded constantly)

    sciSend(sciREG3, 8, (unsigned char *)"K 1\r\n"); // the Strings refers to commands that I have to send to the CO2 sensor to set it up correctly

    //Sets up CO2 sensor to send digitally filtered CO2 readings

    sciSend(sciREG3, 8,  (unsigned char *)"Z\r\n"); 

    //Returns the most recent CO2 measurement

    sciReceive(sciREG3, 8, rxBuffer);

    while(1);

/* USER CODE END */

    return 0;

}

/* USER CODE BEGIN (4) */

void sciNotification(sciBASE_t *sci, unsigned flags)

{

    //Received character

    sciSend(sci, 1, rxBuffer);

    //Awaits next character

    sciReceive(sci, 1, rxBuffer);

}

/* USER CODE END */

  • Hello,
    First, you need to configure SCI module in HALCoGen.
    In Driver Enable Tab appropriate SCI driver must be enabled (SCI1...SCI4).
    Pins must be set to be in functional mode (not GIO) in SCI Port tab. If you want to use interrupt method, RX interrupt must be enabled (SCI Global Tab) as well in VIM module appropriate channel must be enabled (VIM Channel Tabs). Finally, in main function MCU interrupts and SCI notification must be enabled. Baud rate data format must be same as other device (SCI Data Format Tab).

    In this thread:
    e2e.ti.com/.../2771256
    both HALCoGen and CCS projects are attached. You can find there some ideas how to set device.

    Data received/sent could be probed using oscilloscope. Also debugging with CCS and onboard JTAG emulator is possible. You could watch all needed buffers/registers/variables an so on...

    Best regards,
    Miro