2019-10-03 05:12 AM
Hello,
Target : NUCLEO-L432KC board
IDE : STM32Cube IDE
OS : Windows
I want to get information from a GPS chip with an UART communication (TX/RX). It works when I use non-interrupt mode with HAL_UART_Receive function form HAL library.
However I want to optimize the code using the function HAL_UART_Receive_IT from HAL library. For now it is not working.
My UART configuration is here :
I only added this code to the generated main.c :
/* USER CODE BEGIN 0 */
uint8_t rx_buff[20];
/* USER CODE END 0 */
and
/* USER CODE BEGIN 2 */
HAL_UART_Receive_IT (&huart1, rx_buff, 20);
/* USER CODE END 2 */
and
/* USER CODE BEGIN 4 */
void HAL_UART_RxCplt_Callback(UART_HandleTypeDef * huart)
{
__NOP();
}
void HAL_UART_TxCplt_Callback(UART_HandleTypeDef * huart)
{
__NOP();
}
/* USER CODE END 4 */
Then I compiled the code, and I expected to see parts of the data form the GPS in my rx_buff variable. But there is no data in this variable according to the "live expression" debugging tool.
Do you have any idea why it doesn't work ?
Best regards,
Valentin Gros
2019-10-07 06:18 AM
Hello umesh_patil,
Thanks for your help.
/* USER CODE BEGIN 4 */
void HAL_UART_RxCplt_Callback(UART_HandleTypeDef * huart)
{
int i;
// I copy the buffer in an other variable (tab int)
for(i = 0; i<20;i++){
tabInt[i] = rx_buff[i];
}
}
Here I copy my rx buffer in an another table of integers. Both rx_buff and tabInt stay empty.