Skip to main content
Visitor II
December 8, 2020
Solved

Mistake in stm32f0xx_hal_uart_ex.h, missing STM32F030xC check

  • December 8, 2020
  • 2 replies
  • 1008 views

CubeMX Firmware Package: STM32Cube FW_F0 V1.10.1

CPU: STM32F030RC.

If use it ASIS, compiler will report UART_TXDATA_FLUSH_REQUEST is undefined.

Problem is in line 1: It missed STM32F030xC.

#if !defined(STM32F030x6) && !defined(STM32F030x8) 
#define __HAL_UART_FLUSH_DRREGISTER(__HANDLE__) \
 do{ \
 SET_BIT((__HANDLE__)->Instance->RQR, UART_RXDATA_FLUSH_REQUEST); \
 SET_BIT((__HANDLE__)->Instance->RQR, UART_TXDATA_FLUSH_REQUEST); \
 } while(0)
#else
#define __HAL_UART_FLUSH_DRREGISTER(__HANDLE__) \
 do{ \
 SET_BIT((__HANDLE__)->Instance->RQR, UART_RXDATA_FLUSH_REQUEST); \
 } while(0)
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */ 

After I added STM32F030xC in the check list. It compiles OK.

#if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F030xC)
#define __HAL_UART_FLUSH_DRREGISTER(__HANDLE__) \
 do{ \
 SET_BIT((__HANDLE__)->Instance->RQR, UART_RXDATA_FLUSH_REQUEST); \
 SET_BIT((__HANDLE__)->Instance->RQR, UART_TXDATA_FLUSH_REQUEST); \
 } while(0)
#else
#define __HAL_UART_FLUSH_DRREGISTER(__HANDLE__) \
 do{ \
 SET_BIT((__HANDLE__)->Instance->RQR, UART_RXDATA_FLUSH_REQUEST); \
 } while(0)
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */ 

The bottom line is:

STM32F030RC only has USART_RQR_RXFRQ, but not USART_RQR_TXFRQ

I hope ST can fix this error in the future.

    This topic has been closed for replies.
    Best answer by Imen.D

    Hi @bonmotwang​ ,

    Please download and use latest STM32CubeF0 V1.11.2 which contains enhancement and fix your issue.

    Please mark my answer as best by clicking on the "Select as Best" button if it fully solved your issue. This will help other users find this solution more quickly.

    Imen

    2 replies

    Technical Moderator
    December 9, 2020

    Hello @bonmotwang​ ,

    Welcome to the STM32 Community :smiling_face_with_smiling_eyes: and thanks for your post.

    I will check that out and get back to you on the corrective actions we will take.

    Imen

    Imen.DAnswer
    Technical Moderator
    December 9, 2020

    Hi @bonmotwang​ ,

    Please download and use latest STM32CubeF0 V1.11.2 which contains enhancement and fix your issue.

    Please mark my answer as best by clicking on the "Select as Best" button if it fully solved your issue. This will help other users find this solution more quickly.

    Imen