cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F051R8 (64-pin on MB1034B) and RM0091 - can't find alternate function (AF) specifications for PF6/PF7 to enable I2C2.

wb0gaz
Senior

I'm setting out to configure I2C2 on STM32F051R8.

RM0091 (dm00031936) table 13 (pin definitions) has two rows describing pin 47/48 (LQFP64 package) PF6 and PF7 as being configurable for I2C2_SCL and I2C2_SDA.

I'm now looking for alternate function (AF) configuration for GPIOF to expose I2C2 on those two pins, but cannot find any (there are no other references to PF6 and PF7 anywhere in the document.

0693W00000Ka9OiQAJ.png 

I've looked through RM0091 and cannot find any description of how PF6/PF7 is connected to I2C2_SCL and I2C2_SDA.

Does lack of presence in GPIO Alternate Function mean that the only functions supported by PF6/PF7 are GPIO or I2C2, so there is no need to do anything but enable I2C2 and it will then appear on those two pins? If I enabled I2C2 intending to send it to PB10/PB11, will it also appear on PF6/PF7 as a side-effect?

I'm using neither HAL nor LL for this experiment - I'm generating register configurations by hand (as a learning experience).

Thanks for any advice!

5 REPLIES 5

My guess as they are a singular function of the pin in AF mode, there isn't an AF MUX to select between other options.

ie you configure the GPIO in AF mode, and it takes the AF function (singular) assignment.

>>If I enabled I2C2 intending to send it to PB10/PB11, will it also appear on PF6/PF7 as a side-effect?

Look there is a specific AF selection method for the GPIO pin, can you create conflicts, probably, but you'd have to try and create them, and they can be entirely avoided.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
wb0gaz
Senior

Makes sense - usually the STM32 stuff seems to be very well thought through, however, in this case if I want I2C2 I should dedicate PF6/PF7.

Or use PB10/PB11, or some combination of the pins.

If you use PF6/PF7 you can use PB10/PB11 as a Generic GPIO, or one of the other Alternate Function mappings.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
wb0gaz
Senior

Yes makes sense - I am new to the STM32 ecosystem and this is the first time I'd encountered a situation where a peripheral had somewhat exclusive assignment to port pins. This causes no problem now as I'm just experimenting - I just wanted to be sure I was reading the documentation correctly as it seemed at first that some information might be missing, which is not the case.

Thanks again for your advice!

Dave

TDK
Guru

Feels like it's missing information in the datasheet. The GPIOF register has AF fields same as other ports.

Almost certainly you need to set the pins in AF mode, otherwise they will be in default GPIO configuration, either input or analog depending on the family.

FWIW, CubeMX doesn't initialize the AF field for those pins during initialization. Maybe it works, maybe not.

If you feel a post has answered your question, please click "Accept as Solution".