Skip to main content
Associate
July 7, 2025
Solved

Compilation error due to missing UART_HandleTypeDef struct name

  • July 7, 2025
  • 4 replies
  • 1397 views

Hello everyone,

I am currently working on a project with a STM32U545. There was a first prototype electronics + software that was working. I made a new hardware and I wanted to use the same code with just a few modification.

For this, I just copied the STM32CubeIDE project, modified the configurator with the integrated CubeMX, regenerated the code and compiled.

This is where I ran into problems:

I have this compilation error:

../Drivers/STM32U5xx_HAL_Driver/Inc/stm32u5xx_hal_uart_ex.h:231:36: error: unknown type name 'UART_HandleTypeDef'; did you mean 'RTC_HandleTypeDef'?
 231 | HAL_StatusTypeDef HAL_RS485Ex_Init(UART_HandleTypeDef *huart, uint32_t Polarity, uint32_t AssertionTime,
 | ^~~~~~~~~~~~~~~~~~
 | RTC_HandleTypeDef

STM32Cube IDE version:  1.18.0

STM32CubeMX version: 6.14.0

When looking at the generated driver (file stm32u5xx_hal_uart.h), I noticed that the UART_HandleTypeDef was missing its name before the semicolon:

typedef struct __UART_HandleTypeDef
{
 USART_TypeDef *Instance; /*!< UART registers base address */

 UART_InitTypeDef Init; /*!< UART communication parameters */

 UART_AdvFeatureInitTypeDef AdvancedInit; /*!< UART Advanced Features initialization parameters */

 const uint8_t *pTxBuffPtr; /*!< Pointer to UART Tx transfer Buffer */

 uint16_t TxXferSize; /*!< UART Tx Transfer size */

 __IO uint16_t TxXferCount; /*!< UART Tx Transfer Counter */

 uint8_t *pRxBuffPtr; /*!< Pointer to UART Rx transfer Buffer */

 uint16_t RxXferSize; /*!< UART Rx Transfer size */

 __IO uint16_t RxXferCount; /*!< UART Rx Transfer Counter */

 uint16_t Mask; /*!< UART Rx RDR register mask */

 uint32_t FifoMode; /*!< Specifies if the FIFO mode is being used.
 This parameter can be a value of @ref UARTEx_FIFO_mode. */

 uint16_t NbRxDataToProcess; /*!< Number of data to process during RX ISR execution */

 uint16_t NbTxDataToProcess; /*!< Number of data to process during TX ISR execution */

 __IO HAL_UART_RxTypeTypeDef ReceptionType; /*!< Type of ongoing reception */

 __IO HAL_UART_RxEventTypeTypeDef RxEventType; /*!< Type of Rx Event */

 void (*RxISR)(struct __UART_HandleTypeDef *huart); /*!< Function pointer on Rx IRQ handler */

 void (*TxISR)(struct __UART_HandleTypeDef *huart); /*!< Function pointer on Tx IRQ handler */

#if defined(HAL_DMA_MODULE_ENABLED)
 DMA_HandleTypeDef *hdmatx; /*!< UART Tx DMA Handle parameters */

 DMA_HandleTypeDef *hdmarx; /*!< UART Rx DMA Handle parameters */

#endif /* HAL_DMA_MODULE_ENABLED */
 HAL_LockTypeDef Lock; /*!< Locking object */

 __IO HAL_UART_StateTypeDef gState; /*!< UART state information related to global Handle management
 and also related to Tx operations. This parameter
 can be a value of @ref HAL_UART_StateTypeDef */

 __IO HAL_UART_StateTypeDef RxState; /*!< UART state information related to Rx operations. This
 parameter can be a value of @ref HAL_UART_StateTypeDef */

 __IO uint32_t ErrorCode; /*!< UART Error code */

#if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
 void (* TxHalfCpltCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Tx Half Complete Callback */
 void (* TxCpltCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Tx Complete Callback */
 void (* RxHalfCpltCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Rx Half Complete Callback */
 void (* RxCpltCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Rx Complete Callback */
 void (* ErrorCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Error Callback */
 void (* AbortCpltCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Abort Complete Callback */
 void (* AbortTransmitCpltCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Abort Transmit Complete Callback */
 void (* AbortReceiveCpltCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Abort Receive Complete Callback */
 void (* RxFifoFullCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Rx Fifo Full Callback */
 void (* TxFifoEmptyCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Tx Fifo Empty Callback */
 void (* RxEventCallback)(struct __UART_HandleTypeDef *huart, uint16_t Pos); /*!< UART Reception Event Callback */

 void (* MspInitCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Msp Init callback */
 void (* MspDeInitCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Msp DeInit callback */
#endif /* USE_HAL_UART_REGISTER_CALLBACKS */

}; // MISSING STRUCT NAME!

  I tried deleting the file and relaunch code generation but it did NOT solve the issue.

Do you have any lead?

 

Thanks a lot,

Arthur

Best answer by ao38

I found a solution: After updating CubeIDE it seems there is a new MCU package for STM32U5 series (1.8.0). After updating I could make a clean regeneration of the HAL Driver and my inital problem (missing struct name in UART driver) is now solved.

 

4 replies

Ghofrane GSOURI
Technical Moderator
July 7, 2025

Hello @ao38 

First let me thank you for posting.

Could you please provide your IOC .

I will be waiting for your feedback.

THX

Ghofrane

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
ao38Author
Associate
July 7, 2025

Hello Ghofrane,

Please find the .ioc file for my project.

Thank you for your help!

Arthur

Ghofrane GSOURI
Technical Moderator
July 7, 2025

Hello @ao38 

I tested using CubeMX 6.14.1 and the build finished with 0 Errors 0 warnings.

I recommend you to use CubeMX 6.14.1

GhofraneGSOURI_0-1751878295316.png

THX

Ghofrane

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Karl Yamashita
Principal
July 10, 2025

Try version STM32CubeIDE 1.19.0 to see if that changes anything

If a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.CAN Jammer an open source CAN bus hacking toolCANableV3 Open Source
ao38Author
Associate
July 10, 2025

Ok, si I updated to version 1.19.0 (CubeMX 6.15.0) and CubeMX does NOT regenerate HAL driver anymore.

I am pretty sure it was doing it before update. How can I force complete regeneration of HAL driver to make sure I am up to date?

Thank you

Pavel A.
Super User
July 10, 2025
ao38Author
Associate
July 10, 2025

As I said I deleted the HAL driver folder and regenerated using CubeMX and the struct name is still missing.

Pavel A.
Super User
July 10, 2025

Then the file in the "repository" is damaged.

 

ao38AuthorBest answer
Associate
July 10, 2025

I found a solution: After updating CubeIDE it seems there is a new MCU package for STM32U5 series (1.8.0). After updating I could make a clean regeneration of the HAL Driver and my inital problem (missing struct name in UART driver) is now solved.