Commit Graph

149 Commits

Author SHA1 Message Date
Renz Christian Bagaporo
907f4a66d9 Merge branch 'fix/lp_core_gpio_wakeup' into 'master'
fix(ulp): wake pin wakes ESP32-P4 from deep sleep on P4

Closes IDF-15823

See merge request espressif/esp-idf!49855
2026-07-10 07:44:36 +08:00
morris
651d6a283f refactor(esp_common): centralize ALIGN_UP/ALIGN_DOWN into esp_macros.h
Remove ~50 duplicate local definitions of ALIGN_UP/ALIGN_DOWN/ALIGN_UP_BY/
ALIGN_DOWN_BY across the codebase and replace them with canonical
ESP_ALIGN_UP/ESP_ALIGN_DOWN from esp_macros.h.
2026-07-06 13:36:06 +08:00
Renz Bagaporo
e382c58e46 fix(ulp): clear LP GPIO edge wakeup latch 2026-07-02 16:43:46 +09:00
Sudeep Mohanty
8541991224 Merge branch 'fix/lp_spi_driver_and_tests' into 'master'
fix(ulp/lp_spi): fix stale data in driver

Closes IDF-11471, IDF-11472, and IDFCI-10465

See merge request espressif/esp-idf!48972
2026-06-30 15:50:26 +02:00
Sudeep Mohanty
a019532119 fix(ulp/lp_spi): fix driver bugs and add bus deinit API
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 10:21:34 +02:00
Sudeep Mohanty
c5d8ff7ef6 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-29 12:16:39 +02:00
Samuel Obuch
7fac3ca134 Merge branch 'fix/lp_core_noreset_under_debug_option' into 'master'
fix(lp_core): fix build for CONFIG_ULP_NORESET_UNDER_DEBUG=n

See merge request espressif/esp-idf!49831
2026-06-22 11:05:10 +02:00
Samuel Obuch
a555e67f0b fix(lp_core): fix build for CONFIG_ULP_NORESET_UNDER_DEBUG=n 2026-06-19 13:09:18 +02:00
Marius Vikhammer
dd5533e911 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-18 11:58:40 +08:00
Marius Vikhammer
7b1da65f95 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-18 11:46:23 +08:00
Marius Vikhammer
5e0e916591 Merge branch 'fix/lp_core_s31_pdma_intr_entry' into 'master'
fix(ulp): fix LP core interrupt vector entry for LP PDMA on esp32s31

See merge request espressif/esp-idf!49521
2026-06-11 15:55:43 +08:00
Marius Vikhammer
0577a6bf87 fix(ulp): fix LP core interrupt vector entry for LP PDMA on esp32s31 2026-06-10 15:03:57 +08:00
Marius Vikhammer
42bb45db22 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-10 11:10:01 +08:00
hebinglin
46ff88717c fix(ulp): fix lp uart keep wakeup triggered 2026-06-08 16:17:09 +08:00
Alexey Lapshin
7bcf7dcbcf feat(lp_core): optimize ulp_lp_core_delay_X functions 2026-06-04 16:12:21 +07:00
Marius Vikhammer
73dc40eb8a Merge branch 'feature/s31_lp_i2c' into 'master'
feat(ulp): support I2C on ULP for S31

Closes IDF-14635

See merge request espressif/esp-idf!48405
2026-05-13 08:31:29 +08:00
Sudeep Mohanty
fbd587f10d Merge branch 'refactor/lp_periph_io_for_lp_core' into 'master'
refactor(ulp): use lp_gpio_matrix_* for LP core peripheral IO on matrix targets

See merge request espressif/esp-idf!48114
2026-05-12 14:02:08 +02:00
Marius Vikhammer
ab9cf37a1b feat(ulp): support I2C on ULP for S31 2026-05-12 17:32:23 +08:00
Marius Vikhammer
88b39e88c4 feat(ulp): support lp-core PMP on ESP32-S31 2026-05-12 09:20:30 +08:00
Sudeep Mohanty
6f044e6e81 refactor(ulp): use lp_gpio_matrix_* for LP core peripheral IO on matrix targets
On SOC_LP_GPIO_MATRIX_SUPPORTED targets, use lp_gpio_matrix_input and
lp_gpio_matrix_output instead of lp_gpio_connect_* so matrix outputs use
rtcio_hal_matrix_out (LP GPIO IOMUX applied in HAL).

LP UART remapped pins: drop rtc_gpio_iomux_func_sel(pin, 1); rtc_gpio_init
already selects RTCIO_LL_PIN_FUNC.

Non-matrix LP I2C: select dedicated LP I2C RTC IOMUX via rtc_gpio_iomux_output
(same mux register write as rtc_gpio_iomux_func_sel; matches HAL naming for
peripheral-owned output enable on dedicated mux functions).
2026-05-11 13:30:23 +02:00
Marius Vikhammer
6023f07868 feat(ulp): add support for mailbox on S31 2026-05-08 14:06:04 +08:00
Marius Vikhammer
353b637e16 Merge branch 'feature/s31_lp_uart_ulp' into 'master'
feat(ulp): add lp uart support for ULP on S31

Closes IDF-14634 and IDF-15567

See merge request espressif/esp-idf!48055
2026-05-06 15:43:12 +08:00
Marius Vikhammer
66d1d594e4 feat(ulp): add lp uart support for ULP on S31 2026-04-29 16:20:43 +08:00
Song Ruo Jing
1d50587ab2 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-04-29 12:17:37 +08:00
Marius Vikhammer
09f3b007f9 Merge branch 'feature/lp_core_hp_mem_support' into 'master'
feat(ulp): support placing ULP app in HP-RAM

See merge request espressif/esp-idf!47395
2026-04-29 11:33:04 +08:00
Marius Vikhammer
261bd160aa feat(ulp): support placing ULP app in HP-RAM 2026-04-29 09:47:33 +08:00
Sudeep Mohanty
cc025fa3d5 Merge branch 'fix/lp_uart_data_bits' into 'master'
fix(ulp/lp_core): fix LP UART data_bits validation and add full word-length test coverage

Closes PM-715, PM-660, IDFCI-10410, and IDFCI-10464

See merge request espressif/esp-idf!47432
2026-04-28 08:43:03 +02:00
Marius Vikhammer
defe1cde71 feat(ulp/lp_spi): bring up LP SPI on ESP32-S31
Add LP SPI HAL LL layer for ESP32-S31 and ESP32-P4, enable the
peripheral in soc_caps, and port the HP-side and LP-core-side SPI
drivers to use the new LL abstraction.
2026-04-28 10:20:02 +08:00
Sudeep Mohanty
4155acbdd1 fix(lp_core): repair LP UART read_bytes RX handling
Made-with: Cursor
2026-04-23 10:10:05 +02:00
Sudeep Mohanty
952dca66bf 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-23 09:06:16 +02:00
Sudeep Mohanty
eb6ffbf1ee 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-23 09:06:16 +02:00
Sudeep Mohanty
a80f451362 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-23 09:06:12 +02:00
hebinglin
0603e0eb23 fix(ulp): record wakeup causes before lp core request sleep 2026-04-22 16:22:11 +08:00
Marius Vikhammer
10637dbf5e feat(ulp): add support for ulp on esp32s31 2026-04-20 14:45:23 +08:00
He Binglin
4e1b02d90c Merge branch 'change/esp_idf_ulp_add_int_api' into 'master'
change(ulp): add lp periph intr enable apis

See merge request espressif/esp-idf!47160
2026-04-14 17:23:22 +08:00
hebinglin
40d8483c2e change(ulp): add lp periph intr enable apis 2026-04-14 12:24:17 +08:00
Eren Terzioglu
ba8d16dbd4 fix(ulp): Fix build warning for esp32p4 lpcore 2026-03-24 18:47:32 +01:00
Konstantin Kondrashov
74561963e1 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-05 10:39:34 +02:00
puyogo-suzuki
75323ea767 fix(ulp): disable unsupported LP_IO_NUM7 for ESP32-C5 2026-02-25 11:20:00 +02:00
Wu Zheng Hui
ad1f0f870b Merge branch 'feat/support_esp32s31_pmu_basic' into 'master'
feat(esp_hw_support): support esp32s31 pmu basic

Closes IDF-14642

See merge request espressif/esp-idf!45494
2026-02-24 14:11:27 +08:00
Meet Patel
7b30754d33 fix(ulp): correct ULP LP and RISCV interrupt wait cycle duration
Current implementation of interrupt wait cycle calculation depends on a
delay and local counter method, which is inaccurate in achieving precise
timeouts. This commit updates the implementaion to use CPU cycles
instead, as they are more accurate.

Closes https://github.com/espressif/esp-idf/pull/18208
2026-02-19 13:32:31 +05:30
wuzhenghui
0b27301a09 feat(soc): support esp32s31 lp_aon & rtc_wdt & rtc_timer 2026-02-11 15:03:35 +08:00
Sudeep Mohanty
12fdd20da1 Merge branch 'fix/lp_adc_not_working_on_lp_core' into 'master'
Fixes for LP ADC to work when used from the LP core

Closes PM-646, IDFCI-5374, IDFCI-5375, IDFCI-5376, and IDFCI-5377

See merge request espressif/esp-idf!45165
2026-02-09 12:29:41 +01:00
morris
0469db2f83 refactor(rcc): unify the usage of clock control macros for peripherals
- Removed conditional definitions for various RCC_ATOMIC macros across
multiple files, replacing them with a unified PERIPH_RCC_ATOMIC() macro.
- Updated instances where specific RCC_ATOMIC macros were used to ensure
consistent usage of PERIPH_RCC_ATOMIC().
- Deleted unused uart_share_hw_ctrl.h file as its functionality is now
integrated into the new structure.
2026-01-23 18:28:13 +08:00
Sudeep Mohanty
5f6fab3dde change(lp_adc): Cleanup LP ADC driver and example 2026-01-16 08:22:36 +01:00
Sudeep Mohanty
dad79f0464 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-01-16 08:22:36 +01:00
Chen Chen
17d2041821 refactor(i2c): cleanup I2C definitions in soc_caps.h 2026-01-12 17:07:04 +08:00
Sudeep Mohanty
c002cb67d1 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-08 11:14:07 +01:00
Meet Patel
4b02a7e320 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-01-06 10:13:00 +05:30
wuzhenghui
48ba430297 change(esp_hal_rtc_timer): unify lp_timer/rtc_timer naming to RTC_TIMER 2025-12-30 11:35:36 +08:00