cancel
Showing results for 
Search instead for 
Did you mean: 

USART RX interrupt not working in stm32 WL package

KCB11
Associate II

Im using a STM32WLE5CCU6 board, I am able to log easily using the APP_LOG() helper function that is provided. The problem is that im not able to receive anything as the USART interrupt never fires hence, 

HAL_UART_RxCpltCallback() is never called. After searching in the web I saw 
https://github.com/STMicroelectronics/STM32CubeWL/issues/34 
facing the same issue, however the fix they have said doesn't work for me. I also tried the changes proposed in 
bug stm32 hal driver lock mechanism is not interrupt safe
and 
https://github.com/STMicroelectronics/STM32CubeWL/issues/32 
Yet none of these solutions make the interrupt work. If I comment HAL_UART_Transmit_DMA(&huart1, p_data, size); in   
UTIL_ADV_TRACE_Status_t vcom_Trace_DMA(uint8_t *p_data, uint16_t size)
{
  /* USER CODE BEGIN vcom_Trace_DMA_1 */
  
  /* USER CODE END vcom_Trace_DMA_1 */
  HAL_UART_Transmit_DMA(&huart1, p_data, size);
  return UTIL_ADV_TRACE_OK;
  /* USER CODE BEGIN vcom_Trace_DMA_2 */

  /* USER CODE END vcom_Trace_DMA_2 */
}

then interrupt starts working but obviously logging will stop. I haven't found a solution which enables me to transmit and receive at the same time. I am attaching the .ioc file for reference. Any help will be really helpful.

This is how I am enabling RX using the helper utilities

void SystemApp_Init(void)
{
  /* USER CODE BEGIN SystemApp_Init_1 */

  /* USER CODE END SystemApp_Init_1 */

  /* Ensure that MSI is wake-up system clock */
  __HAL_RCC_WAKEUPSTOP_CLK_CONFIG(RCC_STOP_WAKEUPCLOCK_MSI);

  /*Initialize timer and RTC*/
  UTIL_TIMER_Init();
  SYS_TimerInitialisedFlag = 1;
  /* Initializes the SW probes pins and the monitor RF pins via Alternate Function */
  DBG_Init();

  /*Initialize the terminal */
  UTIL_ADV_TRACE_Init();
  UTIL_ADV_TRACE_RegisterTimeStampFunction(TimestampNow);

  /*Set verbose LEVEL*/
  UTIL_ADV_TRACE_SetVerboseLevel(VERBOSE_LEVEL);

  /*Init low power manager*/
  UTIL_LPM_Init();
  /* Disable Stand-by mode */
  UTIL_LPM_SetOffMode((1 << CFG_LPM_APPLI_Id), UTIL_LPM_DISABLE);

#if defined (LOW_POWER_DISABLE) && (LOW_POWER_DISABLE == 1)
  /* Disable Stop Mode */
  UTIL_LPM_SetStopMode((1 << CFG_LPM_APPLI_Id), UTIL_LPM_DISABLE);
#elif !defined (LOW_POWER_DISABLE)
#error LOW_POWER_DISABLE not defined
#endif /* LOW_POWER_DISABLE */

  /* USER CODE BEGIN SystemApp_Init_2 */
  UTIL_ADV_TRACE_StartRxProcess(NULL);
  /* USER CODE END SystemApp_Init_2 */
}

Also simple python code which sends single character and makes the LED toggle to check RX

void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
  /* USER CODE BEGIN HAL_UART_RxCpltCallback_1 */
  HAL_GPIO_TogglePin(LED3_GPIO_Port, LED3_Pin);
  /* USER CODE END HAL_UART_RxCpltCallback_1 */
  if (huart->Instance == USART1)
   {
     if ((NULL != RxCpltCallback) && (HAL_UART_ERROR_NONE == huart->ErrorCode))
     {
       RxCpltCallback(&charRx, 1, 0);
     }
     HAL_UART_Receive_IT(huart, &charRx, 1);
   }
  /* USER CODE BEGIN HAL_UART_RxCpltCallback_2 */

  /* USER CODE END HAL_UART_RxCpltCallback_2 */
}

TLDR: USART TX and RX work individually, doesn't work simultaneously when using helper functions provided by STM32 WL package

0 REPLIES 0