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

Add an option to force IDF's default UART clock source #11191

Merged
merged 39 commits into from
Apr 9, 2025

Conversation

gonzabrusco
Copy link
Contributor

@gonzabrusco gonzabrusco commented Mar 27, 2025

Description of Change

Using the ESP32 and baud rates lower than 250000, Arduino 3.X forces you to use REF_TICK as clock source for the UART (instead of the APB as Arduino 2.X). Only if the baud rate is higher than 250000, it switches to APB. This restricts on the RX timeout you can configure with the setRxTimeout method of Serial. You can only set a maximum of 1 symbol timeout while using REF_TICK . For using longer timeouts, you need to use APB as clock source, but Arduino was not giving me the possibility. So I created this option that overrides this automatic selection.

This pull request introduces changes to the UART clock source configuration for the ESP32 platform, adding new options and improving flexibility. The key changes include adding a new configuration option in the Kconfig file, defining new clock source options, and updating the UART initialization and configuration methods to support these new options.

Configuration Updates:

  • Kconfig.projbuild: Added a new configuration option ARDUINO_SERIAL_FORCE_IDF_DEFAULT_CLOCK_SOURCE to force the default UART clock source from IDF, allowing users to override Arduino's automatic clock selection.
    ** This was the initial approach and motivation, but it was replaced by the new HardwareSerial::setClockSource() API.**

Code Enhancements:

  • cores/esp32/HardwareSerial.cpp: Implemented a new method setClockSource to set the UART clock source before starting UART using begin(). This method supports various clock sources based on the SoC.
  • cores/esp32/HardwareSerial.h: Added SerialClkSrc enum to define different UART clock sources and updated the HardwareSerial class to include the setClockSource method. [1] [2]

Structural Changes:

  • cores/esp32/esp32-hal-uart.c: Modified the uart_struct_t structure to include _uart_clock_source and updated the UART initialization (uartBegin) and baud rate setting (uartSetBaudRate) methods to utilize the new clock source configuration. [1] [2] [3]
  • cores/esp32/esp32-hal-uart.h: Added the uartSetClockSource function to set the UART clock source mode, ensuring it is called before uartBegin().

Tests scenarios

  • With this option disabled, on an ESP32, try to set the timeout to 2 using setRxTimeout. You will see the following IDF error in the console:
    E (215) uart: tout_thresh = 2 > maximum value = 1
  • With this option enabled, you can set a higher rx timeout than 1.

Related links

#11132

Copy link
Contributor

github-actions bot commented Mar 27, 2025

Warnings
⚠️

Some issues found for the commit messages in this PR:

  • the commit message "Add an option to force IDF's default UART clock source":
    • summary looks empty
    • type/action looks empty

Please fix these commit messages - here are some basic tips:

  • follow Conventional Commits style
  • correct format of commit message should be: <type/action>(<scope/component>): <summary>, for example fix(esp32): Fixed startup timeout issue
  • allowed types are: change,ci,docs,feat,fix,refactor,remove,revert,test
  • sufficiently descriptive message summary should be between 10 to 72 characters and start with upper case letter
  • avoid Jira references in commit messages (unavailable/irrelevant for our customers)

TIP: Install pre-commit hooks and run this check when committing (uses the Conventional Precommit Linter).

👋 Hello gonzabrusco, we appreciate your contribution to this project!


📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more.

🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project.

Click to see more instructions ...


This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- Resolve all warnings (⚠️ ) before requesting a review from human reviewers - they will appreciate it.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫 dangerJS against 3e78c46

Copy link
Contributor

github-actions bot commented Mar 27, 2025

Test Results

 76 files   76 suites   12m 47s ⏱️
 38 tests  38 ✅ 0 💤 0 ❌
241 runs  241 ✅ 0 💤 0 ❌

Results for commit 3e78c46.

♻️ This comment has been updated with latest results.

Copy link
Contributor

github-actions bot commented Mar 27, 2025

Memory usage test (comparing PR against master branch)

The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.

