Skip to main content
Visitor II
February 2, 2019
Question

Problem with multiple definition of UART callbacks when compiling in Arduino IDE using STM32duino.

  • February 2, 2019
  • 1 reply
  • 1917 views

I am trying to setup UART via DMA on STM32L432 Nucleo-32 to read NMEA data from NEO 6M GPS peripheral. I am using Arduino IDE for compiling. However, when I compile I am getting a multiple definition error on void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) and void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart). I checked the underlying files and found that these procedures are also defined in uart.c ( in STM32duino files) which are not weak definitions. My question is how do I use these interrupt callback routines given the above issue. Thanks for your help.

FYI I was able to setup the above microcontroller to work using polling UART without any issues. So I know that the hardware is correctly setup.

    This topic has been closed for replies.

    1 reply

    ST Employee
    March 28, 2019

    Hi @ngupt.19​ 

    Right those callback are defined as current Serial implementation use IT so you could not redefine it without change by yourself the STM32 core (uart.c).

    DMA could be a good enhancement for the Serial or at least be able to let end user redefine it.

    Do not hesitate to submit an issue on the STM32duino GitHub organization or a pull request.

    Best regards

    ST Employee
    June 20, 2023

    Hi @ngupt.19, you can now disable the Arduino API using decicated  HAL modulet:

    https://github.com/stm32duino/Arduino_Core_STM32/wiki/HAL-configuration#hal-module-only

     

    So, by defining the HAL_UART_MODULE_ONLY you will be able to get HAL UART module enabled but no callback defined.