Commit Graph

129 Commits

Author SHA1 Message Date
Marius Vikhammer
5c35b8848e fix(ulp): hardcode LP core RC_FAST frequency per target
The SoC RC_FAST approximation is a nominal figure that can be off by ~10%
from the clock the LP core actually runs at, which made
ulp_lp_core_delay_us() over-delay by up to 9% and the LP core delay test
flake on ESP32-C5 and ESP32-C6.

Use a measured per-target value instead, and fail the build for targets
that have no measured value so that new chips cannot silently inherit a
wrong one.
2026-09-10 09:24:09 +08:00
Sudeep Mohanty
61a3bce867 refactor(ulp): simplify LP core peripheral IO setup on matrix targets
On SOC_LP_GPIO_MATRIX_SUPPORTED targets, route LP SPI, I2C, and remapped
LP UART pins through lp_gpio_connect_* (rtcio_hal_matrix_* on release
branches applies IOMUX and matrix routing).

Remove redundant rtc_gpio_set_direction and rtc_gpio_iomux_func_sel
before matrix connect for LP SPI and remapped LP UART pins.

Non-matrix LP I2C: use rtc_gpio_iomux_output instead of
rtc_gpio_iomux_func_sel. Non-matrix LP UART: use rtc_gpio_iomux_output
and rtc_gpio_iomux_input for func sel and direction.
2026-07-27 14:01:55 +02:00
Renz Bagaporo
bd83aa20f0 fix(ulp): clear LP GPIO edge wakeup latch 2026-07-21 10:50:42 +09:00
Jiang Jiang Jian
fdb33a4ce7 Merge branch 'fix/lp_periph_init_fail_with_cpp_v6.0' into 'release/v6.0'
fix(ulp): make LP peripheral default config macros C++ compatible (v6.0)

See merge request espressif/esp-idf!50211
2026-07-09 12:34:03 +08:00
Jiang Jiang Jian
4193c391f2 Merge branch 'fix/lp_core_noreset_under_debug_option_v6.0' into 'release/v6.0'
fix(lp_core): fix build for CONFIG_ULP_NORESET_UNDER_DEBUG=n (v6.0)

See merge request espressif/esp-idf!49868
2026-07-09 12:31:38 +08:00
Sudeep Mohanty
df31c13c96 fix(ulp): make LP peripheral default config macros C++ compatible
Use dual-path macros: C keeps fragment-style designated initializers;
C++ uses GNU statement expressions (ESP_LOG_CONFIG_INIT pattern).
Add compile-only C++ regression tests for LP UART/I2C and ULP RISC-V I2C.

Closes https://github.com/espressif/esp-idf/issues/18369

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 15:40:08 +02:00
hebinglin
a764b5f222 fix(ulp): record wakeup causes before lp core request sleep 2026-06-29 16:25:56 +08:00
Jiang Jiang Jian
f881254b0f Merge branch 'fix/esp_idf_lp_uart_wakeup_muti_times_v6.0' into 'release/v6.0'
fix(ulp): fix lp uart keep wakeup triggered v6.0

See merge request espressif/esp-idf!49399
2026-06-29 15:38:47 +08:00
Jiang Jiang Jian
340b3aaa65 Merge branch 'change/esp_idf_ulp_add_int_api_6.0' into 'release/v6.0'
change(ulp): add lp periph intr enable apis v6.0

See merge request espressif/esp-idf!49143
2026-06-29 15:36:10 +08:00
Marius Vikhammer
b170866059 Merge branch 'bugfix/ulp_lp_core_wakeup_race_v6.0' into 'release/v6.0'
fix(ulp): fix LP core wakeup race with LP timer (v6.0)

See merge request espressif/esp-idf!49562
2026-06-29 10:31:56 +08:00
Samuel Obuch
900d956236 fix(lp_core): fix build for CONFIG_ULP_NORESET_UNDER_DEBUG=n 2026-06-22 11:16:16 +02:00
Marius Vikhammer
a6c7484b53 fix(ulp): use RC_FAST approximation for LP core fallback
Use the shared SoC RC_FAST approximation when the target has no RTC_FAST source option.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-22 14:02:12 +08:00
Marius Vikhammer
6e12910f8e fix(ulp): use SoC RC_FAST frequency for LP core delay
Use the target RC_FAST approximation for LP core delay conversion.
This prevents ESP32-S31 from under-delaying when running from RC_FAST.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-22 14:02:12 +08:00
Marius Vikhammer
4dd862314d fix(ulp): fixes potential race-condition for lp-timer wakeup with lp-core
Reconfigure wakeup time before enabling the wakeup source to avoid
a wakeup from potentially stale values.