MemoryFLASH [bytes]FLASH [%]RAM [bytes]RAM [%]
TargetDECINCDECINCDECINCDECINC
ESP32P40⚠️ +1400.00⚠️ +0.04000.000.00
ESP32S30⚠️ +1760.00⚠️ +0.05000.000.00
ESP32S20⚠️ +960.00⚠️ +0.03000.000.00
ESP32C30⚠️ +1220.00⚠️ +0.04000.000.00
ESP32C60⚠️ +1400.00⚠️ +0.06000.000.00
ESP32H20⚠️ +1780.00⚠️ +0.06000.000.00
ESP320⚠️ +1200.00⚠️ +0.03000.000.00
Click to expand the detailed deltas report [usage change in BYTES]
TargetESP32P4ESP32S3ESP32S2ESP32C3ESP32C6ESP32H2ESP32
ExampleFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAM
ArduinoOTA/examples/BasicOTA⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +880
AsyncUDP/examples/AsyncUDPClient⚠️ +1380⚠️ +1520⚠️ +800⚠️ +1180⚠️ +1380--⚠️ +960
AsyncUDP/examples/AsyncUDPMulticastServer⚠️ +1380⚠️ +1520⚠️ +600⚠️ +1180⚠️ +1380--⚠️ +600
AsyncUDP/examples/AsyncUDPServer⚠️ +1380⚠️ +1520⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +920
DNSServer/examples/CaptivePortal⚠️ +1380⚠️ +1520⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +880
EEPROM/examples/eeprom_class⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1200⚠️ +1380⚠️ +1760⚠️ +880
EEPROM/examples/eeprom_extra⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +880
EEPROM/examples/eeprom_write⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1780⚠️ +880
ESP32/examples/AnalogOut/LEDCFade⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1400⚠️ +1780⚠️ +880
ESP32/examples/AnalogOut/LEDCSingleChannel00⚠️ +280⚠️ +280000000⚠️ +280
ESP32/examples/AnalogOut/LEDCSoftwareFade00⚠️ +280⚠️ +280000000⚠️ +280
ESP32/examples/AnalogOut/SigmaDelta00⚠️ +280⚠️ +280000000⚠️ +280
ESP32/examples/AnalogOut/ledcFrequency00⚠️ +280⚠️ +280000000⚠️ +280
ESP32/examples/AnalogOut/ledcWrite_RGB⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1780⚠️ +880
ESP32/examples/AnalogRead⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1400⚠️ +1760⚠️ +880
ESP32/examples/AnalogReadContinuous⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1780⚠️ +880
ESP32/examples/ArduinoStackSize⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +880
ESP32/examples/CI/CIBoardsTest⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +920
ESP32/examples/ChipID/GetChipID⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1400⚠️ +1760⚠️ +880
ESP32/examples/DeepSleep/TimerWakeUp⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1400--⚠️ +880
ESP32/examples/DeepSleep/TouchWakeUp⚠️ +1400⚠️ +1520⚠️ +720------⚠️ +880
ESP32/examples/FreeRTOS/BasicMultiThreading⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1200⚠️ +1380⚠️ +1780⚠️ +880
ESP32/examples/FreeRTOS/Mutex⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +880
ESP32/examples/FreeRTOS/Queue⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1400⚠️ +1760⚠️ +880
ESP32/examples/FreeRTOS/Semaphore⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +880
ESP32/examples/GPIO/BlinkRGB00⚠️ +280⚠️ +280000000⚠️ +280
ESP32/examples/GPIO/FunctionalInterrupt⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1780⚠️ +880
ESP32/examples/GPIO/FunctionalInterruptStruct⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1400⚠️ +1760⚠️ +880
ESP32/examples/GPIO/GPIOInterrupt⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1400⚠️ +1780⚠️ +880
ESP32/examples/HWCDC_Events00⚠️ +1520--⚠️ +1180⚠️ +1380⚠️ +1760--
ESP32/examples/MacAddress/GetMacAddress⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1400⚠️ +1780⚠️ +880
ESP32/examples/RMT/Legacy_RMT_Driver_Compatible⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1400⚠️ +1760⚠️ +880
ESP32/examples/RMT/RMTCallback⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1400⚠️ +1780⚠️ +880
ESP32/examples/RMT/RMTLoopback⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1780⚠️ +880
ESP32/examples/RMT/RMTReadXJT⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1400⚠️ +1780⚠️ +880
ESP32/examples/RMT/RMTWrite_RGB_LED⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1400⚠️ +1760⚠️ +880
ESP32/examples/RMT/RMT_CPUFreq_Test⚠️ +1400⚠️ +1520⚠️ +720⚠️ +1200⚠️ +1380⚠️ +1780⚠️ +880
ESP32/examples/RMT/RMT_EndOfTransmissionState⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1400⚠️ +1780⚠️ +880
ESP32/examples/RMT/RMT_LED_Blink⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +880
ESP32/examples/ResetReason/ResetReason⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1400⚠️ +1760⚠️ +880
ESP32/examples/ResetReason/ResetReason2⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +880
ESP32/examples/Serial/BaudRateDetect_Demo⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1400⚠️ +1760⚠️ +880
ESP32/examples/Serial/OnReceiveError_BREAK_Demo⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1780⚠️ +880
ESP32/examples/Serial/OnReceive_Demo⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1400⚠️ +1780⚠️ +880
ESP32/examples/Serial/RS485_Echo_Demo⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1400⚠️ +1760⚠️ +880
ESP32/examples/Serial/RxFIFOFull_Demo⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1400⚠️ +1760⚠️ +880
ESP32/examples/Serial/RxTimeout_Demo⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1400⚠️ +1760⚠️ +880
ESP32/examples/Serial/Serial_All_CPU_Freqs⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1780⚠️ +880
ESP32/examples/Serial/Serial_STD_Func_OnReceive⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1400⚠️ +1760⚠️ +880
ESP32/examples/Serial/onReceiveExample⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1400⚠️ +1760⚠️ +880
ESP32/examples/TWAI/TWAIreceive⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1400⚠️ +1760⚠️ +880
ESP32/examples/TWAI/TWAItransmit⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1400⚠️ +1760⚠️ +880
ESP32/examples/Template/ExampleTemplate00⚠️ +280⚠️ +280000000⚠️ +280
ESP32/examples/Time/SimpleTime⚠️ +1380⚠️ +1560⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +880
ESP32/examples/Timer/RepeatTimer⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1400⚠️ +1780⚠️ +880
ESP32/examples/Timer/WatchdogTimer⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1780⚠️ +880
ESP32/examples/Touch/TouchInterrupt⚠️ +1380⚠️ +1520⚠️ +720------⚠️ +880
ESP32/examples/Touch/TouchRead⚠️ +1380⚠️ +1520⚠️ +720------⚠️ +880
ESP32/examples/Utilities/HEXBuilder⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1780⚠️ +880
ESP32/examples/Utilities/MD5Builder⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1780⚠️ +880
ESP32/examples/Utilities/SHA1Builder⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1780⚠️ +880
ESP_I2S/examples/ES8388_loopback⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +880
ESP_I2S/examples/Record_to_WAV⚠️ +1380⚠️ +1520--------⚠️ +880
ESP_I2S/examples/Simple_tone⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1200⚠️ +1380⚠️ +1760⚠️ +880
ESPmDNS/examples/mDNS-SD_Extended⚠️ +1380⚠️ +1640⚠️ +640⚠️ +1180⚠️ +1380--⚠️ +880
ESPmDNS/examples/mDNS_Web_Server⚠️ +1380⚠️ +1120⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +880
Ethernet/examples/ETH_TLK110⚠️ +1380----------⚠️ +880
Ethernet/examples/ETH_W5500_Arduino_SPI⚠️ +1380⚠️ +1560⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +880
Ethernet/examples/ETH_W5500_IDF_SPI⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +920
Ethernet/examples/ETH_WIFI_BRIDGE⚠️ +1380⚠️ +1560⚠️ +840⚠️ +1180⚠️ +1380--⚠️ +880
FFat/examples/FFat_Test⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +880
FFat/examples/FFat_time⚠️ +1380⚠️ +1600⚠️ +640⚠️ +1180⚠️ +1380--⚠️ +880
HTTPClient/examples/Authorization⚠️ +1380⚠️ +1400⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +1000
HTTPClient/examples/BasicHttpClient⚠️ +1380⚠️ +1400⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +960
HTTPClient/examples/BasicHttpsClient⚠️ +1380⚠️ +1520⚠️ +880⚠️ +1180⚠️ +1380--⚠️ +880
HTTPClient/examples/ReuseConnection⚠️ +1380⚠️ +1560⚠️ +640⚠️ +1180⚠️ +1380--⚠️ +1160
HTTPClient/examples/StreamHttpClient⚠️ +1380⚠️ +1520⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +960
HTTPUpdate/examples/httpUpdate⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +880
HTTPUpdate/examples/httpUpdateSPIFFS⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +880
HTTPUpdate/examples/httpUpdateSecure⚠️ +1380⚠️ +1320⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +880
HTTPUpdateServer/examples/WebUpdater⚠️ +1380⚠️ +1520⚠️ +640⚠️ +1180⚠️ +1380--⚠️ +920
LittleFS/examples/LITTLEFS_test⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +880
LittleFS/examples/LITTLEFS_time⚠️ +1380⚠️ +1520⚠️ +800⚠️ +1180⚠️ +1380--⚠️ +840
NetBIOS/examples/ESP_NBNST⚠️ +1380⚠️ +1520⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +880
NetworkClientSecure/examples/WiFiClientInsecure⚠️ +1380⚠️ +1600⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +880
NetworkClientSecure/examples/WiFiClientPSK⚠️ +1380⚠️ +1600⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +840
NetworkClientSecure/examples/WiFiClientSecure⚠️ +1380⚠️ +1640⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +840
NetworkClientSecure/examples/WiFiClientSecureProtocolUpgrade⚠️ +1380⚠️ +1560⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +880
NetworkClientSecure/examples/WiFiClientShowPeerCredentials⚠️ +1380⚠️ +1400⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +960
NetworkClientSecure/examples/WiFiClientTrustOnFirstUse⚠️ +1380⚠️ +1640⚠️ +680⚠️ +1180⚠️ +1380--⚠️ +880
PPP/examples/PPP_Basic⚠️ +1380⚠️ +1520⚠️ +760⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +880
PPP/examples/PPP_WIFI_BRIDGE⚠️ +1380⚠️ +1560⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +880
Preferences/examples/Prefs2Struct⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1400⚠️ +1760⚠️ +880
Preferences/examples/StartCounter⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1400⚠️ +1760⚠️ +880
SD/examples/SD_Test⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +880
SD/examples/SD_time⚠️ +1380⚠️ +1560⚠️ +800⚠️ +1180⚠️ +1380--⚠️ +880
SD_MMC/examples/SD2USBMSC⚠️ +1380⚠️ +1520----------
SD_MMC/examples/SDMMC_Test⚠️ +1380⚠️ +1520--------⚠️ +880
SD_MMC/examples/SDMMC_time⚠️ +1380⚠️ +1560--------⚠️ +920
SPI/examples/SPI_Multiple_Buses00⚠️ +280⚠️ +280000000⚠️ +280
SPIFFS/examples/SPIFFS_Test⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +880
SPIFFS/examples/SPIFFS_time⚠️ +1380⚠️ +1520⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +880
TFLiteMicro/examples/hello_world00⚠️ +280⚠️ +280000000⚠️ +280
Ticker/examples/Blinker00⚠️ +280⚠️ +280000000⚠️ +280
Ticker/examples/TickerBasic00⚠️ +280⚠️ +280000000⚠️ +280
Ticker/examples/TickerParameter00⚠️ +280⚠️ +280000000⚠️ +280
USB/examples/CompositeDevice⚠️ +1380⚠️ +1560⚠️ +720--------
USB/examples/ConsumerControl00⚠️ +280⚠️ +280--------
USB/examples/CustomHIDDevice⚠️ +1380⚠️ +1520⚠️ +720--------
USB/examples/FirmwareMSC⚠️ +1380⚠️ +1520⚠️ +720--------
USB/examples/Gamepad⚠️ +1380⚠️ +1520⚠️ +720--------
USB/examples/HIDVendor⚠️ +1380⚠️ +1520⚠️ +720--------
USB/examples/Keyboard/KeyboardLogout00⚠️ +280⚠️ +280--------
USB/examples/Keyboard/KeyboardMessage00⚠️ +280⚠️ +280--------
USB/examples/Keyboard/KeyboardReprogram00⚠️ +280⚠️ +280--------
USB/examples/Keyboard/KeyboardSerial⚠️ +1380⚠️ +1520⚠️ +720--------
USB/examples/KeyboardAndMouseControl⚠️ +1380⚠️ +1520⚠️ +720--------
USB/examples/MIDI/MidiController⚠️ +1380⚠️ +1520⚠️ +720--------
USB/examples/MIDI/MidiInterface⚠️ +1380⚠️ +1520⚠️ +720--------
USB/examples/MIDI/MidiMusicBox⚠️ +1380⚠️ +1520⚠️ +720--------
USB/examples/MIDI/ReceiveMidi⚠️ +1380⚠️ +1520⚠️ +720--------
USB/examples/Mouse/ButtonMouseControl00⚠️ +280⚠️ +280--------
USB/examples/SystemControl00⚠️ +280⚠️ +280--------
USB/examples/USBMSC⚠️ +1400⚠️ +1520⚠️ +720--------
USB/examples/USBSerial⚠️ +1380⚠️ +1520⚠️ +720--------
USB/examples/USBVendor⚠️ +1380⚠️ +1520⚠️ +720--------
Update/examples/AWS_S3_OTA_Update⚠️ +1380⚠️ +1600⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +880
Update/examples/HTTPS_OTA_Update⚠️ +1380⚠️ +1680⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +920
Update/examples/HTTP_Client_AES_OTA_Update⚠️ +1380⚠️ +1600⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +880
Update/examples/HTTP_Server_AES_OTA_Update⚠️ +1380⚠️ +1560⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +880
Update/examples/OTAWebUpdater⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +880
Update/examples/SD_Update⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +880
WebServer/examples/AdvancedWebServer⚠️ +1380⚠️ +1560⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +880
WebServer/examples/FSBrowser⚠️ +1380⚠️ +1560⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +880
WebServer/examples/Filters⚠️ +1380⚠️ +1520⚠️ +680⚠️ +1180⚠️ +1380--⚠️ +920
WebServer/examples/HelloServer⚠️ +1380⚠️ +1520⚠️ +600⚠️ +1180⚠️ +1380--⚠️ +560
WebServer/examples/HttpAdvancedAuth⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +880
WebServer/examples/HttpAuthCallback⚠️ +1380⚠️ +1600⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +880
WebServer/examples/HttpAuthCallbackInline⚠️ +1380⚠️ +1520⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +880
WebServer/examples/HttpBasicAuth⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +880
WebServer/examples/HttpBasicAuthSHA1⚠️ +1380⚠️ +1320⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +880
WebServer/examples/HttpBasicAuthSHA1orBearerToken⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +880
WebServer/examples/MultiHomedServers⚠️ +1380⚠️ +1560⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +880
WebServer/examples/PathArgServer⚠️ +1380⚠️ +1360⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +880
WebServer/examples/SDWebServer⚠️ +1380⚠️ +1480⚠️ +640⚠️ +1180⚠️ +1380--⚠️ +880
WebServer/examples/SimpleAuthentification⚠️ +1380⚠️ +1520⚠️ +800⚠️ +1180⚠️ +1380--⚠️ +920
WebServer/examples/UploadHugeFile⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +880
WebServer/examples/WebServer⚠️ +1380⚠️ +1600⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +960
WebServer/examples/WebUpdate⚠️ +1380⚠️ +1600⚠️ +520⚠️ +1180⚠️ +1380--⚠️ +880
WiFi/examples/FTM/FTM_Initiator⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +880
WiFi/examples/FTM/FTM_Responder⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +880
WiFi/examples/SimpleWiFiServer⚠️ +1380⚠️ +1280⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +880
WiFi/examples/WiFiAccessPoint⚠️ +1380⚠️ +1600⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +880
WiFi/examples/WiFiClient⚠️ +1380⚠️ +1120⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +920
WiFi/examples/WiFiClientBasic⚠️ +1380⚠️ +1520⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +840
WiFi/examples/WiFiClientConnect⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +880
WiFi/examples/WiFiClientEvents⚠️ +1380⚠️ +1240⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +880
WiFi/examples/WiFiClientStaticIP⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +840
WiFi/examples/WiFiExtender⚠️ +1380⚠️ +1520⚠️ +800⚠️ +1180⚠️ +1380--⚠️ +880
WiFi/examples/WiFiIPv6⚠️ +1380⚠️ +1440⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +880
WiFi/examples/WiFiMulti⚠️ +1380⚠️ +1560⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +880
WiFi/examples/WiFiMultiAdvanced⚠️ +1380⚠️ +1640⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +880
WiFi/examples/WiFiScan⚠️ +1380⚠️ +1520⚠️ +640⚠️ +1180⚠️ +1380--⚠️ +880
WiFi/examples/WiFiScanAsync⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +880
WiFi/examples/WiFiScanDualAntenna⚠️ +1380⚠️ +1560⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +880
WiFi/examples/WiFiScanTime⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +880
WiFi/examples/WiFiTelnetToSerial⚠️ +1380⚠️ +1360⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +880
WiFi/examples/WiFiUDPClient⚠️ +1380⚠️ +1520⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +1040
Wire/examples/WireMaster⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +880
Wire/examples/WireScan⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +880
Wire/examples/WireSlave⚠️ +1380⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +880
BLE/examples/BLE5_extended_scan--⚠️ +1480--⚠️ +1180⚠️ +1380⚠️ +1760--
BLE/examples/BLE5_multi_advertising--⚠️ +1600--⚠️ +1180⚠️ +1380⚠️ +1760--
BLE/examples/BLE5_periodic_advertising--⚠️ +1520--⚠️ +1180⚠️ +1380⚠️ +1760--
BLE/examples/BLE5_periodic_sync--⚠️ +1560--⚠️ +1180⚠️ +1380⚠️ +1760--
BLE/examples/Beacon_Scanner--⚠️ +1560--⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +920
BLE/examples/Client--⚠️ +1600--⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +880
BLE/examples/EddystoneTLM_Beacon--⚠️ +1560--⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +880
BLE/examples/EddystoneURL_Beacon--⚠️ +1560--⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +880
BLE/examples/Notify--⚠️ +1520--⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +880
BLE/examples/Scan--⚠️ +1600--⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +920
BLE/examples/Server--⚠️ +1520--⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +880
BLE/examples/Server_multiconnect--⚠️ +1680--⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +760
BLE/examples/UART--⚠️ +1520--⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +880
BLE/examples/Write--⚠️ +1560--⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +880
BLE/examples/iBeacon--⚠️ +1520--⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +960
ESP32/examples/Camera/CameraWebServer (1)--⚠️ +1480⚠️ +760------⚠️ +880
ESP32/examples/Camera/CameraWebServer (2)--⚠️ +1560⚠️ +680------⚠️ +1040
ESP32/examples/Camera/CameraWebServer (3)--⚠️ +1480----------
ESP32/examples/DeepSleep/ExternalWakeUp--⚠️ +1520⚠️ +720------⚠️ +880
ESP_NOW/examples/ESP_NOW_Broadcast_Master--⚠️ +1400⚠️ +960⚠️ +1180⚠️ +1380--⚠️ +880
ESP_NOW/examples/ESP_NOW_Broadcast_Slave--⚠️ +1280⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +960
ESP_NOW/examples/ESP_NOW_Network--⚠️ +1560⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +880
ESP_NOW/examples/ESP_NOW_Serial--⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +920
ESP_SR/examples/Basic--⚠️ +1520----------
HTTPClient/examples/HTTPClientEnterprise--⚠️ +1520⚠️ +520⚠️ +1180⚠️ +1380--⚠️ +880
Insights/examples/DiagnosticsSmokeTest--⚠️ +1560⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +880
Insights/examples/MinimalDiagnostics--⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +880
Matter/examples/MatterColorLight--⚠️ +1640⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +1200
Matter/examples/MatterCommissionTest--⚠️ +1520⚠️ +840⚠️ +1180⚠️ +1380--⚠️ +880
Matter/examples/MatterComposedLights--⚠️ +1600⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +920
Matter/examples/MatterContactSensor--⚠️ +1680⚠️ +800⚠️ +1180⚠️ +1380--⚠️ +880
Matter/examples/MatterDimmableLight--⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +520
Matter/examples/MatterEnhancedColorLight--⚠️ +1600⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +840
Matter/examples/MatterFan--⚠️ +1600⚠️ +800⚠️ +1180⚠️ +1380--⚠️ +960
Matter/examples/MatterHumiditySensor--⚠️ +1600⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +840
Matter/examples/MatterMinimum--⚠️ +1760⚠️ +800⚠️ +1180⚠️ +1380--⚠️ +880
Matter/examples/MatterOccupancySensor--⚠️ +1560⚠️ +720⚠️ +1220⚠️ +1380--⚠️ +960
Matter/examples/MatterOnIdentify--⚠️ +1480⚠️ +600⚠️ +1180⚠️ +1380--⚠️ +920
Matter/examples/MatterOnOffLight--⚠️ +1440⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +640
Matter/examples/MatterOnOffPlugin--⚠️ +1480⚠️ +680⚠️ +1180⚠️ +1380--⚠️ +920
Matter/examples/MatterPressureSensor--⚠️ +1560⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +960
Matter/examples/MatterSmartButon--⚠️ +1600⚠️ +720⚠️ +1220⚠️ +1380--⚠️ +880
Matter/examples/MatterTemperatureLight--⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +880
Matter/examples/MatterTemperatureSensor--⚠️ +1400⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +960
Matter/examples/MatterThermostat--⚠️ +1520⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +880
Matter/examples/WiFiProvWithinMatter--⚠️ +1680⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +960
NetworkClientSecure/examples/WiFiClientSecureEnterprise--⚠️ +1400⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +880
RainMaker/examples/RMakerCustom--⚠️ +1560⚠️ +680⚠️ +1180⚠️ +1380----
RainMaker/examples/RMakerCustomAirCooler--⚠️ +1560⚠️ +720⚠️ +1180⚠️ +1380----
RainMaker/examples/RMakerSonoffDualR3--⚠️ +1560⚠️ +480⚠️ +1180⚠️ +1380----
RainMaker/examples/RMakerSwitch--⚠️ +1520⚠️ +760⚠️ +1180⚠️ +1380----
SimpleBLE/examples/SimpleBleDevice--⚠️ +1400--⚠️ +1180⚠️ +1380⚠️ +1760⚠️ +880
WebServer/examples/Middleware--⚠️ +1520⚠️ +760⚠️ +1180⚠️ +1380--⚠️ +880
WiFi/examples/WPS--⚠️ +1560⚠️ +800⚠️ +1180⚠️ +1380--⚠️ +760
WiFi/examples/WiFiBlueToothSwitch--⚠️ +1520--⚠️ +1180⚠️ +1380--⚠️ +920
WiFi/examples/WiFiClientEnterprise--⚠️ +1520⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +880
WiFi/examples/WiFiSmartConfig--⚠️ +1680⚠️ +680⚠️ +1180⚠️ +1380--⚠️ +880
WiFiProv/examples/WiFiProv--⚠️ +1440⚠️ +720⚠️ +1180⚠️ +1380--⚠️ +280
Zigbee/examples/Zigbee_Color_Dimmer_Switch--⚠️ +1600⚠️ +760⚠️ +1200⚠️ +1380⚠️ +1760⚠️ +920
Zigbee/examples/Zigbee_Gateway--⚠️ +1600⚠️ +720⚠️ +1180----⚠️ +880
Zigbee/examples/Zigbee_On_Off_Switch--⚠️ +1600⚠️ +760⚠️ +1180⚠️ +1380⚠️ +1780⚠️ +880
Zigbee/examples/Zigbee_Range_Extender--⚠️ +1560⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1780⚠️ +920
Zigbee/examples/Zigbee_Thermostat--⚠️ +1600⚠️ +720⚠️ +1180⚠️ +1380⚠️ +1780⚠️ +920
OpenThread/examples/COAP/coap_lamp--------⚠️ +1380⚠️ +1780--
OpenThread/examples/COAP/coap_switch--------⚠️ +1380⚠️ +1780--
OpenThread/examples/SimpleCLI--------⚠️ +1380⚠️ +1780--
OpenThread/examples/SimpleNode--------⚠️ +1380⚠️ +1760--
OpenThread/examples/SimpleThreadNetwork/ExtendedRouterNode--------⚠️ +1380⚠️ +1780--
OpenThread/examples/SimpleThreadNetwork/LeaderNode--------⚠️ +1380⚠️ +1760--
OpenThread/examples/SimpleThreadNetwork/RouterNode--------⚠️ +1380⚠️ +1760--
OpenThread/examples/ThreadScan--------⚠️ +1380⚠️ +1760--
OpenThread/examples/onReceive--------⚠️ +1380⚠️ +1780--
Zigbee/examples/Zigbee_Analog_Input_Output--------⚠️ +1380⚠️ +1780--
Zigbee/examples/Zigbee_CarbonDioxide_Sensor--------⚠️ +1380⚠️ +1760--
Zigbee/examples/Zigbee_Color_Dimmable_Light--------⚠️ +1380⚠️ +1760--
Zigbee/examples/Zigbee_Contact_Switch--------⚠️ +1380⚠️ +1780--
Zigbee/examples/Zigbee_Dimmable_Light--------⚠️ +1380⚠️ +1780--
Zigbee/examples/Zigbee_Illuminance_Sensor--------⚠️ +1380⚠️ +1760--
Zigbee/examples/Zigbee_OTA_Client--------⚠️ +1380⚠️ +1780--
Zigbee/examples/Zigbee_Occupancy_Sensor--------⚠️ +1380⚠️ +1760--
Zigbee/examples/Zigbee_On_Off_Light--------⚠️ +1380⚠️ +1780--
Zigbee/examples/Zigbee_PM25_Sensor--------⚠️ +1380⚠️ +1780--
Zigbee/examples/Zigbee_Pressure_Flow_Sensor--------⚠️ +1380⚠️ +1760--
Zigbee/examples/Zigbee_Scan_Networks--------⚠️ +1380⚠️ +1760--
Zigbee/examples/Zigbee_Temp_Hum_Sensor_Sleepy--------⚠️ +1380⚠️ +1780--
Zigbee/examples/Zigbee_Temperature_Sensor--------⚠️ +1380⚠️ +1780--
Zigbee/examples/Zigbee_Vibration_Sensor--------⚠️ +1380⚠️ +1780--
Zigbee/examples/Zigbee_Wind_Speed_Sensor--------⚠️ +1380⚠️ +1780--
Zigbee/examples/Zigbee_Window_Covering--------⚠️ +1380⚠️ +1760--
BluetoothSerial/examples/DiscoverConnect------------⚠️ +640
BluetoothSerial/examples/GetLocalMAC------------⚠️ +880
BluetoothSerial/examples/SerialToSerialBT------------⚠️ +960
BluetoothSerial/examples/SerialToSerialBTM------------⚠️ +880
BluetoothSerial/examples/SerialToSerialBT_Legacy------------⚠️ +880
BluetoothSerial/examples/SerialToSerialBT_SSP------------⚠️ +880
BluetoothSerial/examples/bt_classic_device_discovery------------⚠️ +880
BluetoothSerial/examples/bt_remove_paired_devices------------⚠️ +880
ESP32/examples/DeepSleep/SmoothBlink_ULP_Code------------⚠️ +880
Ethernet/examples/ETH_LAN8720------------⚠️ +880

