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

Flasher stub: Increase CPU frequency to 240 MHz for ESP32-S3 (ESPTOOL-521) #781

Closed
wants to merge 1 commit into from

Conversation

Emill
Copy link
Contributor

@Emill Emill commented Sep 20, 2022

Description of change

Increase clock speeds for ESP32-S3.

This increases CPU frequency from 20 MHz to 240 MHz and SPI frequency from 5 MHz to 20 MHz.

This results in ~2x faster flashing performance in total.

The power consumption impact has not been studied.

This change fixes the following bug(s):

(#779), but only for ESP32-S3. Someone who has access to other boards can probably submit a similar patch for such boards.

I have tested this change with the following hardware & software combinations:

ESP32-S3-WROOM-1

I have run the esptool.py automated integration tests with this change and the above hardware. The results were:

Running esptool.py tests...
...s....sss..........................s.....s.s...s.......s......
----------------------------------------------------------------------
Ran 64 tests in 526.718s

OK (skipped=9)

@github-actions github-actions bot changed the title Flasher stub: Increase CPU frequency to 240 MHz for ESP32-S3 Flasher stub: Increase CPU frequency to 240 MHz for ESP32-S3 (ESPTOOL-521) Sep 20, 2022
@igrr
Copy link
Member

igrr commented Sep 20, 2022

One note is that we should restore the original setting when exiting the stub (e.g. if load_ram is used). Otherwise the apps built before this feature is introduced will unexpectedly start running at a higher CPU and APB frequency.

@radimkarnis
Copy link
Collaborator

@Emill,

could you please update the PR to first store the original settings before increasing CPU freq and to restore the original settings when exiting the stub? (commands in question: ESP_FLASH_END, ESP_FLASH_DEFLATED_END, ESP_MEM_END, ESP_RUN_USER_CODE)

If not, I can finish this feature, please let me know!

@Emill
Copy link
Contributor Author

Emill commented Sep 26, 2022

Do you think there is any issues regarding power consumption (peak power for example) of the increased cpu frequency?

@radimkarnis
Copy link
Collaborator

The only issue I can think of might be the chip becoming more prone to browning out if an insufficient power supply is used.

@Emill
Copy link
Contributor Author

Emill commented Sep 26, 2022

I was more thinking of people who try to flash a board that runs on a weak power supply, like a battery or something.

@radimkarnis
Copy link
Collaborator

@Emill yes, I believe we are mentioning the same thing. I think we can implement this and see if any serious issues with weaker power supplies arise.

@Emill
Copy link
Contributor Author

Emill commented Sep 26, 2022

I can revert the previous cpu setting whenever stub_main returns.

When ESP_FLASH_END etc. ends in a software_reset(), do I need to revert the settings there as well or will a reset automatically reset the cpu frequency?

For, ESP_MEM_END, should the cpu settings be reverted while entrypoint_fn is running?

@radimkarnis
Copy link
Collaborator

We need to restore the settings in all of these four cases, the CPU freq can be increased only while stub logic is running.

@radimkarnis
Copy link
Collaborator

Hi @Emill,
are you planning to work on this or should I pick this up? 😊 thank you and please let me know!

@Emill
Copy link
Contributor Author

Emill commented Oct 6, 2022

Hi. Please pick this up as I am quite busy at the moment... :)

dobairoland pushed a commit to espressif/esptool-legacy-flasher-stub that referenced this pull request May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Faster CPU clock speed in stub flasher for higher performance (ESPTOOL-519)
3 participants