HAL Peripheral MSP Init. Why does STM32CubeIDE generated code not include a call to this function?
I made a UART project in STM32CubeIDE. Cube generated the necessary UART initialisation code and created UART_INIT() function (or something like that) in main(). The project worked.
Then I decided to add DMA. I regenerated the code and couldn't find DMA initialisation in UART_INIT(). I found out that this code was generated in another file in UART_MSP_INIT() function (or something like that). My questions are:
- Why does Cube generate this code in another file? Why not in UART_INIT() or DMA_INIT() in main()?
- Do I have to explicitly call UART_MSP_INIT() in main() by myself? And why doesn't Cube do it automatically?
- I found out that GPIO alternate function configuration (for UART) was also made in UART_MSP_INIT(). But I did't explicitly call UART_MSP_INIT() before using DMA. So why did UART work if the pins were not configurated?