@SuGlider
Copy link
Collaborator

@gonzabrusco - Thank you for the PR and for the consistent collaboration! This PR is, certainly, a way for solving it.

After the discussion in #11132, I have been thinking about it. I was considering adding an extra parameter directly into HardwareSerial::begin(...) (last parameter) that will allow the application to set any UART Clock Source based on the possible SoC options.

KConfig is not used by most Arduino Users.
It makes a lot of sense when building an application using Arduino as IDF Component.

May I add the extra parameter for defining the UART Clock Source on top of your PR?
Let me know. Otherwise I can open a new one.

@SuGlider SuGlider added the Status: Awaiting Response awaiting a response from the author label Mar 28, 2025
@gonzabrusco
Copy link
Contributor Author

gonzabrusco commented Mar 28, 2025

@gonzabrusco - Thank you for the PR and for the consistent collaboration! This PR is, certainly, a way for solving it.

After the discussion in #11132, I have been thinking about it. I was considering adding an extra parameter directly into HardwareSerial::begin(...) (last parameter) that will allow the application to set any UART Clock Source based on the possible SoC options.

KConfig is not used by most Arduino Users. It makes a lot of sense when building an application using Arduino as IDF Component.

May I add the extra parameter for defining the UART Clock Source on top of your PR? Let me know. Otherwise I can open a new one.

@SuGlider Wow, I was just thinking exactly the same. I was about to propose that. Yes, the alternative to this is to have a last parameter in HardwareSerial::begin(...) that has a default value of -1 (Arduino current automatic clock selection). That way you don't break current sketches, and you also provide clock selection for each UART controller individually. I think that is a better approach to my original pull request.

If you want me to help you with that, just let me know. It's a pity this didn't make it into Arduino 3.2.0.

PS: Yes, you can add that on top of this PR. No problem.

@SuGlider SuGlider added Status: In Progress ⚠️ Issue is in progress and removed Status: Review needed Issue or PR is awaiting review Status: Awaiting Response awaiting a response from the author labels Mar 28, 2025
@SuGlider SuGlider moved this from Todo to Selected for Development in Arduino ESP32 Core Project Roadmap Mar 31, 2025
@SuGlider SuGlider added this to the 3.2.1 milestone Mar 31, 2025
@SuGlider
Copy link
Collaborator

SuGlider commented Apr 2, 2025

@gonzabrusco - After discussing this change internally, we have decided not to add an extra parameter to the already full of parameters begin(...).
Therefore, I'm adding a new method called bool HardwareSerial::setClockSource(SerialClkSrc clkSrc) that must be called before HardwareSerial::begin() in order to apply choosen UART Clock Source.

