I am using the STM32CubeIDE to setup the UART peripheral. I can check 'USART1 global interrupt' checkbox in the NVIC settings tab. But when I save and generate the source files, I can't find any callback being generated.

Do I need to type it in myself? How would I know the prototype of the ISR callback?

  • \$\begingroup\$ This would be in the header files, if nothing else find the code that would call it. And again, mention the specific STM32 you are working with, as neither the hardware nor the software is that same across all of them. \$\endgroup\$ – Chris Stratton Sep 3 at 20:51
  • \$\begingroup\$ In the specific version of the STM32 HAL I'm currently using (STM32F4) there are weak function definitions for HAL_UART_TxCpltCallback() and HAL_UART_RxCpltCallback(() among others. I'd imagine that your (unspecified) version has similar ones, which you need to override with your own code. \$\endgroup\$ – brhans Sep 3 at 20:59
  • \$\begingroup\$ @ChrisStratton I am using a nucleo board, the nucleo-f103rb. Does that matter for generating the callback method? I'd expect that the callback would be identical regardless the board/microcontroller. In which header file can I find the prototype? \$\endgroup\$ – bas Sep 3 at 20:59
  • \$\begingroup\$ @brhans Ah that's great. And how can I learn the names for these prototypes other than asking here? \$\endgroup\$ – bas Sep 3 at 21:00
  • \$\begingroup\$ @bas - try poking around in the source base, or using a search tool on it. Figuring out how to find things like this yourself is far more useful than someone else running the search to give you the answer, and along the way you'll start to understand the organization of the HAL code. \$\endgroup\$ – Chris Stratton Sep 3 at 21:06

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.