Skip to content
Snippets Groups Projects
Verified Commit 38ae2641 authored by Jakub Vaněk's avatar Jakub Vaněk
Browse files

Raise oscillator startup delay to work around flash memory issues

We've found that a certain percentage of production bricks fails to
reliably start up. This was traced down to the communication between
RP2040 and the flash chip. Some initial SPI communication would happen,
but eventually the communication would cease.

Through trial-and-error, it was discovered that raising the oscillator
startup delay makes the issue disappear. This commit adds
a Pico SDK patch to alter the oscillator configuration in Pico SDK.

For now, this is intentionally done as a simple hack. In the long-term,
a proper patch adding OpenCube as a new board should be upstreamed either
to the Pico SDK or to MicroPython.
parent 12c7c933
No related branches found
No related tags found
1 merge request!10Add hack for raising oscillator startup delay
Pipeline #77337 passed
......@@ -16,6 +16,8 @@ build micropython firmware:
- make -C micropython/mpy/ports/rp2 submodules
# HACK: patch a bug in Pico SDK (https://github.com/raspberrypi/pico-sdk/issues/737)
- patch -p1 --forward -i micropython/timer-bug.patch
# HACK: wait longer for oscillator initialization
- patch -p1 --forward -i micropython/xosc-wait.patch
- make -C micropython/mpy/mpy-cross -j $(nproc)
- make -C micropython/mpy/ports/rp2 clean
- make -C micropython/mpy/ports/rp2 USER_C_MODULES=$(pwd)/micropython/modules/micropython.cmake -j $(nproc)
......
--- a/micropython/mpy/lib/pico-sdk/src/rp2_common/hardware_xosc/include/hardware/xosc.h
+++ b/micropython/mpy/lib/pico-sdk/src/rp2_common/hardware_xosc/include/hardware/xosc.h
@@ -14,9 +14,9 @@
// Allow lengthening startup delay to accommodate slow-starting oscillators
// PICO_CONFIG: PICO_XOSC_STARTUP_DELAY_MULTIPLIER, Multiplier to lengthen xosc startup delay to accommodate slow-starting oscillators, type=int, min=1, default=1, group=hardware_xosc
-#ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER
-#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 1
-#endif
+// HACK: raised here to work around flash chip issues
+#undef PICO_XOSC_STARTUP_DELAY_MULTIPLIER
+#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 100
#ifdef __cplusplus
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment