Commit 1c91ff4
authored
Handle "mpos.main" errors and wait for 5 seconds (#109)
On a new, unsupported device, you may get a reboot loop. Because if the "mpos.main" can't detect the
board it just continues and tries to init the display. In by case (on a CYD) it results in a hard
crash -> a boot loop. This loop is short and avoids to be able to use "mpremote
cp"...
It looks like:
```
...
sys.version=3.4.0; LVGL (9.3.0) MicroPython (1.25.0) Binding compiled on 2026-04-01
sys.implementation=(name='micropython', version=(1, 25, 0, ''), _machine='Generic ESP32 module with
SPIRAM with ESP32', _mpy=11014, _build='ESP32_GENERIC-SPIRAM')
Free space on root filesystem:
total_space=0 / used_space=0 / free_space=0 bytes
RAM: 110656 free, 640 allocated, 111296 total
Passing execution over to mpos.main
MicroPythonOS 0.9.0 running lib/mpos/main.py
unPhone ?
odroid_go ?
m5stack_core2 ?
Try to I2C initialized on sda=21 scl=22
fail_save_i2c ok
Attempt to write a single byte to I2C bus address 0x34...
No device at this address: [Errno 116] ETIMEDOUT
m5stack_fire ?
Try to I2C initialized on sda=21 scl=22
fail_save_i2c ok
Attempt to write a single byte to I2C bus address 0x68...
No device at this address: [Errno 116] ETIMEDOUT
Unknown board: couldn't detect known I2C devices or unique_id prefix
A fatal error occurred. The crash dump printed below may be used to help
determine what caused it. If you are not already running the most recent
version of MicroPython, consider upgrading. New versions often fix bugs.
To learn more about how to debug and/or report this crash visit the wiki
page at: https://github.com/micropython/micropython/wiki/ESP32-debugging
LVGL MicroPython
IDF version : 67c1de1e
Machine : Generic ESP32 module with SPIRAM with ESP32
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
...
```
The interesting line is `Unknown board: couldn't detect known I2C devices or unique_id prefix` so
that `detect_board()` returns `None` but the code just continues.
This PR will raise and error, that will be captured in the `main.py` and we end in the REPL. This
looks like:
```
...
sys.version=3.4.0; LVGL (9.3.0) MicroPython (1.25.0) Binding compiled on 2026-04-01
sys.implementation=(name='micropython', version=(1, 25, 0, ''), _machine='Generic ESP32 module with
SPIRAM with ESP32', _mpy=11014, _build='ESP32_GENERIC-SPIRAM')
Free space on root filesystem:
total_space=0 / used_space=0 / free_space=0 bytes
RAM: 110656 free, 640 allocated, 111296 total
Passing execution over to mpos.main
MicroPythonOS 0.9.0 running lib/mpos/main.py
unPhone ?
odroid_go ?
m5stack_core2 ?
Try to I2C initialized on sda=21 scl=22
fail_save_i2c ok
Attempt to write a single byte to I2C bus address 0x34...
No device at this address: [Errno 116] ETIMEDOUT
m5stack_fire ?
Try to I2C initialized on sda=21 scl=22
fail_save_i2c ok
Attempt to write a single byte to I2C bus address 0x68...
No device at this address: [Errno 116] ETIMEDOUT
Unknown board: couldn't detect known I2C devices or unique_id prefix
Traceback (most recent call last):
File "main.py", line 32, in <module>
File "mpos/main.py", line 253, in <module>
RuntimeError: No board detected, exit initialization!
Error in mpos.main, sleep for 5 seconds and end then...
LVGL (9.3.0) MicroPython (1.25.0) Binding compiled on 2026-04-01; Generic ESP32 module with SPIRAM
with ESP32
Type "help()" for more information.
>>>
```1 parent 70c3b87 commit 1c91ff4
2 files changed
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
250 | 253 | | |
251 | 254 | | |
252 | 255 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
0 commit comments