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.

LAUNCHXL2-RM57L: Trouble Communicating Between Microcontroller and Touchscreen

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

Hello,

I am having trouble sending messages from the microcontroller to a touchscreen. What's supposed to happen is, I send a message to the touchscreen such as "co2_level=100\r", and the touchscreen is supposed to decode the message and change the value to 100 (or whatever else I send it). Here's a picture of how the communication looks (the SIO/serial part is what I'm having trouble with):

https://i.imgur.com/RbIpzs0.png

The issue I'm having is, sending one message to the touchscreen works perfectly fine (it changes its value), but sending consecutive messages does not work properly. Here are some debugging logs I see from the touchscreen:

[SIO] received => "co2_level=100^J"
[SIO] sending => "co2_level=100^J"
[TIO] received => "co2_level=100"; from sio-agent
[TIO] found key => "co2_level="; returning => "co2_input.text=%s"
[TIO] sending => "co2_input.text=100"
[TIO] sending => "^J"
[QML] message available on socket
[QML] item available: "co2_input" "text" "100"
[SIO] received => ""
[SIO] sending => ""

As you can see, the next message I send is shown as an empty string "". I'm not sure why sending consecutive messages shows up as an empty string, like the message is getting dropped.

I'm using the SCI module (sciREG3 specifically). Here are some things I made sure of:

1) The TX pin from the microcontroller is connected to the RX pin of the touchscreen

2) sciREG3 driver is enabled, and the peripheral is enabled as well in Halcogen

3) The baud rate is the same between the microcontroller and touchscreen (I even changed them to different values and I get the same problem), as well as the number of stop bits, data bits, and parity/flow control.

4) I'm allowing sufficient time between each send. I have a (for i = 0; i < 1000000; ++i) between each send

One weird thing to note: when I send messages to the touchscreen via a terminal instead of the microcontroller, I have no issues. Consecutive messages get sent perfectly fine and no messages get dropped. This leads me to believe there's something wrong with the microcontroller. Tech support from the touchscreen company also agree.

Here's a snippet of my code:

uint8_t msg1[] = "co2_level=100\r";
uint8_t msg2[] = "co2_level=200\r";
int i = 0;

int main(void)
{
/* USER CODE BEGIN (3) */
sciInit();

for (i = 0; i < 1000000; ++i);

sciSend(sciREG3, sizeof(msg1), msg1);

for (i = 0; i < 1000000; ++i);

sciSend(sciREG3, sizeof(msg2), msg2);

while (1);
/* USER CODE END */

return 0;
}

Here's a zip file of my project:

6521.touchscreen.zip

  • Hello,

    What I can suggest is to connect MCUs UART to oscilloscope or  to a console and see what is transferred  by MCU.

    Since i am not aware what is the "sufficient time between each send", you could add a breakpoint after first command to ensure there is enough delay between two commands (or you can increase delay).

    Best regards,
    Miro

  • Hello,

    Do you have progress with this issue?

    Best regards,
    Miro

  • Hello,

    Sorry for the lack of responses. I was out all week.

    I don't have an oscilloscope I can use, but I do have a logic analyzer I can use instead.

    I'll be trying this out later, and will update you.

  • The issue was that sending "co2_level=100\r" was actually sending "co2_level=100\r\0" since char arrays are null terminated...

    The fix was to just simply change the second parameter of the sciSend function from sizeof(msg1) to sizeof(msg1) - 1

    Thank you for the oscilloscope suggestion.