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.

SCI communication problems

Other Parts Discussed in Thread: HALCOGEN

For a project i need the sci communication.
I am using the LaunchpadXL2 570LC43 so the TMS570LC43x from TI. So i use Halcogen and CCS for the programming (and TeraTerm so far).

i want to send some data over the sci(uart) connection to a LTE Module. for this i made struct in a header file TransUart.h where i have a basis of how long my field is what i want to send, which channel (i.e. channel 1 = LED, Channel 2 = temp sensor etc.) is selected for data, and which ID (in led example which LED i mean) and command (ON/ OFF) is behind it. basically just data i want to send from a to b over uart and then into the internet.

For this i devided my communication in 4 parts. 1) writing from uC to laptop , 2) uC reading from laptop, 3.) Lte module writing to laptop and 4.) lte module reading from laptop.

What i already achieved:
1) i can send helloworld over sci to Teraterm using the usb TTL converter Cp2102. Here i need maybe little help how i can send my struct to the teraterm.


what i need:
i need a function how the uC can read bytes. and also a hint how i can be sure the microcontroller read it (like a print or something just that i see ok it was successfully read).

it would be great if somebody can give me hints how to make the struct to teraterm and give me ideas how to make the reading from sci.

i am getting really desperate since i have to make this project on time (end of september) and it is the first part in the chain.
i will attach my code so far. so please also look in halcogen (since i am programming beginner) if there is everything correct for the communication.

regards,

Markus

8838.Test.zip

  • Hello Markus,
    I'm not clear on your question as to have a function to read bytes. You can use sciReceiveByte() or sciReceive() to read data that you input in the teraterm into the UC.
  • Hi charles,

    yes i want that the TI controller can also (as you said in the other thread with the telit module) receive data from the telit module. So i want to simulate that the TI controller is receiving some data from my laptop.
    How can i simulate it?
    I mean with the given halcogen example i can display the bytes in teraterm using sciSendByte(). But how can i be sure the other way around with sciReceiveByte() is working and how can i simulate it? (i mean to see somewhere something like a text or LED blinking by receiving a byte)

    Because i somehow have to send something from the laptop to the com interface and the uC has to read from it or do i think wrong?

    PS:
    and when i want to receive bytes and i dont want that it wait for the end i also have to use sciIsRxReady right?
    if(sciIsRxReady(sciREG3)){       
                sciReceive(sciREG3, 21, (unsigned char *) "Please press a key!\r\n");
      }

    PPS: basically i need some hints (or example code) how to ensure that this is a way the communication with the MCU and to the MCU is working over sci.
    (the first was to send a string via sciSendByte to teraterm and show the string).


    regards


    Markus

  • Hi Markus,
    I didn't use TeraTerm before but I think it should be the same as other terminals. Can not not type something in TeraTerm so that the UC will receive it. When the uC receives the data you can then blink the LED by toggling some LED.
  • Hello Charles,
    thx your two answer made it working now. With hTerm and sciReceiveByte().

    for all others:
    to check if you receive something with your uC just make the following routine in the while(1) loop:

    if(sciIsRxReady(sciREG3)){ //if something is in the receive buffer
    send = sciReceiveByte(sciREG3);
    sciSendByte(sciREG3, send);
    }

    You should check the com port in your laptop where to connect with hTerm. set baudrate to 9600 and press connect.
    in The middle of the programme there is a field where you can type in some words/bytes/hex doesnt matter. then press enter for sending for example "Hello world".

    it will go into the sequence above and sciIsRxReady() checks if there is something in the buffer. sciReceiveByte() will get the byte from "hello world".
    In the end that you can see what the uC received you just send it via sciSendByte() back to hTerm and there should be then written "hello World" in the received Data window.

    thx charles for this help!


    Last questio:
    If you look into my code (in the TransUart.h file) how can i post now some kind of struct to the interface?
    can you help me with this?

    regards,

    Markus