AnsweredAssumed Answered

stm32F4xx - UART - IT - stay enable!

Question asked by yoann LBY on Feb 19, 2018

hi,

 

stm32F4xx configured with 2 uart(uart1 and uart2) with DMA and uart (UART_IT_IDLE).

Sometime, i have a issue regarding the status of uart2 IT stay enable.

when i receive message on uart2, fct HAL_UART_IdleCallback is called. i process bufferRx. USART2_IRQn is call and clear flag (normal processing) but sometime IT uart 2 don't detect message and when i check NVIC (in debug with keil) i see USART2 global interrupt stay enable.

 

for the moment i put HAL_UART_Receive_DMA() at the end of function processing the Rx buffer (try to fix this issue) 

what is the good solution when flag enable stay 1.(double check? reset uart2) To avoid it?

 

other way : how to set HAL_NVIC_SetPriority correctly with uart1, uart2, DMA1 rx,tx, DMA2 rx tx a,d Timx?

 

/*##-4- Configure the NVIC for DMA #########################################*/
  /* NVIC configuration for DMA transfer complete interrupt (USART1_TX) */
  HAL_NVIC_SetPriority(WIFI_USART_DMA_TX_IRQn, 1, 1);
  HAL_NVIC_EnableIRQ(WIFI_USART_DMA_TX_IRQn);
  /* NVIC configuration for DMA transfer complete interrupt (USART1_RX) */
  HAL_NVIC_SetPriority(WIFI_USART_DMA_RX_IRQn, 1, 1);
  HAL_NVIC_EnableIRQ(WIFI_USART_DMA_RX_IRQn);

/*##-3- Configure the NVIC for UART ########################################*/
  /* NVIC for USART */
  HAL_NVIC_SetPriority(USARTx_IRQn, 0, 0);
  HAL_NVIC_EnableIRQ(USARTx_IRQn);

 

/*##-4- Configure the NVIC for DMA #########################################*/
  /* NVIC configuration for DMA transfer complete interrupt (USART2_TX) */
  HAL_NVIC_SetPriority(USARTx_PRINT_MSG_DMA_TX_IRQn, 2, 1);
  HAL_NVIC_EnableIRQ(USARTx_PRINT_MSG_DMA_RX_IRQn);
   
  /* NVIC configuration for DMA transfer complete interrupt (USART2_RX) */
  HAL_NVIC_SetPriority(USARTx_PRINT_MSG_DMA_RX_IRQn, 2, 1);
  HAL_NVIC_EnableIRQ(USARTx_PRINT_MSG_DMA_RX_IRQn);
 
  /*##-3- Configure the NVIC for UART ########################################*/
  /* NVIC for USART */
  HAL_NVIC_SetPriority(USARTx_PRINT_IRQn, 0, 1);  // 0,0
  HAL_NVIC_EnableIRQ(USARTx_PRINT_IRQn);

 

/*##-2- Configure the NVIC for TIMx ########################################*/
    /* Set the TIMx priority */
    HAL_NVIC_SetPriority(TIMx_IRQn, 3, 0);

 

Thnaks

Yoann

Outcomes