embassy/embassy-stm32/src
bors[bot] 70e4418df9
Merge #781 #785
781:  embassy-net v2 r=Dirbaio a=Dirbaio

- No more `dyn`
- It's no longer a global singleton, you can create muliple net stacks at once.
  - You can't tear them down though, the Device it still has to be `'static` due to restrictions with smoltcp's "fake GAT" in the Device trait. :(
- Removed `_embassy_rand` hack, random seed is passed on creation.



785: stm32: g0: add PLL clock source r=Dirbaio a=willglynn

STM32G0 SYSCLK can be sourced from PLLRCLK. Given that the HSI runs at 16 MHz and the HSE range is 4-48 MHz, the PLL is the only way to reach 64 MHz. This commit adds `ClockSrc::PLL`.

The PLL sources from either HSI16 or HSE, divides it by `m`, and locks its VCO to multiple `n`. It then divides the VCO by `r`, `p`, and `q` to produce up to three associated clock signals:

  * PLLRCLK is one of the inputs on the SYSCLK mux. This is the main reason the user will configure the PLL, so `r` is mandatory and the output is enabled unconditionally.
  * PLLPCLK is available as a clock source for the ADC and I2S peripherals, so `p` is optional and the output is conditional.
  * PLLQCLK exists only on STM32G0B0xx, and exists only to feed the MCO and MCO2 peripherals, so `q` is optional and the output is conditional.

When the user specifies `ClockSrc::PLL(PllConfig)`, `rcc::init()` calls `PllConfig::init()` which initializes the PLL per [RM0454]. It disables the PLL, waits for it to stop, enables the source oscillator, configures the PLL, waits for it to lock, and then enables the appropriate outputs. `rcc::init()` then switches the clock source to PLLRCLK.

`rcc::init()` is now also resonsible for calculating and setting flash wait states. SYSCLCK < 24 MHz is fine in the reset state, but 24-48 MHz requires waiting 1 cycle and 48-64 MHz requires waiting 2 cycles. (This was likely a blocker for anyone using HSE >= 24 MHz, with or without the PLL.) Flash accesses are now automatically slowed down as needed before changing the clock source, and sped up as permitted after changing the clock source. The number of flash wait states also determines if flash prefetching will be profitable, so that is now handled automatically too.

[RM0454]: https://www.st.com/resource/en/reference_manual/rm0454-stm32g0x0-advanced-armbased-32bit-mcus-stmicroelectronics.pdf

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
Co-authored-by: Will Glynn <will@willglynn.com>
2022-05-31 00:25:21 +00:00
..
adc Automatically set ADC clock prescaler on v2 ADC to respect max frequency 2022-05-18 18:34:36 +02:00
can [can] Typo fix: l7 -> f7 2022-03-05 09:46:06 +01:00
crc Add missing + 'd on unborrows. 2022-02-10 16:06:42 +01:00
dac stm32/dac: Check proper channel 2022-04-12 12:49:06 +02:00
dma stm32: add stm32u5 GPDMA, SPIv4 support, add HIL tests. 2022-04-27 01:16:14 +02:00
eth WIP embassy-net v2 2022-05-25 19:56:22 +02:00
flash Add H7 flash and bootloader support 2022-05-06 21:57:15 +02:00
fmc stm32: move macrotables to embassy-stm32 build.rs 2022-02-26 03:23:09 +01:00
i2c Reset peripherals on enable 2022-03-18 00:46:46 +02:00
pwm stm32: Register access for timers now doesn't require self 2022-02-28 16:20:42 +01:00
rcc embassy-stm32: g0: add PLL clock source 2022-05-27 23:56:42 -05:00
sdmmc More cleanup 2022-03-17 01:12:29 +02:00
spi stm32: add stm32u5 GPDMA, SPIv4 support, add HIL tests. 2022-04-27 01:16:14 +02:00
subghz stm32: Remove OptionalPin 2022-02-10 02:38:10 +01:00
timer stm32: Register access for timers now doesn't require self 2022-02-28 16:20:42 +01:00
usart Reimplement BufRead for BufferedUart 2022-05-26 14:02:55 +03:00
dcmi.rs Remove unnecessary feature gating for giant transfers in DCMI 2022-04-27 16:53:20 +02:00
exti.rs stm32: Fix stm32f107 build. 2022-05-08 21:37:37 +02:00
fmt.rs fmt: Add dunmy use to avoid "unused variable" errors when no log is enabled. 2021-06-07 03:21:37 +02:00
gpio.rs Remove unnecessary cfg 2022-05-08 14:50:15 -05:00
interrupt.rs stm32: exclude spammy files from docs by prefixing with _. 2022-03-04 18:03:41 +01:00
lib.rs Merge #752 2022-05-06 23:54:07 +00:00
rng.rs stm32: move macrotables to embassy-stm32 build.rs 2022-02-26 03:23:09 +01:00
time.rs More work on H7 RCC 2021-05-21 20:13:39 -03:00
time_driver.rs Fix STM32 timer interrupt bug 2022-03-30 00:27:33 +03:00
traits.rs stm32: add stm32u5 GPDMA, SPIv4 support, add HIL tests. 2022-04-27 01:16:14 +02:00
usb_otg.rs stm32: Fix stm32f107 build. 2022-05-08 21:37:37 +02:00