In case that none is set, it will follow the current algorithm (REF_TICK for ESP32/S2 when baud rate < 250,000 - or APB otherwise || XTAL for all other SOC). It will also keep the option from kConfig as defined in your PR.

Let me know if you agree and/or have another suggestion.

@gonzabrusco
Copy link
Contributor Author

gonzabrusco commented Apr 2, 2025

@gonzabrusco - After discussing this change internally, we have decided not to add an extra parameter to the already full of parameters begin(...). Therefore, I'm adding a new method called bool HardwareSerial::setClockSource(SerialClkSrc clkSrc) that must be called before HardwareSerial::begin() in order to apply choosen UART Clock Source.

In case that none is set, it will follow the current algorithm (REF_TICK for ESP32/S2 when baud rate < 250,000 - or APB otherwise || XTAL for all other SOC). It will also keep the option from kConfig as defined in your PR.

Let me know if you agree and/or have another suggestion.

That makes sense! LGTM

@SuGlider
Copy link
Collaborator

SuGlider commented Apr 4, 2025

@SuGlider I was checking the code and everything seems fine except for my description of the KConfig option that, because of the changes, it didn't age well hehe.

Note: This configuration is not applicable to the low-power (LP) UART controller.

I think this note should be removed since you made that option apply to LP UART too!

