esp-rs / esp-hal

no_std Hardware Abstraction Layers for ESP32 microcontrollers
https://docs.esp-rs.org/esp-hal/
Apache License 2.0
752 stars 210 forks source link

Add a mechanism to configure the source clock for UART #1181

Closed SergioGasquez closed 6 months ago

SergioGasquez commented 8 months ago

In espflash, we use UART for estimating the crystal frequency, in esp-hal, we use APB clock (hardcoded) as source for UART.

To generate the stubs, I had to update esp-hal, to use xtal_clock as source of UART, see changes in: https://github.com/esp-rs/esp-hal/compare/main...SergioGasquez:esp-hal:feat/clk-src. In order to avoid doing this every time we update the stubs (although it would only affect C2) , we want to add a way to configure the UART src clock.

SergioGasquez commented 7 months ago

Here is a list of the registers used to configure the clock source in UART for the different targets: