@@ -17,21 +17,31 @@ LINKER_SECTION(".dma_buffers") alignas(alignof(std::max_align_t)) static core::A
1717static core::BitMapHeap<DmaBlockSize, DmaBlockCount> dma_heap_allocator{&dma_memory[0 ], dma_memory.size ()};
1818
1919// / @brief The Clock configuration for this board.
20+ // / @note HSI @ 64 MHz: M=8 -> 8 MHz VCO input, N=100 -> 800 MHz VCO, P=2 -> 400 MHz sys_ck, Q=4, R=8
2021ClockConfiguration const default_clock_configuration = {
2122 /* .use_internal = */ true ,
2223 /* .use_bypass = */ false ,
23- /* .external_clock_frequency */ high_speed_external_oscillator_frequency,
24- /* .low_speed_external_oscillator_frequency */ low_speed_external_oscillator_frequency,
25- /* .ahb_divider = */ 0b0000 , // /1
24+ /* .use_csi = */ false ,
25+ /* .use_pll_fracn = */ false ,
26+ /* .external_clock_frequency = */ high_speed_external_oscillator_frequency,
27+ /* .low_speed_external_oscillator_frequency = */ low_speed_external_oscillator_frequency,
28+ /* .voltage_scaling = */ 0b11 , // VOS1 (up to 400 MHz without VOS0 boost)
29+ /* .d1_core_prescaler = */ 0b0000 , // /1 (cpu_ck = sys_ck)
30+ /* .ahb_divider = */ 0b0000 , // /1 (hclk = sys_ck)
2631 /* .apb1_low_speed_divider = */ 0b101 , // /4
2732 /* .apb2_high_speed_divider = */ 0b100 , // /2
33+ /* .apb3_divider = */ 0b100 , // /2
34+ /* .apb4_divider = */ 0b100 , // /2
2835 /* .mcu_clock1_divider = */ 0b111 , // /5
2936 /* .mcu_clock2_divider = */ 0b111 , // /5
30- /* .rtc_divider = */ 8 ,
31- /* .pll_m = */ 8 ,
32- /* .pll_n = */ 336 ,
33- /* .pll_p = */ 0b00 , // /2
34- /* .pll_q = */ 7
37+ /* .rtc_divider = */ 8U , // /9 (40 kHz clock for RTC)
38+ /* .pll_source = */ 0U , // HSI
39+ /* .pll_m = */ 8U , // 64 MHz / 8 = 8 MHz
40+ /* .pll_n = */ 100U - 1U , // 8 MHz * 100 = 800 MHz VCO
41+ /* .pll_p = */ 2U - 1U , // 800 MHz / 2 = 400 MHz sys_ck
42+ /* .pll_q = */ 4U - 1U , // 800 MHz / 4 = 200 MHz
43+ /* .pll_r = */ 8U - 1U , // 800 MHz / 8 = 100 MHz
44+ /* .pll_fracn = */ 0
3545};
3646
3747} // namespace stm32
@@ -197,7 +207,7 @@ core::Status BoardContext::Initialize(void) {
197207
198208 stm32::h7xx::ResetAndClockControl::AHB1PeripheralClockEnable ahb1_enable;
199209 stm32::h7xx::ResetAndClockControl::AHB2PeripheralClockEnable ahb2_enable;
200- stm32::h7xx::ResetAndClockControl::APB1PeripheralClockEnable apb1_enable;
210+ stm32::h7xx::ResetAndClockControl::APB1LowClockEnable apb1_enable;
201211 stm32::h7xx::ResetAndClockControl::APB2PeripheralClockEnable apb2_enable;
202212
203213 // Enable the RNG in the AHB2 Periperhals
@@ -214,12 +224,12 @@ core::Status BoardContext::Initialize(void) {
214224 stm32::h7xx::reset_and_clock_control.ahb2_peripheral_reset = reset; // write
215225
216226 // enable the APB1 peripherals in the Reset and Clock Control register
217- apb1_enable = stm32::h7xx::reset_and_clock_control.apb1_peripheral_clock_enable ; // read
218- apb1_enable.bits .timer2_enable = 1U ; // modify
219- apb1_enable.bits .i2c1_enable = 1U ; // modify
220- apb1_enable.bits .i2c2_enable = 1U ; // modify
221- apb1_enable.bits .usart3_enable = 1U ; // modify
222- stm32::h7xx::reset_and_clock_control.apb1_peripheral_clock_enable = apb1_enable; // write
227+ apb1_enable = stm32::h7xx::reset_and_clock_control.apb1_low_clock_enable ; // read
228+ apb1_enable.bits .timer2_enable = 1U ; // modify
229+ apb1_enable.bits .i2c1_enable = 1U ; // modify
230+ apb1_enable.bits .i2c2_enable = 1U ; // modify
231+ apb1_enable.bits .usart3_enable = 1U ; // modify
232+ stm32::h7xx::reset_and_clock_control.apb1_low_clock_enable = apb1_enable; // write
223233
224234 // enable the AHB1 peripherals in the Reset and Clock Control register
225235 ahb1_enable = stm32::h7xx::reset_and_clock_control.ahb1_peripheral_clock_enable ; // read
@@ -387,43 +397,43 @@ namespace initialize {
387397void gpio (void ) {
388398 using namespace stm32 ::peripherals;
389399 // Enable GPIO Clocks (for the ones enabled per board)
390- ResetAndClockControl::AHB1PeripheralClockEnable ahb1_enable ;
391- ResetAndClockControl::AHB1PeripheralReset ahb1_reset ;
392-
393- ahb1_enable = reset_and_clock_control.ahb1_peripheral_clock_enable ; // load
394- ahb1_enable .bits .gpioa_enable = 1U ;
395- ahb1_enable .bits .gpiob_enable = 1U ;
396- ahb1_enable .bits .gpioc_enable = 1U ;
397- ahb1_enable .bits .gpiod_enable = 1U ;
398- ahb1_enable .bits .gpioe_enable = 1U ;
399- ahb1_enable .bits .gpiof_enable = 1U ;
400- ahb1_enable .bits .gpiog_enable = 1U ;
401- ahb1_enable .bits .gpioh_enable = 1U ;
402- ahb1_enable .bits .gpioi_enable = 1U ;
403- reset_and_clock_control.ahb1_peripheral_clock_enable = ahb1_enable ; // store
400+ ResetAndClockControl::AHB4ClockEnable ahb4_enable ;
401+ ResetAndClockControl::AHB4Reset ahb4_reset ;
402+
403+ ahb4_enable = reset_and_clock_control.ahb4_clock_enable ; // load
404+ ahb4_enable .bits .gpioa_enable = 1U ;
405+ ahb4_enable .bits .gpiob_enable = 1U ;
406+ ahb4_enable .bits .gpioc_enable = 1U ;
407+ ahb4_enable .bits .gpiod_enable = 1U ;
408+ ahb4_enable .bits .gpioe_enable = 1U ;
409+ ahb4_enable .bits .gpiof_enable = 1U ;
410+ ahb4_enable .bits .gpiog_enable = 1U ;
411+ ahb4_enable .bits .gpioh_enable = 1U ;
412+ ahb4_enable .bits .gpioi_enable = 1U ;
413+ reset_and_clock_control.ahb4_clock_enable = ahb4_enable ; // store
404414 // Reset GPIO Ports
405- ahb1_reset = reset_and_clock_control.ahb1_peripheral_reset ; // load
406- ahb1_reset .bits .gpioa_reset = 1U ;
407- ahb1_reset .bits .gpiob_reset = 1U ;
408- ahb1_reset .bits .gpioc_reset = 1U ;
409- ahb1_reset .bits .gpiod_reset = 1U ;
410- ahb1_reset .bits .gpioe_reset = 1U ;
411- ahb1_reset .bits .gpiof_reset = 1U ;
412- ahb1_reset .bits .gpiog_reset = 1U ;
413- ahb1_reset .bits .gpioh_reset = 1U ;
414- ahb1_reset .bits .gpioi_reset = 1U ;
415- reset_and_clock_control.ahb1_peripheral_reset = ahb1_reset ; // store
415+ ahb4_reset = reset_and_clock_control.ahb4_reset ; // load
416+ ahb4_reset .bits .gpioa_reset = 1U ;
417+ ahb4_reset .bits .gpiob_reset = 1U ;
418+ ahb4_reset .bits .gpioc_reset = 1U ;
419+ ahb4_reset .bits .gpiod_reset = 1U ;
420+ ahb4_reset .bits .gpioe_reset = 1U ;
421+ ahb4_reset .bits .gpiof_reset = 1U ;
422+ ahb4_reset .bits .gpiog_reset = 1U ;
423+ ahb4_reset .bits .gpioh_reset = 1U ;
424+ ahb4_reset .bits .gpioi_reset = 1U ;
425+ reset_and_clock_control.ahb4_reset = ahb4_reset ; // store
416426 // Release GPIO Ports
417- ahb1_reset .bits .gpioa_reset = 0U ;
418- ahb1_reset .bits .gpiob_reset = 0U ;
419- ahb1_reset .bits .gpioc_reset = 0U ;
420- ahb1_reset .bits .gpiod_reset = 0U ;
421- ahb1_reset .bits .gpioe_reset = 0U ;
422- ahb1_reset .bits .gpiof_reset = 0U ;
423- ahb1_reset .bits .gpiog_reset = 0U ;
424- ahb1_reset .bits .gpioh_reset = 0U ;
425- ahb1_reset .bits .gpioi_reset = 0U ;
426- reset_and_clock_control.ahb1_peripheral_reset = ahb1_reset ; // store
427+ ahb4_reset .bits .gpioa_reset = 0U ;
428+ ahb4_reset .bits .gpiob_reset = 0U ;
429+ ahb4_reset .bits .gpioc_reset = 0U ;
430+ ahb4_reset .bits .gpiod_reset = 0U ;
431+ ahb4_reset .bits .gpioe_reset = 0U ;
432+ ahb4_reset .bits .gpiof_reset = 0U ;
433+ ahb4_reset .bits .gpiog_reset = 0U ;
434+ ahb4_reset .bits .gpioh_reset = 0U ;
435+ ahb4_reset .bits .gpioi_reset = 0U ;
436+ reset_and_clock_control.ahb4_reset = ahb4_reset ; // store
427437}
428438
429439bool drivers (void ) {
0 commit comments