I have changed the kconfig description. I think that I should change HardwareSerial::setClockSource() to check ARDUINO_SERIAL_FORCE_IDF_DEFAULT_CLOCK_SOURCE and display a warning (log_w()) when it is enabled, becuase this function won't have any effect.

Another solution is to just allow it be there when ARDUINO_SERIAL_FORCE_IDF_DEFAULT_CLOCK_SOURCE is off, something similar to a #if 0 to remove it completly from the code, in case ARDUINO_SERIAL_FORCE_IDF_DEFAULT_CLOCK_SOURCE is on

Other option would be just leave HardwareSerial::setClockSource() and remove the ARDUINO_SERIAL_FORCE_IDF_DEFAULT_CLOCK_SOURCE kconfig option.

What do think that makes more sense?

@gonzabrusco
Copy link
Contributor Author

@SuGlider I was checking the code and everything seems fine except for my description of the KConfig option that, because of the changes, it didn't age well hehe.

Note: This configuration is not applicable to the low-power (LP) UART controller.

I think this note should be removed since you made that option apply to LP UART too!

I have changed the kconfig description. I think that I should change HardwareSerial::setClockSource() to check ARDUINO_SERIAL_FORCE_IDF_DEFAULT_CLOCK_SOURCE and display a warning (log_w()) when it is enabled, becuase this function won't have any effect.

