cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with HAL_UART_Receive

antonioB
Associate II
Posted on November 03, 2016 at 13:58

hi to all i have this problem, i use STM32L152RE and a SIM900 GSM/GPRS Module,

now if i send the  data with

 HAL_UART_Transmit(&huart1,command_AT,sizeof(command_AT),1000);

all work well, but i wont t

receive the data, i have the problem because i don't know

the data that gsm send me. i write this  function but it's don't work:

uint8_t risposta[100];

void usart_get_string()

{

   

    while(__HAL_UART_GET_FLAG(&huart1,UART_FLAG_RXNE)==0){};

 for(int kk=0;kk<100;kk++){

     HAL_UART_Receive(&huart1,&risposta[kk],1,0xffff);

 HAL_Delay(1000);

          } ;

 

}

 i don't see nothing in array risposta,  can you help me?

best regards.

A. 

#stm32 #hal #uart
2 REPLIES 2
slimen
Senior
Posted on November 03, 2016 at 15:25

Hi,

I suggest that you run and test the UART example under STM32CubeL1 firmware package relevant to the device that you are using: 

\STM32Cube_FW_L1_V1.6.0\Projects\STM32L152RE-Nucleo\Examples\UART

You may re-use sections available in the example or get inspired from them.

Regards

antonioB
Associate II
Posted on November 06, 2016 at 19:49

Hi thanks for your response i see this

if(HAL_UART_Receive(&UartHandle, (uint8_t *)aRxBuffer, RXBUFFERSIZE, 5000) != HAL_OK)

  {

    Error_Handler();  

  }

don't like this because i  intercept the error do you give me other example that  i see?

best regards

A.