I am taking code from a stm32f0 series and trying to convert it to a stm32l4 series dev kit. I have already changed the necessary addresses and include files that I needed to migrate, but I keep on getting the following errors in the stm32l4xx_hal_uart Files:

../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h:610:1: error: unknown type name 'HAL_StatusTypeDef'; did you mean 'HAL_RTCStateTypeDef'? HAL_StatusTypeDef HAL_DeInit(void); ^~~~~~~~~~~~~~~~~

The error appears by this segment of code:

HAL_StatusTypeDef HAL_HalfDuplex_Init(UART_HandleTypeDef *huart);

I have already defined the HAL_UART_MODULE_ENABLED in the stm32l4xx_hal_conf.h and nothing has changed.

What is the cause of this and how can I fix it?

  • \$\begingroup\$ Find the header file that defines a HAL_StatusTypeDef and make sure it gets included. It might help to enable the switch that will have your compiler save the preprocessor output. There really is no magic bullet here. \$\endgroup\$ – Elliot Alderson Jun 11 at 13:39
  • \$\begingroup\$ I have included it in the header files, that is in the STM32L4xx_HAL_Driver and it still gives me that error, I do not understand by what you mean by enable the switch that will have your compiler save the preprocessor output. \$\endgroup\$ – user150963 Jun 11 at 13:55
  • \$\begingroup\$ Do you have a valid stm32l4xx_hal_conf.h file for your project? You're supposed to take stm32l4xx_hal_conf_template.h, make a copy named just stm32l4xx_hal_conf.h, and then edit it to enable the particular modules you're using. If you've done that properly then all the STM HAL library includes & typedefs should just work... \$\endgroup\$ – brhans Jun 11 at 17:33
  • \$\begingroup\$ Have you changed the definition of the used controller type in your project settings? \$\endgroup\$ – A.R.C. Jun 12 at 9:28
  • \$\begingroup\$ I do not understand what you mean by controller type? \$\endgroup\$ – user150963 Jun 12 at 10:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.