Another solution is to just allow it be there when ARDUINO_SERIAL_FORCE_IDF_DEFAULT_CLOCK_SOURCE is off, something similar to a #if 0 to remove it completly from the code, in case ARDUINO_SERIAL_FORCE_IDF_DEFAULT_CLOCK_SOURCE is on

Other option would be just leave HardwareSerial::setClockSource() and remove the ARDUINO_SERIAL_FORCE_IDF_DEFAULT_CLOCK_SOURCE kconfig option.

What do think that makes more sense?

To be completely honest, after all your hard work, I think the KConfig option has become virtually unnecessary. Although it was the initial trigger for this pull request, it has now evolved into something else, something better. So feel free to remove the KConfig option; it will also make the code more readable.

@SuGlider SuGlider added Status: In Progress ⚠️ Issue is in progress and removed Status: Review needed Issue or PR is awaiting review labels Apr 4, 2025
@SuGlider
Copy link
Collaborator

SuGlider commented Apr 4, 2025

@me-no-dev
Changed status to work on removing kconfig option and just leaving the new HardwareSerial::setClockSource() method.
It will get back to review in a couple days.

@SuGlider
Copy link
Collaborator

SuGlider commented Apr 4, 2025

To be completely honest, after all your hard work, I think the KConfig option has become virtually unnecessary. Although it was the initial trigger for this pull request, it has now evolved into something else, something better. So feel free to remove the KConfig option; it will also make the code more readable.

