2008-10-01 12:42 AM
2008-09-28 09:08 PM
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 ]2008-10-01 12:42 AM
I found the solution.
I have included the wrong library...