# Why ARM Cortex M0 prints incorrectly Hello World on UART?

I am new to ARM CORTEX M0. I am trying to use the Tx pin of UART as debug port.

If I use the XDS200 debugger to step through the code, I am able to see the characters and I can see "Hello World" printed neatly on the Tera-Term through COM port.

But if I let the microcontroller run by itself I don't see any output and the probe connected on the Tx pin shows constant high.

I think only after using the debugger and stepping through the code the signals appear but not exactly representing "Hello World". Following is the part of output I logged from Tera-Term and this is repetitive:

/***********************************************************/

W

oldo

W

oldo

Hrl

Well WHWelo

WHWelo

WHrld HoHrl WHoell Weold

olrl WHrllo

Welllo

oell  Hrldo

Welo o

oelo o

oelo  Hrl

Welo

/***********************************************************/


Following is the main() function code.

/***********************************************************/

void main(void)

{

Configure_peripheral(); /*This function call initializes all the required interrupts and global variables etc... */

char message[] = "Hello World \n";

char *ptr;

for(;;)

{

ptr = message;

while(*ptr)

{

UART_TX_BUF = (volatile unsigned char)(*ptr);

ptr++;

}

}

}

/***********************************************************/


Following is the UART Interrupt Service Routine code

/***********************************************************/

interrupt void uart_isr(void)

{

if(UART_INTERRUPT_STATUS & UART_TXCOMPLETE_I)

{

/* Clear UART_TXCOMPLETE_I bit */

UART_INTERRUPT_STATUS |= 0x02;

/*As per PGA900 datasheet : TX_COMPLETE is cleared when the UART_TX_BUF is written*/

/* Read UART_LINE_STATUS for errors */

UART_Line_Status = UART_LINE_STATUS;

/* Transmit flag set here */

UART_Flag_Tx = 1;

}

}


Could someone please help me understand what I am missing to get the expected string "Hello World" printed instead of jumbled up text. I am using a USB-Serial transceiver with operating voltage of 0-3.3v. Thanks

• code for(;;) { ptr = message; while(*ptr) { if(UART_LINE_STATUS & TX_COMPLETE) { UART_TX_BUF = (volatile unsigned char)(*ptr); ptr++; } } } code Please take a look at the datasheet ti.com/lit/ds/symlink/pga900.pdf. This processor doesn't have 'Tx buffer empty' or 'Tx fifo not full' bits. I modified the code in main as above .. so I am checking for the TX_COMPLETE bit is set or not in the UART_LINE_STATUS register. But still no output on the Tera-term. Please let me know. Thanks for your help – linuxstack Jul 1 '15 at 20:19