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

Platformio: S3 QIO 120Mhz Flash speed not possible #9351

Closed
1 task done
Jason2866 opened this issue Mar 6, 2024 · 11 comments · Fixed by #9380
Closed
1 task done

Platformio: S3 QIO 120Mhz Flash speed not possible #9351

Jason2866 opened this issue Mar 6, 2024 · 11 comments · Fixed by #9380
Assignees
Labels
Area: LIB Builder Depends on Lib Builder IDE: PlaformIO Issue relates to PlatformIO IDE Status: In Progress Issue is in progress
Milestone

Comments

@Jason2866
Copy link
Collaborator

Jason2866 commented Mar 6, 2024

Board

every s3 board with QIO Flash capable 120Mhz

Device Description

Setting Flash speed 120Mhz for S3 not possible

Hardware Configuration

none

Version

latest master (checkout manually)

IDE Name

ArduinoIDE

Operating System

MacOS Ventura

Flash frequency

120Mhz

PSRAM enabled

yes

Upload speed

115200

Description

Using the setting 120Mhz flash speed from boards.txt
esp32s3.menu.FlashMode.qio120.build.boot_freq=120m
This setting is nowhere used in platform.txt when the firmware is merged

recipe.objcopy.bin.pattern_args=--chip {build.mcu} elf2image --flash_mode "{build.flash_mode}" --flash_freq "{build.img_freq}" --flash_size "{build.flash_size}" --elf-sha256-offset 0xb0 -o "{build.path}/{build.project_name}.bin" "{build.path}/{build.project_name}.elf"

nor when flashed with esptool
tools.esptool_py.upload.pattern_args=--chip {build.mcu} --port "{serial.port}" --baud {upload.speed} {upload.flags} --before default_reset --after hard_reset write_flash {upload.erase_cmd} -z --flash_mode keep --flash_freq keep --flash_size keep {build.bootloader_addr} "{build.path}/{build.project_name}.bootloader.bin" 0x8000 "{build.path}/{build.project_name}.partitions.bin" 0xe000 "{runtime.platform.path}/tools/partitions/boot_app0.bin" 0x10000 "{build.path}/{build.project_name}.bin" {upload.extra_flags}

and
tools.esptool_py.program.pattern_args=--chip {build.mcu} --port "{serial.port}" --baud {upload.speed} {upload.flags} --before default_reset --after hard_reset write_flash -z --flash_mode keep --flash_freq keep --flash_size keep 0x10000 "{build.path}/{build.project_name}.bin"

Sketch

none

Debug Message

none

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@Jason2866 Jason2866 added Status: Awaiting triage Issue is waiting for triage IDE: Arduino IDE Issue relates to Arduino IDE and removed Status: Awaiting triage Issue is waiting for triage labels Mar 6, 2024
@VojtechBartoska VojtechBartoska added Area: LIB Builder Depends on Lib Builder Status: Needs investigation We need to do some research before taking next steps on this issue labels Mar 11, 2024
@VojtechBartoska VojtechBartoska added this to the 3.0.0-RC1 milestone Mar 11, 2024
@VojtechBartoska VojtechBartoska moved this from Todo to Selected for Development in Arduino ESP32 Core Project Roadmap Mar 11, 2024
@P-R-O-C-H-Y
Copy link
Member

Hi @Jason2866, we are building the boot loader for 120MHz QIO correctly, double checked that and this is printed on build:
Note: HPM is enabled for the flash, force the ROM bootloader into DOUT mode for stable boot on
More about the HPM in the docs. So that means that boot loader flash will run in 120 MHz speed.

The 120MHz boot loader is selected here in the platform.txt:

arduino-esp32/platform.txt

Lines 117 to 121 in 4123e20

