2023-12-12 11:08 AM
Hi,
I have a project involving an STM32F030C8T6 MCU. The datasheet says that pin PF0-OSC_IN and PF1-OSC_OUT have I2C1_SDA and I2C1_SCL as their Alternate Functions. When I go CubeMX to select them as such, it doesn't give me an option to do so, even though the datasheet says that it should be possible? How can I set them as I2C pins? If it's not possible in CubeMX, how can I manually do it in software? If that's not possible, could I be constantly reading the value on unused I2C pins and setting PF0 and PF1 to their values, because my I2C bus is already on PF0 and PF1. I was trusting the datasheet.
Thank you for help.
2023-12-12 11:26 AM
Welcome @JS8, to the community!
You can trust the data sheet, but you have overlooked a footnote in column Alternate functions and under table 11:
And this footnote (5) says:
5. For STM32F030xC devices only.
Since you are using an STM32F030C8T6, which is to be understood as STM32F030x8, your STM32 provides the functions I2C1_SDA and I2C1_SCL not on PF0 (pin 5) and PF1 (pin 6) but on PB6 (pin 42) and PB7 (pin 43).
I'm very sorry, but I can't give a more positive answer.
Hope that helps anyway?
Good luck!
/Peter
2023-12-12 12:47 PM
Thanks for the response, Peter.
PB6 and PB7 are not in use in my circuit board. Would it be possible to use those pins as I2C, but then constantly update the state of PF0 and PF1 to match those of PB6 and PB7?
2023-12-12 02:08 PM
There's no way to connect PF0/PF1 to PB6/PB7 internally, or to mirror their states at the speed that you would need.
Software emulation of I2C is possible.