stm32f4: reset peripherals in enable_pcclock()
Reset peripherals to after enabling to clear stale registers set by the bootloader. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
bf9d497ab0
commit
a0615e5e17
|
@ -24,10 +24,17 @@ enable_pclock(uint32_t periph_base)
|
|||
uint32_t pos = (periph_base - APB1PERIPH_BASE) / 0x400;
|
||||
RCC->APB1ENR |= (1<<pos);
|
||||
RCC->APB1ENR;
|
||||
RCC->APB1RSTR |= (1<<pos);
|
||||
RCC->APB1RSTR &= ~(1<<pos);
|
||||
} else if (periph_base < AHB1PERIPH_BASE) {
|
||||
uint32_t pos = (periph_base - APB2PERIPH_BASE) / 0x400;
|
||||
RCC->APB2ENR |= (1<<pos);
|
||||
RCC->APB2ENR;
|
||||
// Skip ADC peripheral reset as they share a bit
|
||||
if (pos < 8 || pos > 10) {
|
||||
RCC->APB2RSTR |= (1<<pos);
|
||||
RCC->APB2RSTR &= ~(1<<pos);
|
||||
}
|
||||
} else if (periph_base < AHB2PERIPH_BASE) {
|
||||
uint32_t pos = (periph_base - AHB1PERIPH_BASE) / 0x400;
|
||||
RCC->AHB1ENR |= (1<<pos);
|
||||
|
|
Loading…
Reference in New Issue