# Check if custom bootloader exist: source > variant > build.boot
recipe.hooks.prebuild.4.pattern_args=--chip {build.mcu} elf2image --flash_mode {build.flash_mode} --flash_freq {build.img_freq} --flash_size {build.flash_size} -o
recipe.hooks.prebuild.4.pattern=/usr/bin/env bash -c "[ -f "{build.source.path}"/bootloader.bin ] && cp -f "{build.source.path}"/bootloader.bin "{build.path}"/{build.project_name}.bootloader.bin || ( [ -f "{build.variant.path}"/{build.custom_bootloader}.bin ] && cp "{build.variant.path}"/{build.custom_bootloader}.bin "{build.path}"/{build.project_name}.bootloader.bin || "{tools.esptool_py.path}"/{tools.esptool_py.cmd} {recipe.hooks.prebuild.4.pattern_args} "{build.path}"/{build.project_name}.bootloader.bin "{compiler.sdk.path}"/bin/bootloader_{build.boot}_{build.boot_freq}.elf )"
recipe.hooks.prebuild.4.pattern.linux=/usr/bin/env bash -c "[ -f "{build.source.path}"/bootloader.bin ] && cp -f "{build.source.path}"/bootloader.bin "{build.path}"/{build.project_name}.bootloader.bin || ( [ -f "{build.variant.path}"/{build.custom_bootloader}.bin ] && cp "{build.variant.path}"/{build.custom_bootloader}.bin "{build.path}"/{build.project_name}.bootloader.bin || python3 "{tools.esptool_py.path}"/{tools.esptool_py.cmd} {recipe.hooks.prebuild.4.pattern_args} "{build.path}"/{build.project_name}.bootloader.bin "{compiler.sdk.path}"/bin/bootloader_{build.boot}_{build.boot_freq}.elf )"
recipe.hooks.prebuild.4.pattern.windows=cmd /c IF EXIST "{build.source.path}\bootloader.bin" ( COPY /y "{build.source.path}\bootloader.bin" "{build.path}\{build.project_name}.bootloader.bin" ) ELSE ( IF EXIST "{build.variant.path}\{build.custom_bootloader}.bin" ( COPY "{build.variant.path}\{build.custom_bootloader}.bin" "{build.path}\{build.project_name}.bootloader.bin" ) ELSE ( "{tools.esptool_py.path}\{tools.esptool_py.cmd}" {recipe.hooks.prebuild.4.pattern_args} "{build.path}\{build.project_name}.bootloader.bin" "{compiler.sdk.path}\bin\bootloader_{build.boot}_{build.boot_freq}.elf" ) )

The build.boot_freq is at the end of the line, selecting the right bootloader.

Is there any way you figured out, that the boot loader is not running flash at 120MHz?

@P-R-O-C-H-Y
Copy link
Member

But maybe according to the note from build, we should use DOUT mode instead of DIO for 120 MHz.

@P-R-O-C-H-Y P-R-O-C-H-Y added Status: In Progress Issue is in progress and removed Status: Needs investigation We need to do some research before taking next steps on this issue labels Mar 14, 2024
@Jason2866
Copy link
Collaborator Author

Jason2866 commented Mar 14, 2024

@P-R-O-C-H-Y Thx for the investigation. Overlooked the entry in platform.txt.
I was trying with Platformio and my attempts with 120Mhz ended with errors in build process with esptool.py. There is nothing regarding build.boot_freq in the Platformio scripts.
So looked in platform.txt and didn't find it there, i opened this issue.
Since build.boot_freq is there (overlooked, sorry) it probably works with 120Mhz when using ArduinoIDE.
Leaving one question, can it be tested if the flash speed is 120Mhz?

@P-R-O-C-H-Y
Copy link
Member

@Jason2866 Not sure if we can test the speed. In IDF you get only this one message from boot loader if HPM is enabled.
I (187) flash HPM: Enabling flash high speed mode by dummy
We are not printing anything from boot loader, so not sure if we can check that it was set properly.

@Jason2866
Copy link
Collaborator Author

@P-R-O-C-H-Y Thx again. Will enable logging (as much as possible in IDF) and build the Arduino Libs with verbose logging.
The Infos from you are very Helpful! With them i think i can adopt the Platformio build script(s) to support the 120Mhz mode.

@P-R-O-C-H-Y
Copy link
Member

@Jason2866 You are welcome :) Let us know the results and I think we can rename this issue to be related to PIO which can be closed if you successfully adopt the PIO build script to support 120MHz mode.

@Jason2866
Copy link
Collaborator Author

@P-R-O-C-H-Y Yes, will come back when a solution for Pio is found.

@Jason2866 Jason2866 added IDE: PlaformIO Issue relates to PlatformIO IDE and removed IDE: Arduino IDE Issue relates to Arduino IDE labels Mar 14, 2024
@Jason2866 Jason2866 changed the title S3 QIO 120Mhz Flash speed not possible Platformio: S3 QIO 120Mhz Flash speed not possible Mar 14, 2024
@TD-er
Copy link
Contributor

TD-er commented Mar 14, 2024

You could mirror the SPI clock pin to some other pin and then simply measure the frequency.
Like I did for the ESP32-C2 to double check the SPI frequency.

@Jason2866
Copy link
Collaborator Author

@P-R-O-C-H-Y Opened PR #9380

@P-R-O-C-H-Y
Copy link
Member

@Jason2866 Great! Already checked and looking good.

@Jason2866
Copy link
Collaborator Author

But maybe according to the note from build, we should use DOUT mode instead of DIO for 120 MHz.

@P-R-O-C-H-Y Recommended in IDF 5.1 esptool to use DOUT when using 120Mhz https://github.com/espressif/esp-idf/blob/release/v5.1/components/esptool_py/project_include.cmake

@VojtechBartoska VojtechBartoska moved this from Selected for Development to In Review in Arduino ESP32 Core Project Roadmap Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: LIB Builder Depends on Lib Builder IDE: PlaformIO Issue relates to PlatformIO IDE Status: In Progress Issue is in progress
Projects
Development

Successfully merging a pull request may close this issue.

5 participants