Tool/software: Code Composer Studio
Hi,
I use following code to print in UART-115200 baudrate
#include <stdio.h>
#include <csl.h>
#include <csl_pll.h>
#include <csl_gpio5502.h>
#include <csl_gpio5502dat.h>
#include <csl_gpio5502hal.h>
#include <csl_uart.h>
#include <csl_uarthal.h>
#define STR_LEN 25
char myBuf[24] = "This is simple UART test";
char end[2] = {0x0a,0x0d};
int receive[1];
UART_Setup mySetup = {
30, /* input clock freq */
133, /* baud rate */
UART_WORD8, /* word length */
UART_STOP1, /* stop bits */
UART_DISABLE_PARITY, /* parity */
UART_FIFO_DISABLE, /*DISABLE */
UART_NO_LOOPBACK, /* Loop Back enable */
};
void main()
{
unsigned int i,j;
CSL_init();
PLL_setFreq( 1, // PLL mode
0xF, // Multiply factor, Valid values are (multiply by)10
0, // Sysclk 0 Divide Down
1, // Sysclk1 Divider 150MHz
3, // Sysclk2 Divider 75MHz
3, // Sysclk3 Divider
0); // CLKOUT3(DSP core clock) divider 300MHz
UART_setup(&mySetup);
PGPIOEN0=0x000F;
PGPIODIR0=0x000F;
PGPIODAT0=0x0000;
while(1)
{
UART_write(myBuf,24,0);
PGPIODAT0=0x000F;
for(j=0;j<1000;j++)
for(i=0;i<10000;i++);
PGPIODAT0=0x0000;
for(j=0;j<1000;j++)
for(i=0;i<10000;i++);
}
}
Above Program Always missing First Character 'T' -- Print as his is simple UART testhis is simple UART testhis is simple UART testhis is simple UART testhis is simple UART test
if i am removing for loop delay, i got correct UART print as This is simple UART testThis is simple UART testThis is simple UART testThis is simple UART testThis is simple UART test
Any mistakes in my program.
please help me to out.
Thanks