Thanks! I agree to you. I have changed the code to remove kconfig setting.
Please go for a final review and then we will move forward for merging.

@SuGlider SuGlider requested a review from Copilot April 4, 2025 16:55
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@SuGlider SuGlider requested review from SuGlider and Copilot April 4, 2025 16:56
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.

Files not reviewed (4)
  • cores/esp32/HardwareSerial.cpp: Language not supported
  • cores/esp32/HardwareSerial.h: Language not supported
  • cores/esp32/esp32-hal-uart.c: Language not supported
  • cores/esp32/esp32-hal-uart.h: Language not supported

@SuGlider SuGlider requested a review from Copilot April 4, 2025 22:07
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.

Files not reviewed (4)
  • cores/esp32/HardwareSerial.cpp: Language not supported
  • cores/esp32/HardwareSerial.h: Language not supported
  • cores/esp32/esp32-hal-uart.c: Language not supported
  • cores/esp32/esp32-hal-uart.h: Language not supported

@SuGlider SuGlider added Status: Review needed Issue or PR is awaiting review and removed Status: In Progress ⚠️ Issue is in progress labels Apr 4, 2025
@SuGlider
Copy link
Collaborator

SuGlider commented Apr 4, 2025

@me-no-dev @P-R-O-C-H-Y @lucasssvaz - All set. Ready for review.

@me-no-dev me-no-dev requested a review from Copilot April 5, 2025 15:41
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

@SuGlider SuGlider added Status: Pending Merge Pull Request is ready to be merged and removed Status: Review needed Issue or PR is awaiting review labels Apr 6, 2025
@me-no-dev me-no-dev merged commit 0cc8eab into espressif:master Apr 9, 2025
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Peripheral: UART Status: Pending Merge Pull Request is ready to be merged
Projects
Development

Successfully merging this pull request may close these issues.

3 participants