cancel
Showing results for 
Search instead for 
Did you mean: 

UART communications problem.

daniel7
Associate II
Posted on October 01, 2008 at 09:42

UART communications problem.

2 REPLIES 2
daniel7
Associate II
Posted on September 29, 2008 at 06:08

UART communications problem.

Hi.

I have a little strange problem with my STR750 evaluation board. I have connected the UART0 with a null modem to my computer. Made a simple code for sending data through UART but after a few ms I can’t receive anything but zeroes on my computer.

My code:

int main()

{

#ifdef DEBUG

debug();

#endif

/* Configure the system clocks */

MRCC_Configuration();

/* Configure the GPIO ports */

GPIO_Configuration();

/* UART0 configuration ----*/

UART_InitStructure.UART_WordLength = UART_WordLength_8D;

UART_InitStructure.UART_StopBits = UART_StopBits_1;

UART_InitStructure.UART_Parity = UART_Parity_No;

UART_InitStructure.UART_BaudRate = 9600;

UART_InitStructure.UART_HardwareFlowControl = UART_HardwareFlowControl_CTS;

UART_InitStructure.UART_Mode = UART_Mode_Tx_Rx;

UART_InitStructure.UART_FIFO = UART_FIFO_Enable;

UART_InitStructure.UART_TxFIFOLevel = UART_FIFOLevel_1_2; /* FIFO size 16 bytes, FIFO level 8 bytes */

UART_InitStructure.UART_RxFIFOLevel = UART_FIFOLevel_1_2; /* FIFO size 16 bytes, FIFO level 8 bytes */

UART_Init(UART0, &UART_InitStructure);

UART_Cmd(UART0, ENABLE);

//Send 0x44

SendData(0x44);

while(1){

if (!GPIO_ReadBit(GPIO1, GPIO_Pin_5)) { //If button down

//Send data

SendData(0x55);

delays(100000);

}

}

}

//Send function:

void SendData(u8 Data){

UART_SendData(UART0, Data);

while(UART_GetFlagStatus(UART0, UART_FLAG_TxFIFOFull) != RESET);

}

Can anyone see what’s wrong?

I’m using Keil µVision, and have tried some examples but with same outcome.

[ This message was edited by: daniel1 on 29-09-2008 09:41 ]

daniel7
Associate II
Posted on October 01, 2008 at 09:42

I found the solution.

I have included the wrong library...