What's up with missing HAL_I2C_MspInit(hi2c)?
I'm working on test code for a bare metal STM32G0C1 project. I'm using STM32CubeIDE 1.9.0 and created the project with the included STMCubeMX tool.
When digging around in the generated code to understand I2C I found that the function HAL_I2C_MspInit(hi2c) is only weakly defined in stm32g0xx_hal_i2c.c. For other peripherals, such as UARTs, there's a HAL_***_MspInit() where the GPIO are configured. Even supplied sample projects have a HAL_I2C_MspInit(). Instead I find this heart stopping note in stm32g0xx_hal_i2c.c:
"(+) User must Implement HAL_I2C_MspInit() function in which he configures
all related peripherals resources (CLOCK, GPIO, DMA, IT and NVIC )."
Whoa horse!! What's up with burying such an important little comment deep in the generated source code (that I'm not suppose to muck with and assume is good to go right out of the chute)?
I hope you can tell me the error of my ways. Otherwise, I'm going to assign the dreaded "b" word (as in insect) to this tidy little underhanded toss.
My test code, by the way, didn't work. I'm pretty sure I now know why....
Thanks for any comments!!
doug