Hello,
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
Ray.
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); }
Problem solved. Used the SendBlock function.
Thanks for all the help..
Okay I have found the cause. Jumpers J111 and J112 were not set correctly, and the wrong clock source was selected.
I still have a problem. I am not receiving the full number of bytes. Only getting the first one or two. The same code worked with AVR, so do not understand why.
Ray.