STM32WB5MMG UART receive interrupt doesn't work
I'm using a STM32WB5MMG chip and I'm trying to receive data with the HAL_UART_Receive_IT() function. But for some reason the HAL_UART_RxCpltCallback function never gets called. Receiving data with blocking mode works, but with an interrupt it doesn't want to work
I have enabled the global interrrupt of the USART with CubeMX and I still see that the box is checked.
The code I have written should wait until it receives 4 bytes, then echo those bytes back and start waiting again.
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
HAL_UART_Transmit(&huart1, rxBuffer, 4, 100);
HAL_UART_Receive_IT(&huart1, rxBuffer, 4);
}
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* Configure the peripherals common clocks */
PeriphCommonClock_Config();
/* IPCC initialisation */
MX_IPCC_Init();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_I2C1_Init();
MX_USART1_UART_Init();
/* USER CODE BEGIN 2 */
int error = HAL_UART_Receive_IT(&huart1, rxBuffer, 4);
if(error != HAL_OK){
while(1);
}
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
}
}I'm not really experienced with stm32 chips and CubeIDE, so I don't know if I have forgotten something.
