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.

Energia Serial.print in debug

Other Parts Discussed in Thread: TM4C123GH6PM, ENERGIA

I have just started using Energia and I am quite impressed with it.  I am using CCS Version  6.0.1.00040  and Energia 0101E0013. I am using a tm4c123gh6pm as my target.  I have been trying to use Serial.print and all I get is jiberish.  The program is the modified Multiserial in the Energia example under communications.  I modified the program to the following:

#include "Energia.h"


void setup();
void loop();


void setup() {
// initialize serial ports:
Serial.begin(9600);

}

void loop() {
// read from port 0, send to port 0:
if (Serial.available()) {
int inByte = Serial.read();
delay(100);
Serial.write(inByte);
}
}

I know the program says Serial.write, but after two days I have tried Serial.print() and Serial.println() with the same results.  After two days of working with this I have discovered that it works fine if you download the binary to the target and run the program outside the debugger.  I would like to use a simple Serial.println to output data during debugging.

Does anyone know how to get it to work when debugging?

  • Hello Donald,

    Irrespective of the platform there are two things that need to be done from TM4C perspective

    1. The GPIO need to be configured for the UART function to be available on the IO

    2. The UART needs to be configured to the correct clock and baud settings

    Can you use the Data Sheet of the TM4C123 to see if the UART is configured for the baud rate and word length and for the UART Instance being used, are the corresponding GPIO's been configured for UART TX and RX.

    Since I do not know which UART instance is being used it is rather tough to give any more details. Awaiting your response.

    Regards

    Amit

  • If the settings weren't correct it wouldn't work with just the binary loaded.  It works great if you disconnect the debugger, but shouldn't it work with the debugger?

  • Hello Donald,

    OK, my mistake. I read it as the standard bin file works. It may be worthwhile to check the settings. Normally, what I would do if the UART is well configured, is to type the hexadecimal value of a know character directly to see if the UART is printing it out, with the debugger connected.

    Regards

    Amit

  • Donald Varela said:
    Serial.print and all I get is jiberish

    Did you set your PC serial console(e.g. Tera Term, Putty) with the correct COM Port and Baud Rate?

    - kel

  • I don't think you are understanding the problem.  If I hit debug on the CCS and download the file to the launchpad it doesn't matter if I use Putty, teraterm or the built in terminal it will print garbage.  If I kill debugging and unplug the launchpad and then plug it back in and connect up with the terminal it works great.

  • Hello Donald,

    I understand the issue completely. Since we do not have the same debug setup as you have, it would be worthwhile to first get the information as asked earlier. In the meantime we can see with energia if there is a know documentation on such a behavior.

    In summary

    1. Set up the device as done by Energia under debug control and bring it to the first print statement

    2. Write 0x32 via the debugger to the UARTDR and see if the terminal responds.

    3. If not, reset the terminal and then check again.

    Regards

    Amit