machine/rp2040: set XOSC startup delay multiplier
XOSC requires additional time to stablize on certain RP2040 boards. Signed-off-by: Xudong Zheng <7pkvm5aw@slicealias.com>
Этот коммит содержится в:
родитель
0952b1b984
коммит
f5e933cd4d
1 изменённых файлов: 6 добавлений и 1 удалений
|
@ -8,6 +8,11 @@ import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// On some boards, the XOSC can take longer than usual to stabilize. On such
|
||||||
|
// boards, this is needed to avoid a hard fault on boot/reset. Refer to
|
||||||
|
// PICO_XOSC_STARTUP_DELAY_MULTIPLIER in the Pico SDK for additional details.
|
||||||
|
const XOSC_STARTUP_DELAY_MULTIPLIER = 64
|
||||||
|
|
||||||
type xoscType struct {
|
type xoscType struct {
|
||||||
ctrl volatile.Register32
|
ctrl volatile.Register32
|
||||||
status volatile.Register32
|
status volatile.Register32
|
||||||
|
@ -30,7 +35,7 @@ func (osc *xoscType) init() {
|
||||||
osc.ctrl.Set(rp.XOSC_CTRL_FREQ_RANGE_1_15MHZ)
|
osc.ctrl.Set(rp.XOSC_CTRL_FREQ_RANGE_1_15MHZ)
|
||||||
|
|
||||||
// Set xosc startup delay
|
// Set xosc startup delay
|
||||||
delay := (((xoscFreq * MHz) / 1000) + 128) / 256
|
delay := (((xoscFreq * MHz) / 1000) + 128) / 256 * XOSC_STARTUP_DELAY_MULTIPLIER
|
||||||
osc.startup.Set(uint32(delay))
|
osc.startup.Set(uint32(delay))
|
||||||
|
|
||||||
// Set the enable bit now that we have set freq range and startup delay
|
// Set the enable bit now that we have set freq range and startup delay
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче