Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Espressif ESP32-S3 DevKitC-1-N32R8 #5999

Merged
merged 8 commits into from Jan 29, 2023
Merged

Espressif ESP32-S3 DevKitC-1-N32R8 #5999

merged 8 commits into from Jan 29, 2023

Conversation

anecdata
Copy link
Member

@anecdata anecdata commented Feb 9, 2022

Draft for now. I can't get it to build.

This is the board in the shop. It uses an ESP32-S3-WROOM-2 module. 32MB flash & 8MB PSRAM:
https://www.adafruit.com/product/5364

edit: "it's complicated"?
espressif/esp-idf#7670

@kmatch98
Copy link
Collaborator

kmatch98 commented Feb 15, 2022

For what it’s worth, I tried the latest ESP IDF version. When running idf.py menuconfig I only see an option for configuring a board with up to 16MB of flash.

See espressif/esp-idf#8365

@anecdata
Copy link
Member Author

anecdata commented Feb 15, 2022

I had tried to flash N8R8 onto it before and it didn't work. Maybe some param I overlooked is different. But it will flash as a 16MB, so it's usable for now :-)
Adafruit CircuitPython 7.2.0-alpha.2-23-gd4c2ffea2-dirty on 2022-02-14; ESP32-S3-DevKitC-1-N32ishR8 with ESP32S3 Hm, no CIRCUITPY though.

@kylefmohr
Copy link

Any idea what next steps need to be done to get this working? @anecdata I also tried flashing the CircuitPython firmware for N8R8 on my N32R8 and got the same results, able to get to the REPL, but the CIRCUITPY drive doesn't show up.

@anecdata
Copy link
Member Author

anecdata commented Mar 1, 2022

@kylefmohr All indications are that we are waiting for Espressif to complete the development discussed in the issue kmatch98 linked above.

@kmatch98
Copy link
Collaborator

kmatch98 commented Mar 3, 2022

Possibly some progress here: espressif/esp-idf#7688

@anecdata
Copy link
Member Author

anecdata commented Mar 3, 2022

Looks like there may still be some 16MB limitations. Do we wait until we update esp-idf, or try to incorporate Espressif's changes into CircuitPython sooner when it's ready enough?

@tannewt tannewt added the board New board or update to a single board label Jun 22, 2022
@kmatch98
Copy link
Collaborator

More progress here: espressif/esp-idf@04959af

I did not verify whether this was backported to v4.4.

@anecdata
Copy link
Member Author

There are indications 32MB+ support is merged into 4.4 (though not sure what snapshot we use). Taking out of draft to see what happens. This is only a test.

@anecdata anecdata marked this pull request as ready for review July 31, 2022 22:02
@tannewt
Copy link
Member

tannewt commented Aug 1, 2022

There are indications 32MB+ support is merged into 4.4 (though not sure what snapshot we use). Taking out of draft to see what happens. This is only a test.

We're using: https://github.com/adafruit/esp-idf/tree/circuitpython8

@tannewt
Copy link
Member

tannewt commented Nov 15, 2022

@anecdata Do we have 32MB support now an updated version of the IDF? Or will we need IDF 5?

@anecdata
Copy link
Member Author

I'm not really sure. If this is still our branch:
https://github.com/adafruit/esp-idf/tree/circuitpython8
We seem to be on 4.4.1?

igrr says here that support is in 4.4.2.

espressif/esp-idf merged / closed PR 7688 (link above) seems to be where the support is added. Issue 7670 is closed (link above), but oddly issue 8365 is still open (link above).

@dhalbert
Copy link
Collaborator

@anecdata
Copy link
Member Author

I see the "Update version to 4.4.2" comment there, so in theory it should work. I'm not set up to build and test for a while. Also very baffled about the conflicts... I thought I fixed it at one point (basically copying the then-new patterns), but there are a lot more diffs now that I don't grok at all. If someone else wants to jump in sooner, feel free.

@anecdata
Copy link
Member Author

Thanks @microdev1!

@tannewt
Copy link
Member

tannewt commented Nov 18, 2022

Does it work now?

@anecdata
Copy link
Member Author

anecdata commented Nov 18, 2022

I may be flashing it wrong this time around, tried a few ways, but I get a boot loop:

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x18 (SPI_FAST_FLASH_BOOT)
Saved PC:0x421099f2
SPIWP:0xee
Octal Flash Mode Enabled
For OPI Flash, Use Default Flash Boot Mode
mode:SLOW_RD, clock div:2
load:0x3fce3808,len:0x68
load:0x403c9700,len:0x980
load:0x403cc700,len:0x25a0
entry 0x403c98a4

addendum: I'm able to flash an N8R8 with 8.0.0-beta.4, so I think my config is ok. But I used to be able to flash an N8R8 .bin onto the N32R8 and the REPL would be fine (just no drive), but now that also boot loops. So that's inconclusive... seems like something else may have changed since February to break that.

@microdev1
Copy link
Collaborator

@anecdata I just pushed a commit reverting flash mode back to dio, can you do a re-test.

@anecdata
Copy link
Member Author

Still boot looping:

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x18 (SPI_FAST_FLASH_BOOT)
Saved PC:0x42109a36
SPIWP:0xee
Octal Flash Mode Enabled
For OPI Flash, Use Default Flash Boot Mode
mode:SLOW_RD, clock div:2
load:0x3fce3808,len:0x68
load:0x403c9700,len:0x980
load:0x403cc700,len:0x25a0
entry 0x403c98a4

The UART shows up correctly as CP2102N USB to UART Bridge Controller, but oddly the USB shows up as USB JTAG/serial debug unit (macOS). No REPL or CIRCUITPY.

@microdev1
Copy link
Collaborator

Does the n8r8 definition still boot?
The current board definition is basically the same as n8r8 apart from obvious changes to accommodate 32MB flash.

@anecdata
Copy link
Member Author

anecdata commented Nov 19, 2022

The N8R8 .bin artifact also boot loops on the N32R8 board. I've tried two N32R8 boards, just to make sure one wasn't flaky, and have erased before flashing each time. Something seems to have changed behind the scenes.

addendum: the 7.3.3 N8R8 .bin does still run REPL on the N32R8 board (and USB shows up correctly as ESP32-S3-DevKitC-1-N8R8), so something else has changed.

@jepler
Copy link
Member

jepler commented Jan 3, 2023

This might need to pull in espressif/esp-idf#7688 to our esp-idf fork.

@microdev1
Copy link
Collaborator

This might need to pull in espressif/esp-idf#7688 to our esp-idf fork.

We now have those commits. This needs a re-test.

@dhalbert
Copy link
Collaborator

We now have those commits. This needs a re-test.

I just ordered an ESP32-S3-DevKitC-1-N32R8 and should get it Friday or Saturday.

@anecdata
Copy link
Member Author

Erased flash and loaded the bin with esptool.py v4.4. No CIRCUITPY, no REPL. It's boot looping.

The USB connector shows up as USB JTAG/serial debug unit (not good) and repeatedly displays:

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x18 (SPI_FAST_FLASH_BOOT)
Saved PC:0x4210b312
SPIWP:0xee
Octal Flash Mode Enabled
For OPI Flash, Use Default Flash Boot Mode
mode:SLOW_RD, clock div:2
load:0x3fce3808,len:0x68
load:0x403c9700,len:0x980
load:0x403cc700,len:0x2574
entry 0x403c98a4

The UART connector shows up as CP2102N USB to UART Bridge Controller (good) and repeatedly displays the same block as above.

N8R8 7.3.3 works as before (REPL, NO CIRCUITPY), N8R8 8.0.0-beta.6 also boot loops.

@dhalbert dhalbert added this to the 8.0.0 milestone Jan 27, 2023
@dhalbert
Copy link
Collaborator

I got this branch and merged in the latest circuitpython main, which has the latest backports (as of late December) from release/v4.4 in upstream. I erased flash and loaded the .bin. I get:

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x4210b566
SPIWP:0xee
Octal Flash Mode Enabled
For OPI Flash, Use Default Flash Boot Mode
mode:SLOW_RD, clock div:1
load:0x3fce3808,len:0x68
load:0x403c9700,len:0x980
load:0x403cc700,len:0x2574
SHA-256 comparison failed:
Calculated: d29ccdcc77968ff92a65aee87c562181025845513a5a17824c6a3facb469294c
Expected: d31b4e85d9f427cf4d4bd360a1cd8fa68cec4a669bda0cf6356a4042625dd388
Attempting to boot anyway...
entry 0x403c98a4

and it boot loops.

@dhalbert
Copy link
Collaborator

I'm going to push this to 8.x.x unless we figure something out. It is not urgent for 8.0.0.

@dhalbert dhalbert modified the milestones: 8.0.0, 8.x.x Jan 27, 2023
@microdev1
Copy link
Collaborator

Switched the flash mode to dout:

# Note: we use esptool.py to flash bootloader in
# dio mode for QIO/QOUT, bootloader then upgrades
# itself to quad mode during initialisation
config ESPTOOLPY_FLASHMODE
    string
    default "dio" if ESPTOOLPY_FLASHMODE_QIO
    default "dio" if ESPTOOLPY_FLASHMODE_QOUT
    default "dio" if ESPTOOLPY_FLASHMODE_DIO
    default "dout" if ESPTOOLPY_FLASHMODE_DOUT
    # The 1st and 2nd bootloader doesn't support opi mode,
    # using fastrd instead. For now the ESPTOOL doesn't support
    # fasted (see ESPTOOL-274), using dout instead. In ROM the flash mode
    # information get from efuse, so don't care this dout choice.
    default "dout" if ESPTOOLPY_FLASHMODE_OPI

@anecdata
Copy link
Member Author

anecdata commented Jan 28, 2023

🎉REPL and CIRCUITPY 🎉

Adafruit CircuitPython 8.0.0-beta.6-63-gb8fa2c641-dirty on 2023-01-28; ESP32-S3-DevKitC-1-N32R8 with ESP32S3
>>> import storage
>>> storage.getmount("/").label
'CIRCUITPY'
>>> 
>>> import os
>>> os.statvfs("/")
(2048, 2048, 15176, 15172, 15172, 0, 0, 0, 0, 255)
>>> 
>>> import gc
>>> gc.mem_free()
8195120
>>> 
>>> import espidf
>>> espidf.heap_caps_get_total_size()
305124

No special esptool.py (v4.4) args needed:
esptool.py -p /dev/cu.usbmodem1483101 write_flash 0 adafruit-circuitpython-espressif_esp32s3_devkitc_1_n32r8-en_US-20230128-b8fa2c6.bin

Thanks, @microdev1 !!

Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @microdev1, and thanks @anecdata for the final test!

@microdev1 microdev1 merged commit f7167bd into adafruit:main Jan 29, 2023
@anecdata anecdata deleted the ESP32-S3-DevKitC-1-N32R8 branch January 29, 2023 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
board New board or update to a single board esp32-s3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants