cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to Enable RCC Clocks for different ports in STM32L475VGT6

Er. Aayush
Associate

Hello, 

 I am learning Driver Development from online course and I am attaching my all source code files below in Drag and Drop section but I'm am not able to enable the clock for ports which is defined in my stm32l47x.h file in the section of clock enable macros for GPIOx peripherals.

So help me out in solving this problem as I am on stuck in this from 2 days , and I look forward to your response as soon as possible.

3 REPLIES 3
TDK
Guru

See code for enabling GPIOA clock here:

https://github.com/STMicroelectronics/STM32CubeL4/blob/82e7ade76252f4c973c9fc7515ebc42b850b7c0b/Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc.h#L742

#define __HAL_RCC_GPIOA_CLK_ENABLE()           do { \
                                                 __IO uint32_t tmpreg; \
                                                 SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOAEN); \
                                                 /* Delay after an RCC peripheral clock enabling */ \
                                                 tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOAEN); \
                                                 UNUSED(tmpreg); \
                                               } while(0)
If you feel a post has answered your question, please click "Accept as Solution".

That HAL code is still broken. It just reads the RCC register, which has nothing to do with the actual requirement to wait for two peripheral clock cycles. RCC and the peripheral, for which the clock is enabled, can be on different buses with different frequencies and the requirement calls for two cycles.

For the author - which course teaches redefining the already defined registers and bit fields?