Closes https://github.com/espressif/esp-idf/issues/17009
2026-06-11 09:02:28 +08:00
hebinglin
f088b73ea8 fix(ulp): fix lp uart keep wakeup triggered 2026-06-08 19:49:42 +08:00
hebinglin
b5f815b016 change(ulp): add lp periph intr enable apis 2026-06-02 10:58:28 +08:00
Jiang Jiang Jian
a7b604fd33 Merge branch 'fix/lp_uart_data_bits_v6.0' into 'release/v6.0'
fix(ulp/lp_core): fix LP UART data_bits validation and add full word-length test coverage (v6.0)

See merge request espressif/esp-idf!48031
2026-05-15 14:03:13 +08:00
Song Ruo Jing
eef2153dd0 refactor(rtcio): split rtcio/gpio switch with rtc iomux func sel func
This allows rtc_gpio_deinit to always switch the pad back to GPIO,
regardless of lp io clock enabled or not, so that gpio_config can
always switch the IO back to GPIO use after wakeup from deep sleep.
2026-05-08 18:08:00 +08:00
Sudeep Mohanty
ae6cc662b3 fix(lp_core): repair LP UART read_bytes RX handling
Made-with: Cursor
2026-04-29 07:59:05 +02:00
Sudeep Mohanty
379f50a196 fix(lp_core): skip LP UART RTS/CTS pin setup when flow control is disabled
lp_core_uart_set_pin() unconditionally configured the RTS and CTS GPIO
pins even when flow control was disabled. Only configure the RTS pin
when UART_HW_FLOWCTRL_RTS is set, and the CTS pin when
UART_HW_FLOWCTRL_CTS is set.
2026-04-28 16:14:00 +02:00
Sudeep Mohanty
3b92ee04f0 fix(lp_core): fix LP UART IOMUX pin not bypassing LP GPIO Matrix for RX
On chips with SOC_LP_GPIO_MATRIX_SUPPORTED (esp32p4, esp32s31), when the
default IOMUX pin is used for LP UART, calling rtc_gpio_iomux_func_sel()
alone only selects the IOMUX function on the pad side but does not set
sig_in_sel=0 on the peripheral side. This leaves the LP UART RX input
still reading from the LP GPIO Matrix (where no signal is connected),
causing RX to receive nothing.

Apply the same fix that was already in the HP UART driver: use
rtc_gpio_iomux_input() / rtc_gpio_iomux_output() which additionally
configure the peripheral to bypass the LP GPIO Matrix for IOMUX pins.
2026-04-28 16:14:00 +02:00
Sudeep Mohanty
57167c2c74 fix(lp_core): fix LP UART init parameter validation
Align data_bits, flow_ctrl, and rx_flow_ctrl_thresh checks with uart_param_config().

Made-with: Cursor
2026-04-28 16:13:59 +02:00
Jiang Jiang Jian
4d9c8f3064 Merge branch 'feature/improve_ulp_delay_api_v6.0' into 'release/v6.0'
feat(ulp): Improved ULP delay accuracy and removed floating point operations (v6.0)

See merge request espressif/esp-idf!46423
2026-03-21 14:32:29 +08:00
Konstantin Kondrashov
bc2081ca1e revert(ulp): drop lp timeout helper from backports 2026-03-20 16:44:14 +08:00
Konstantin Kondrashov
6fe2cf575f feat(ulp): Improved ULP delay API accuracy and removed floating point operations
Closes https://github.com/espressif/esp-idf/issues/17494
Closes https://github.com/espressif/esp-idf/issues/16891
2026-03-20 16:44:14 +08:00
Meet Patel
1d7d6eaf30 fix(spinlock): Added fence instruction in spinlock acquire and release
The existing spinlock mechanism possibly has an overlap of memory
operations during multi core execution, as visible in CI testing. When
running the example inter_cpu_critical_section, shared count increment
stops at 299999 instead of reaching 300000, but this only happens
randomly 1 out of 10 times. It is suspected that a memory operation
happens simultaneously from both core, even though spinlock protection
is in place.

To handle this problem, a memory barrier (fence instruction) is added
at critical places during spinlock acquire and release, to ensure that
all memory operations upto that point are completed and synchronised
before proceeding further.
2026-03-20 11:46:28 +05:30
Sudeep Mohanty
b9c375d09b change(lp_adc): Cleanup LP ADC driver and example 2026-02-09 12:36:04 +01:00
Sudeep Mohanty
a6c11f9e84 feat(lp_adc): Set LP ADC calibration params
This commit sets the calibration parameters for a a given LP ADC unit
and channel to improve the raw LP ADC reading when read from the LP
core. The calibration params are set from the HP core.
2026-02-09 12:36:04 +01:00
wuzhenghui
2d8c6ed6b4 change(esp_hal_rtc_timer): unify lp_timer/rtc_timer naming to RTC_TIMER 2026-01-31 22:31:34 +08:00
Chen Chen
b7e82de9d8 refactor(i2c): cleanup I2C definitions in soc_caps.h 2026-01-13 17:29:23 +08:00
Sudeep Mohanty
e6d6eac004 fix(lp_mailbox): Fixed LP mailbox operation when LP core interrupts are enabled
This commit fixes the following issues with the LP mailbox when LP core
interrupts are enabled -
1. Removed static storage classifier on the interrupt handler to remove
   internal linkage and allow the linker to override the weak symbol.
