Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
126 views
in Technique[技术] by (71.8m points)

c++ - STM32L4 Rx interrupt: not working without debugging error

I am having trouble while trying Rx interrupt using stm32l476-disco. There was no debugging error, but it didn't work. (cf: Tx is working)

I was following same process that using "STM32F4".

The following code is my stml4xx_hal_uart.c code.


    void HAL_UART_IRQHandler(UART_HandleTypeDef *huart)
    {
      uint32_t isrflags   = READ_REG(huart->Instance->ISR);
      uint32_t cr1its     = READ_REG(huart->Instance->CR1);
      uint32_t cr3its     = READ_REG(huart->Instance->CR3);
    
      uint32_t errorflags;
      uint32_t errorcode;
    
      /* If no error occurs */
      errorflags = (isrflags & (uint32_t)(USART_ISR_PE | USART_ISR_FE | USART_ISR_ORE | USART_ISR_NE | USART_ISR_RTOF));
      if (errorflags == 0U)
      {
        /* UART in mode Receiver ---------------------------------------------------*/
    #if defined(USART_CR1_FIFOEN)
        if (((isrflags & USART_ISR_RXNE_RXFNE) != 0U)
            && (((cr1its & USART_CR1_RXNEIE_RXFNEIE) != 0U)
                || ((cr3its & USART_CR3_RXFTIE) != 0U)))
    #else
        if (((isrflags & USART_ISR_RXNE) != 0U)
            && ((cr1its & USART_CR1_RXNEIE) != 0U))
    #endif /* USART_CR1_FIFOEN */
        {
          if (huart->RxISR != NULL)
          {
            huart->RxISR(huart);
          }
          return;
        }
      }

I think the Key is RxISR(function pointer) code. So I found the definition of this function pointer.

if (huart->RxISR != NULL)
          {
            huart->RxISR(huart);
          }
          return;

And the definition of this function point is a following code.

void (*RxISR)(struct __UART_HandleTypeDef *huart);

What can I do?

question from:https://stackoverflow.com/questions/65650368/stm32l4-rx-interrupt-not-working-without-debugging-error

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...