cancel
Showing results for 
Search instead for 
Did you mean: 

UART0 send but dont receive

ricardo2399
Associate II
Posted on September 19, 2008 at 10:43

UART0 send but dont receive

1 REPLY 1
ricardo2399
Associate II
Posted on May 17, 2011 at 09:55

Hi

My UART0 is sending very well, but it cant receive nothing! :|

Can anyone give a tip please?

Thanks

:o

here is the code:

UART_InitTypeDef st_UART0;

GPIO_InitTypeDef GPIO_InitStructure, GPIO_InitStructure2;

/* Enable the GPIO3 Clock */

SCU_APBPeriphClockConfig( __GPIO3, ENABLE );

SCU_APBPeriphReset(__GPIO3, DISABLE);

SCU_APBPeriphClockConfig( __GPIO5, ENABLE );

SCU_APBPeriphReset(__GPIO5, DISABLE);

SCU_APBPeriphClockConfig(__UART0, ENABLE);

SCU_APBPeriphReset(__UART0, DISABLE);

/* Configure UART1_Rx pin GPIO5.1 */

GPIO_InitStructure.GPIO_Direction = GPIO_PinInput;

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;

GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ;

//GPIO_InitStructure.GPIO_IPConnected = GPIO_IPConnected_Enable;

GPIO_InitStructure.GPIO_Alternate = GPIO_InputAlt1;

GPIO_Init( GPIO5, &GPIO_InitStructure);

/* Configure UART1_Tx pin GPIO3.4 */

GPIO_InitStructure2.GPIO_Direction = GPIO_PinOutput;

GPIO_InitStructure2.GPIO_Pin = GPIO_Pin_4;

GPIO_InitStructure2.GPIO_Type = GPIO_Type_PushPull ;

GPIO_InitStructure2.GPIO_IPConnected = GPIO_IPConnected_Enable;

GPIO_InitStructure2.GPIO_Alternate = GPIO_OutputAlt3;

GPIO_Init( GPIO3, &GPIO_InitStructure2 );

UART_DeInit(UART0);

st_UART0.UART_WordLength = UART_WordLength_8D;

st_UART0.UART_StopBits = UART_StopBits_1;

st_UART0.UART_Parity = UART_Parity_Odd ;

st_UART0.UART_BaudRate =115200;

st_UART0.UART_HardwareFlowControl = UART_HardwareFlowControl_None;

st_UART0.UART_Mode = UART_Mode_Tx_Rx;

st_UART0.UART_FIFO = UART_FIFO_Disable;

// st_UART0.UART_TxFIFOLevel = UART_FIFOLevel_1_2;

//st_UART0.UART_RxFIFOLevel = UART_FIFOLevel_1_2;

UART0->ICR = 0x3ff; // CLEAR_ALL_INTERRUPTS

UART_ITConfig(UART0, 0x10, ENABLE);/// just RXIM its 0x10

UART_LoopBackConfig(UART0, DISABLE);

UART_IrDACmd(IrDA0, DISABLE);

UART_Init(UART0, &st_UART0);

UART_Cmd(UART0, ENABLE);

VIC_Config(UART0_ITLine, VIC_IRQ, 10);

VIC_ITCmd(UART0_ITLine, ENABLE);