Repository navigation
Description
We've been porting a new board to CP following these instructions: https://learn.adafruit.com/how-to-add-a-new-board-to-circuitpython
We rebuilt and flashed CP for an existing board (the ESP32S3 Feather with 4mb flash 2mb psram) and verified that it worked fine, but now that we're porting to our own board (that uses ESP32S3 8mb flash / 8mb psram) we're seeing a bootloop early in the boot process, e.g.:
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x28 (SPI_FAST_FLASH_BOOT)
Saved PC:0x40378054
SPIWP:0xee
mode:DIO, clock div:2
load:0x3fce3808,len:0x68
load:0x403c9700,len:0x980
load:0x403cc700,len:0x25a0
entry 0x403c98a4
ESP-ROM:esp32s3-20210327
... (loops) ...
We also tried porting tinyuf2 from https://github.com/adafruit/tinyuf2 but this time we don't get as far as presenting as a USB device, e.g.:
[Jan 9 11:57] usb 1-2.1.4: USB disconnect, device number 35
[ +0.649994] usb 1-2.1.4: new full-speed USB device number 36 using xhci_hcd
[ +0.288069] usb 1-2.1.4: device descriptor read/64, error -32
[ +0.396033] usb 1-2.1.4: device descriptor read/64, error -32
[ +0.415971] usb 1-2.1.4: new full-speed USB device number 37 using xhci_hcd
[ +0.568096] usb 1-2.1.4: device descriptor read/64, error -32
[ +0.415989] usb 1-2.1.4: device descriptor read/64, error -32
[ +0.108353] usb 1-2.1-port4: attempt power cycle
[ +0.607433] usb 1-2.1.4: new full-speed USB device number 38 using xhci_hcd
... (repeats) ...
We've tried to verify config by copying from other boards with similar setup, and tried various config options, but no luck...
Any ideas about what to try next?
Thanks for all the great docs! A couple of suggestions for https://learn.adafruit.com/how-to-add-a-new-board-to-circuitpython
- include a link to where a valid UF2 bootloader build would come from (we assume tinyuf2)?
- this paragraph points to code that doesn't contain the config options that it describes: https://learn.adafruit.com/how-to-add-a-new-board-to-circuitpython?view=all#uf2-bootloader-3033719
- add description of how to prep a board to be included on https://circuitpython.org/board/...?
Thanks!
Hamish
PS Our fork is here: https://github.com/hamishcunningham/circuitpython and the diffs to main are here: main...hamishcunningham:circuitpython:unphone
PPS Our board is described here:
- docs: https://iot.unphone.net/#unphone-yourself
- schematic: https://gitlab.com/hamishcunningham/unphone/-/blob/master/doc/unphone-spin9-schematic.pdf
- Arduino library: https://gitlab.com/hamishcunningham/unphonelibrary
- https://unphone.net/the-unphone/
- our CP build is in this Dockerfile: https://gitlab.com/hamishcunningham/the-internet-of-things/-/blob/master/support/circuitpython/Dockerfile
Activity
tannewt commentedon Jan 11, 2023
Please clean and rebuild CircuitPython with
DEBUG=1That should enable debug prints from CP and the ESP-IDF's second stage bootloader which should appear after theESP-ROMprint. (TinyUF2 runs after the second stage bootloader when present. It isn't needed for CircuitPython to run though.)hamishcunningham commentedon Jan 12, 2023
Thanks, with DEBUG=1 I get:
(Not sure if this is relevant, but I only get serial output if I flash
circuitpython-firmware.bin; nothing if I flashfirmware.bin.)hamishcunningham commentedon Jan 12, 2023
I got a little further :)
I made a few more changes to board config and can now get CIRCUITPY to appear if I flash
circuitpython-firmware.binfrom my build. The serial output is this though:The CIRCUITPY tree doesn't contain very much:
Any ideas? Tnx!
tannewt commentedon Jan 12, 2023
Debug builds on ESP should stop in the ESP-IDF panic handler and give you a backtrace. Did you stop making a DEBUG build?
hamishcunningham commentedon Jan 12, 2023
With DEBUG it gives me:
hamishcunningham commentedon Jan 13, 2023
Ah, I seem to have peeled another layer off the onion! This looks more interesting:
The I2S error looks like a pin definition error maybe? I should change something in pins.c maybe?
HW TIMER I have no idea tho...?
Tnx!
tannewt commentedon Jan 13, 2023
Those errors are normal because we're resetting devices that haven't been used. This looks like it is starting up correctly to me.
hamishcunningham commentedon Jan 13, 2023
Must be getting closer :)
I rebuilt without the DEBUG flag and now I get a drive appearing, though it is empty and labelled "6MB Volume".
On serial I'm back to the Hardfault_Handler:
Any ideas? Tnx!
dhalbert commentedon Jan 13, 2023
I don't know about the HardFault_Handler safe mode issue, but try doing this to re-create CIRCUITPY:
These errors are innocuous. They show up on every port:
Also the "HW TIMER" errors are innocuous and show up often on other ports.
hamishcunningham commentedon Jan 13, 2023
Thanks, but I don't get a REPL and code.py isn't recognised. The drive that pops up when the device boots contains nothing :(
(So I can't run erase_filesystem at present...)
hamishcunningham commentedon Jan 15, 2023
I'm confused about the difference between the bootloader(s) that a CP build creates and TinyUF2.
Might it help for me to port my board to tinyuf2?
dhalbert commentedon Jan 15, 2023
TinyUF2 is a secondary bootloader. It is started by the initial bootloader, and knows to start the "main" application if it is present.
You don't need to do that right now. Get the .bin version working.
Looking at your main...hamishcunningham:circuitpython:unphone diffs, the size of flash and PSRAM is still 4MB/2MB, not 8/8, as you say your board is. Also take a look at the 8MB/0MB boards we support. You may need to change the
qiotodioinmpconfigport.mkas well. (But that is used only for the flash program args, I believe.)hamishcunningham commentedon Jan 15, 2023
Thanks! But I think I've already made those changes...? E.g.:
mpconfigboard.mk
sdkconfig
Our chip is an ESP32S3 N8R8 so I've tried to match settings with the Espressif N8R8 devkit. (I started from a feather definition, but figured that wasn't correct.)
dhalbert commentedon Jan 15, 2023
Ah, I was looking at the oldest commit instead of the newest commit, sorry!
dhalbert commentedon Jan 15, 2023
Do you have a DevKit N8R8 or N8R2 in hand, to test whether the definitions we have work for those boards? If those work and the board files are very similar to yours, then I'd guess the issue is just what differs between your board and those. But I may be saying the obvious - if so, sorry. I'm wondering about strapping pins, etc.
I have a DevKit N8R2 but not an N8R8. I will add it to my next staff order.
hamishcunningham commentedon Jan 15, 2023
Aha, I tweaked some more pindefs and now it works! Whahey!
Adafruit CircuitPython 8.0.0-beta.6-38-gfd7f36ee69-dirty on 2023-01-15; unPhone with ESP32S3THanks for your help, much appreciated :)
Given that I've done a "make all" and a .uf2 has been generated and then (I think) combined with the (first stage?) bootloader.bin, does that mean I'm now running UF2, or is that another step?
Thanks again!
dhalbert commentedon Jan 15, 2023
Fantastic!
If you are loading a .bin, then you are not using UF2. You need to load
combined.binfrom a TinyUF2 build onto the board (after erasing it completely). Then TinyUF2 will run after the built-in bootloader. If you do a double-click, it would go into UF2 mode and present a BOOT drive as an MSC USB device, and you would copy the UF2 onto it.UF2 is a special format that contains information about "put this block of data here", etc.
You may be able to start with https://github.com/adafruit/tinyuf2/tree/master/ports/espressif/boards/espressif_esp32s3_devkitm_1 and modify it as necessary. Then you load up the combined.bin as described, for example, here: https://learn.adafruit.com/adafruit-magtag/install-uf2-bootloader
hamishcunningham commentedon Jan 15, 2023
Grand, tnx! Have a good one. H
SenelCanik commentedon Feb 3, 2023
Hi hamishcunningham. We have similar problem. We made our own board with ESP32-S3 (FN8 Model with 8 MB Flash internal). After looading bootloader.bin (and many different *.bin files) we get the following messages from COM port. We use Windows CMD for esptool.exe. How did you solve the problem?
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x7 (TG0WDT_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x40043ac8
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd0108,len:0x1634
load:0x403b6000,len:0xe74
load:0x403ba000,len:0x31c8
Checksum failure. Calculated 0x8e stored 0xde
ets_main.c 329
... (loops) ...