cancel
Showing results for 
Search instead for 
Did you mean: 

I am trying to read UART and to hold on rx_data array. when I send "AT" to rf module it returns "OK" , but on my code I cannot receive anything from UART. and help appreciated

TPiri.1
Associate II

uint8_t tx_data[2] = "AT";

 uint8_t rx_data[10];

 HAL_Delay(1000);

 while (1)

 {

 HAL_UART_Transmit (&huart1, tx_data, sizeof(rx_data) , 250);

 HAL_Delay(500);

 HAL_UART_Receive(&huart1,rx_data, 20,1000);

 HAL_GPIO_TogglePin (GPIOA, LED_Pin);

 HAL_Delay(500);

}

37 REPLIES 37

It help me. i was also looking for same problem but got it here.

shorted UART pins ...

yes I shorted RX pin to TX, should receive what sent from tx, but I only receive first letter

0693W00000HprQCQAZ.png

Maybe you dont understand signals in time .

You can only receive signal when exist. Your call to receive signals is too late.

When you need receive what you tx you must start receive IT on background before call tx.

Next what you need understand is hw FIFOs usw...

same code works on L476 MCU, this issue happens only on L072 mcu

L476 have hw FIFO buffer , then can receive more as one byte ...

Ahh,

how can I solve this issue?