AnsweredAssumed Answered

STM32F051C Alternate Function Register problem

Question asked by illusions.del on Jun 28, 2013
Latest reply on Jun 28, 2013 by illusions.del
Hi Everyone!

Sorry for interrupting all of you, but I have a problem.
Next year I will graduate from my University as an Electrical Engineer (at least on paper I will be one). For my thesis I'm currently using an STM32F051C8T6 ARM. I have to say, that I specialized myself in Hardware Designing and not in Programming, but I can handle myself (most of the time).
I designed, build, tested and currently using my own STM32 board. I successfully programmed almost every peripheral in the MCU without the provided Standard Peripheral Libraries [SPL]. I started with using those, but in time I wrote my own libraries and they work as they should be.

There is still one function I still has to use from the SPL, and that is setting the Alternate Function of the GPIO pins. The problem is that the Reference Manual for the MCU ans the provided stm32f0xx.h in the SPL are not matching with each other.

The Ref.Manual says it has two registers (GPIOx_AFRL  and GPIOx_AFRH  x = A..B  STM32F051C Reference Manual page 137),
while the provided stm32f0xx.h file only contains this line:
" __IO uint32_t AFR[2];       /*!< GPIO alternate function low register,                Address offset: 0x20-0x24 */" (line 411)

Can someone help me about how to use the Alternate Functions without the SPL?
I rarely use the STMs predefined Register Bit Definitions.

Thank you for your help!
Best Regards!

Outcomes