2022-06-24 01:14 AM
Regarding LL_AHB1_GRP1_EnableClock, after setting bit in the function, it is read to "tmprg" and cast to void type. What is the reason for reading?
__STATIC_INLINE void LL_AHB1_GRP1_EnableClock(uint32_t Periphs)
{
__IO uint32_t tmpreg;
SET_BIT(RCC->AHBENR, Periphs);
/* Delay after an RCC peripheral clock enabling */
tmpreg = READ_BIT(RCC->AHBENR, Periphs);
(void)tmpreg;
}
Solved! Go to Solution.
2022-06-24 09:26 AM
It is because in the reference manual it is indicated that after having validated a clock it is necessary to wait a little before it is effective.
The way to do this is to read the register again. In this way we are sure that the writing in the register has been effective (not delayed by the multiple bridges between the buses) and the clock started before using it.
The method used here is a bit crude because storing the read result in a volatile variable is unnecessary.
2022-06-24 09:26 AM
It is because in the reference manual it is indicated that after having validated a clock it is necessary to wait a little before it is effective.
The way to do this is to read the register again. In this way we are sure that the writing in the register has been effective (not delayed by the multiple bridges between the buses) and the clock started before using it.
The method used here is a bit crude because storing the read result in a volatile variable is unnecessary.
2022-06-26 06:13 PM
I checked the contents in the reference manual.
Thank you for your cooperation.