2023-08-03 02:45 AM
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.
2023-08-03 03:54 AM
See code for enabling GPIOA clock here:
#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)
2023-08-04 04:14 AM
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?
2023-09-23 12:55 PM