Commit Graph
118 Commits
Author SHA1 Message Date
Jiang Jiang Jian 5fc1e1be13 Merge branch 'backport/lp_spi_fix_inline_v5.5' into 'release/v5.5'
fix(ulp/lp_spi): fix stale data in driver (v5.5)

See merge request espressif/esp-idf!51311
2026-08-06 12:02:56 +08:00
Jiang Jiang Jian 8c7d44897e Merge branch 'fix/lp_uart_data_bits_v5.5' into 'release/v5.5'
fix(ulp/lp_core): fix LP UART data_bits validation and add full word-length test coverage (v5.5)

See merge request espressif/esp-idf!48032
2026-08-05 13:56:42 +08:00
Marius VikhammerandCursor 37a4390c64 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-07-29 14:47:48 +02:00
Marius VikhammerandCursor 25b9025d93 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-07-29 14:47:48 +02:00
Sudeep Mohanty 0f4f16033b fix(ulp/lp_spi): fix driver bugs and add bus deinit API
The LP SPI driver read and wrote the W0..W15 data buffer registers a
whole 32-bit word at a time, which overran the caller's buffer for
transfers whose length was not a multiple of four bytes and corrupted
the received data. Read and write the data buffer byte-granularly so
sub-word transfers no longer alias adjacent bytes.

The master transfer also programmed the shared bit-length register from
tx_length alone, truncating receive-longer-than-transmit transactions,
and always enabled MOSI even on read-only transfers, clocking out stale
buffer contents. Size each hardware transaction by max(tx_length,
rx_length) and gate MOSI/MISO on the corresponding buffer.

The slave path reused the master's single-shot flow, so it re-triggered
reg_update after preload (clocking out the previous transaction's data)
and offered no way for the caller to publish readiness before the master
started the clock. Split the slave transfer into an arm step that
preloads the buffer and starts the user phase, and a wait step that
blocks on TRANS_DONE and drains only the bytes the master actually
clocked in, tracked in software since reg_usr is not a reliable busy
indicator in slave mode.

Set the LP IO direction for the SPI pads, add
lp_core_lp_spi_bus_deinit() to release the LP GPIO pins, and reset the
LP SPI peripheral at bus initialization so a stale configuration from a
previous run cannot leak into the next.
2026-07-29 14:45:16 +02:00
Sudeep Mohanty 57ece57241 fix(lp_core): repair LP UART read_bytes RX handling
Made-with: Cursor
2026-07-27 15:35:30 +02:00
Sudeep Mohanty ee9d199d7f 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-07-27 15:35:30 +02:00
Sudeep Mohanty fd466db9f6 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-07-27 15:35:30 +02:00
Marius Vikhammer 4fce6e8ddb Merge branch 'fix/lp_periph_init_fail_with_cpp_v5.5' into 'release/v5.5'
fix(ulp): make LP peripheral default config macros C++ compatible (v5.5)

See merge request espressif/esp-idf!50212
2026-07-20 13:54:23 +08:00
Sudeep MohantyandCursor a9ea3ff796 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:36 +02:00
Samuel Obuch 23d4dcbebc fix(lp_core): fix build for CONFIG_ULP_NORESET_UNDER_DEBUG=n 2026-06-22 11:17:43 +02:00
Jiang Jiang Jian d627f319af Merge branch 'bugfix/ulp_lp_core_wakeup_race_v5.5' into 'release/v5.5'
fix(ulp): fix LP core wakeup race with LP timer (v5.5)

See merge request espressif/esp-idf!49563
2026-06-17 12:02:24 +08:00
hebinglin ab7f6a6d95 fix(ulp): fix lp uart keep wakeup triggered 2026-06-15 15:18:31 +08:00
Marius Vikhammer 6124c9c153 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:47 +08:00
Jiang Jiang Jian c987c21dbc Merge branch 'bugfix/esp_idf_ulp_wakeupcauses_record_v5.5' into 'release/v5.5'
fix(ulp): record wakeup causes before lp core request sleep v5.5

See merge request espressif/esp-idf!49121
2026-06-03 10:51:04 +08:00
hebinglin c0f21a426d fix(esp_hw_support): fix LP core exception interrupt not being cleared 2026-06-02 17:01:24 +08:00
hebinglin 45ea59b0c9 change(ulp): add lp periph intr enable apis 2026-06-02 11:44:10 +08:00
hebinglin 4a42a8847b fix(ulp): record wakeup causes before lp core request sleep 2026-06-01 21:11:48 +08:00
Song Ruo Jing 5b7db25db1 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-22 15:35:21 +08:00
Konstantin Kondrashov 325ebb8021 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-04-30 15:17:34 +03:00
Sudeep Mohanty 05244449ba 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-04-29 16:13:43 +02:00
Meet Patel f562a2bdef 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:37 +05:30
Sudeep Mohanty 66c76d0c34 change(lp_adc): Cleanup LP ADC driver and example 2026-02-09 12:36:18 +01:00
Sudeep Mohanty 0ebd2fd79e 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:17 +01:00
Meet Patel 9bcf41fa6e 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-16 11:19:32 +05:30
Jiang Jiang Jian bf1fe556ee Merge branch 'feat/esp32c5_lp_debug_example_v5.5' into 'release/v5.5'
feat(ulp): esp32c5 and esp32p4 support in debugging example (v5.5)

See merge request espressif/esp-idf!41006
2025-09-02 14:19:46 +08:00
Marius Vikhammer 19f91cfad9 fix(lp_core): fixed array-bound warning when compiling on P4 with -Os
Closes https://github.com/espressif/esp-idf/issues/17054
2025-08-29 09:57:05 +08:00
Samuel Obuch 92feb8c4f8 fix(lp_core): dont reset lp cpu with debug attached 2025-08-27 13:28:09 +02:00
Sudeep Mohanty a544a33131 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-19 10:33:10 +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
Sudeep Mohanty b4f59dae9c fix(lp_uart): Update the lp_core_uart_tx_flush() API to wait for Tx idle
This commit updates the lp_core_uart_tx_flush() API to wait for the Tx line
to become idle, therefore confirming that all bytes are sent out.

Closes https://github.com/espressif/esp-idf/issues/15433
2025-02-28 10:40:38 +01:00
wuzhenghui c0f98621d7 fix(examples): fix esp32c5 ulp examples 2025-02-08 16:04:49 +08:00
igor.udot f742a05b28 feat: supports lp uart wakeup 2025-02-05 14:54:48 +08:00
morris 8da529e5eb Merge branch 'refactor/i2c_ll_trm_sync' into 'master'
refactor(i2c): rename some LL functions according to TRM descriptions

See merge request espressif/esp-idf!35049
2024-11-22 10:13:29 +08:00
Armando 0cbcd652a3 doc(lp_vad): lp vad programming guide 2024-11-21 11:08:11 +08:00
morris 3fb7461eb0 refactor(i2c): rename some LL functions according to TRM descriptions 2024-11-20 19:16:23 +08:00
Marius Vikhammer 1f1954378e Merge branch 'feature/lp_core_gpio_wakeup' into 'master'
feat(lp_core): added support for LP-IO as LP-core wakeup source

Closes IDF-10200

See merge request espressif/esp-idf!31828
2024-10-18 09:32:49 +08:00
Armando 1792aba1dc feat(vad): lp vad driver and wakeup feature 2024-10-16 17:27:27 +08:00
Marius Vikhammer b4c501374f feat(lp_core): added support for LP-IO as LP-core wakeup source 2024-10-16 09:34:20 +08:00
morris 39d6f35594 refactor(lp_core): unify LL functions of ETM wake up lp system 2024-09-26 11:48:15 +08:00
Liu Xiao Yu e051b921b8 Merge branch 'feat/lp_spinlock' into 'master'
feat(ulp): implement inter-hp-lp-cpu spinlock/critical section

Closes IDF-10206

See merge request espressif/esp-idf!32775
2024-09-20 17:09:50 +08:00