Ray Hall

Serial Communications not working correctly

Discussion created by Ray Hall on Mar 27, 2011
Latest reply on Mar 29, 2011 by Ray Hall



I am new to Freescale products, and have been using Atmel AVR in the past. I have
the EVB9S12XEP100 and trying to lean how things are done. I used Processor Expert
to create the  code for the serial communications. The code below does send data, but
all I get is garbage. Baud rate for code and terminal software are the same.

This is all the code TestComms.zip


const uint8_t okay[6] = {0x24,0x4F,0x6B,0x61,0x79,0x7E};   // "$Okay~"//------------------------ Delay ------------------------------static void delay(void) {  volatile unsigned long i;  for(i=0;i<50000;i++);}//---------------------- USART TxString -----------------------void USART_TxString(const uint8_t StringPtr[], uint16_t len){   while (len--) // send len bytes   {      if (AS1_SendChar(*StringPtr) == ERR_OK){                     StringPtr++;      }   }}//------------------------- Main ------------------------------------void main(void){   PE_low_level_init();    for(;;){       delay();      USART_TxString(okay, 6);         }