2. Fixed a bug in the interrupt handler where the ACK bit interrupt was
   not being cleared correctly.
3. Fixed a bug in the LP core interrupt handler where the message mask
   was not being set correctly.

Closes https://github.com/espressif/esp-idf/issues/18095
2026-01-09 09:10:54 +01:00
Song Ruo Jing
ce475d901d refactor(uart): split UART HAL into separate component 2026-01-04 16:02:57 +08:00
Omar Chebib
32bb32b598 fix(ulp): fix warning in lp core I2C driver 2025-09-25 10:25:15 +08:00
Omar Chebib
324446da95 feat(mailbox): define and implement a mailbox API with hardware and software support 2025-09-25 10:25:15 +08:00
Meet Patel
93cbfcf139 refactor(lp_core_i2c): Modify lp_core_i2c header to support ESP32C5
lp_core_i2c.h header file has sda and scl pins hardcoded to GPIO6 and
GPIO7 which works only for ESP32C6. ESP32C5 uses GPIO2 and GPIO3 for
I2C SDA and SCL. Hence, added LP_I2C_SCL_IO and LP_I2C_SDA_IO macros
under conditional compilation in library header file, so there is no
need to hardcode I2C GPIO pins and any other test apps or examples
that are including the LP I2C header file can also use Macro directly.
2025-09-15 17:30:20 +05:30
Marius Vikhammer
140effda53 fix(lp_core): fixed array-bound warning when compiling on P4 with -Os
Closes https://github.com/espressif/esp-idf/issues/17054
2025-08-28 13:19:56 +08:00
Song Ruo Jing
6bfdc93593 feat(uart): add DTR and DSR signals support for UART 2025-08-05 16:45:46 +08:00
Samuel Obuch
7024babc31 fix(lp_core): dont reset lp cpu with debug attached 2025-07-31 13:48:45 +02:00
morris
c4d7b1cfce refactor(uart)!: deprcated esp_rom_uart.h 2025-07-08 18:56:17 +08:00
Sudeep Mohanty
0f45b6c6c3 change(lp-core): Update LP I2C and LP UART drivers to use raw interrupt status
This commit updates the LP I2C and LP UART drivers to use the raw
interrupt status without enabling the interrupts.
2025-05-13 15:43:39 +02:00
Sudeep Mohanty
692512c0b3 Merge branch 'contrib/github_pr_15717' into 'master'
feat(ulp): LP Timer interrupt support (GitHub PR)

Closes IDFGH-15026

See merge request espressif/esp-idf!38613
2025-04-25 16:07:31 +08:00
X-Ryl669
4c3fa95c94 fix(ulp): Add missing wake up enable and disable functions for LP core
This commit adds wrapper APIs to enable and disable LP IO as a wakeup
source for the LP Core.

Merges https://github.com/espressif/esp-idf/pull/15837
2025-04-24 11:14:12 +02:00
jath03
a9eba4058e feat(ulp): LP Timer interrupt support
This commit adds support for the LP Timer interrupt to be used by the LP
Core.

Merges https://github.com/espressif/esp-idf/pull/15717
2025-04-23 09:52:45 +02:00
morris
a4d32bb460 Merge branch 'feature/esp32c5_eco2_gpio_update' into 'master'
feat(gpio): esp32c5 eco2 gpio update

Closes IDF-12653, IDF-12710, and IO22-24

See merge request espressif/esp-idf!38358
2025-04-21 14:29:51 +08:00
Song Ruo Jing
ec5176e95a fix(gpio): IO7 is not a LP IO anymore on C5 ECO2 chip 2025-04-18 19:03:08 +08:00
Konstantin Kondrashov
44983e6496 fix(ulp): Fix accumulation of wakeup cause bits in ULP
Closes https://github.com/espressif/esp-idf/issues/15794
2025-04-18 12:14:07 +03:00
morris
122d122c64 refactor(gpio): reuse gpio_int_type_t in the rtc io driver 2025-04-01 18:21:57 +08:00
laokaiyao
c9cc7bb216 feat(ulp_touch): add example for lp_touch 2025-03-14 21:56:05 +08:00
laokaiyao
ffb8adcf49 feat(ulp_touch): support ulp touch driver on p4 2025-03-14 21:10:16 +08:00
Song Ruo Jing
1b09bb3037 fix(uart): LP UART does not have the pre-divider for its clock source
Closes https://github.com/espressif/esp-idf/issues/15427
2025-03-06 20:35:48 +08:00