Skip to content

arch/risc-v/espressif: Add LPSPI and SPI3 support#18893

Merged
xiaoxiang781216 merged 3 commits into
apache:masterfrom
eren-terzioglu:feature/esp_lp_spi
May 18, 2026
Merged

arch/risc-v/espressif: Add LPSPI and SPI3 support#18893
xiaoxiang781216 merged 3 commits into
apache:masterfrom
eren-terzioglu:feature/esp_lp_spi

Conversation

@eren-terzioglu
Copy link
Copy Markdown
Contributor

Summary

  • Docs/platforms/risc-v: Add LPSPI and SPI3 docs for esp32[-p4]

Add LPSPI and SPI3 docs for esp32p4

  • boards/risc-v/esp32p4: Add LPSPI and SPI3 board support

Add LPSPI and SPI3 board support for esp32[-p4]

  • arch/risc-v/espressif: Add LPSPI and SPI3 support

Add LPSPI and SPI3 support for esp32[-p4]

Impact

Impact on user: Yes, LPSPI and SPI3 can be used for esp32p4

Impact on build: No

Impact on hardware: Yes, missing hardware support added

Impact on documentation: Yes, related docs added

Impact on security: No

Impact on compatibility: No

Testing

esp32p4-function-ev-board:spi config used with these options:

CONFIG_ESPRESSIF_USE_LP_CORE
CONFIG_ESPRESSIF_LPSPI0

Building

Command to build:

make distclean && ./tools/configure.sh esp32p4-function-ev-board:spi && kconfig-tweak -e CONFIG_ESPRESSIF_USE_LP_CORE && kconfig-tweak -e CONFIG_ESPRESSIF_LPSPI && make olddefconfig && make olddefconfig && make -j && make download ESPTOOL_PORT=/dev/ttyUSB0

Running

Testing LPSPI

ULP code snippet

#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include "ulp_lp_core_spi.h"
#include "ulp_lp_core_utils.h"
#include "ulp_lp_core_print.h"

int main (void)
{
    uint8_t data = 0x55;
    lp_spi_transaction_t trans_desc = {
        .tx_buffer = &data,
        .tx_length = 1,
        .address = 0,
        .address_bits = 0,
    };

    esp_err_t err = lp_core_lp_spi_master_transfer(&trans_desc, LP_SPI_TRANS_WAIT_FOREVER);
    if(err != ESP_OK) {
        DEBUG_LOG("Failed to write register: 0x%X, with data = 0x%X\n", reg_addr, data);
        abort();
    }

    return 0;
}

Output needs to be checked with a logic analyzer. Default pins are:

Pin Name Pin Number
MOSI 7
MISO 6
CLK 8
CS 4

Testing SPI3

MOSI and MISO pins connected with a cable (GPIO21-GPIO27) and run this spi exch -b 3 AB command

Results

nsh> spi exch -b 3 AB
Sending:	AB 
Received:	AB

Add LPSPI and SPI3 support for esp32[-p4]

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
Add LPSPI and SPI3 board support for esp32[-p4]

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
Add LPSPI and SPI3 docs for esp32p4

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
@github-actions github-actions Bot added Area: Documentation Improvements or additions to documentation Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Size: L The size of the change in this PR is large Board: risc-v labels May 18, 2026
@xiaoxiang781216 xiaoxiang781216 merged commit f21acd2 into apache:master May 18, 2026
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Area: Documentation Improvements or additions to documentation Board: risc-v Size: L The size of the change in this PR is large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants