cancel
Showing results for 
Search instead for 
Did you mean: 

I2C Alternate Function Configuration

mrblueblue
Associate II
Posted on August 09, 2016 at 05:52

All,

I believe that I have all my registers configured correctly for my I2C interface on the  STM32F429ZIT6 but I have a question regarding the settings of the GPIO alternate function settings in GPIOx_AFRL and GPIOx_AFRH.

1.) I want to have the alternate function of I2C3 enabled for PA8 (pin 100) and PC9 (pin 99).

2.)  When I call the following functions using the standard peripheral drivers

    GPIO_PinAFConfig(GPIOA, GPIO_Pin_8, GPIO_AF_I2C3);

    GPIO_PinAFConfig(GPIOC, GPIO_Pin_9, GPIO_AF_I2C3);

I don't see the registers GPIOA_AFRL, GPIOA_AFRH, GPIOC_AFRL and GPIOC_AFRH get updated in the debugger. I just see all the bits remain zero's.  I am looking int the debugger in AC6.

Thanks for your thoughts.

 0690X00000605RCQAY.png

-Mike

 

2 REPLIES 2
Posted on August 09, 2016 at 06:20

You need to use GPIO_PinSourceX (an index) and not GPIO_Pin_X (a mask), as the parameter to GPIO_PinAFConfig()

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
mrblueblue
Associate II
Posted on August 10, 2016 at 04:00

Thank you clive1!  You were 100% correct! AF looks to be configured correctly now!

You are the best!

-Mike