Skip to content

Feature: add option for restarting radio using callback function instead of GPIO (EHM-196) - #175

Open
renzenicolai wants to merge 1 commit into
espressif:mainfrom
Nicolai-Electronics:v2.12.3-reset-callback
Open

Feature: add option for restarting radio using callback function instead of GPIO (EHM-196)#175
renzenicolai wants to merge 1 commit into
espressif:mainfrom
Nicolai-Electronics:v2.12.3-reset-callback

Conversation

@renzenicolai

@renzenicolai renzenicolai commented Mar 20, 2026

Copy link
Copy Markdown

Description

This PR adds support for defining a user controlled reset function outside of the ESP-HOSTED scope, to be used instead of reset using GPIO.

I need this feature because on my product the radio reset pin is not directly controlled using a GPIO on the ESP32-P4 but instead via an I2C connected device, the callback function allows me to reset the radio using this alternative method.

Related

This is a re-implementation of the feature introduced earlier in this PR: #101

Testing

Tested by enabling the new menuconfig option and defining a callback function.

Copilot AI review requested due to automatic review settings March 20, 2026 23:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a configurable “reset slave via user callback” mechanism so boards without a directly connected reset GPIO (e.g., reset driven via an external I2C device) can still reset the radio/slave device.

Changes:

  • Adds Kconfig options (per transport) to select callback-based slave reset and a derived common config flag.
  • Introduces a new OS abstraction hook (_h_restart_slave) with an ESP FreeRTOS implementation that either toggles the reset GPIO or invokes hosted_reset_slave_callback().
  • Updates transport drivers (SPI/SDIO/SPI HD/UART) and power-save reset-gpio hold/release logic to use the new restart/reset path.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
Kconfig Adds menuconfig options to enable callback-based slave reset per transport and a derived common flag.
host/port/esp/freertos/src/port_esp_hosted_host_os.c Implements hosted_restart_slave() and wires it into the OS abstraction table.
host/port/esp/freertos/include/port_esp_hosted_host_config.h Adjusts reset pin macro handling (but currently only for SDIO callback).
host/esp_hosted_os_abstraction.h Extends the hosted_osi_funcs_t table with _h_restart_slave.
host/drivers/transport/uart/uart_drv.c Switches reset logic to _h_restart_slave() (currently introduces a compile error in logging).
host/drivers/transport/spi/spi_drv.c Switches reset logic to _h_restart_slave() via helper.
host/drivers/transport/spi_hd/spi_hd_drv.c Switches reset logic to _h_restart_slave() directly.
host/drivers/transport/sdio/sdio_drv.c Switches reset logic to _h_restart_slave() via helper.
host/drivers/power_save/power_save_drv.c Skips reset GPIO hold/release when callback-based reset is enabled.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread host/drivers/transport/uart/uart_drv.c Outdated
Comment thread host/port/esp/freertos/include/port_esp_hosted_host_config.h
Comment thread host/drivers/transport/spi/spi_drv.c
Comment thread host/drivers/transport/sdio/sdio_drv.c
@renzenicolai
renzenicolai force-pushed the v2.12.3-reset-callback branch from becb28c to 740cce7 Compare March 21, 2026 00:07
@github-actions github-actions Bot changed the title Feature: add option for restarting radio using callback function instead of GPIO Feature: add option for restarting radio using callback function instead of GPIO (EHM-196) Mar 21, 2026
@espressif-bot espressif-bot added the Status: Opened Issue is new label Mar 21, 2026
@renzenicolai

Copy link
Copy Markdown
Author

Can anyone give a progress update? When can I expect this PR to be reviewed and/or merged?

@renzenicolai

Copy link
Copy Markdown
Author

@mantriyogesh @SohKamYung-Espressif

This PR has been waiting for months, I'd love to at least get some form of feedback so we can move this forward. I'd like to get this or similar functionality merged soon so that we can update to new versions of ESP-HOSTED-MCU without having to make any modifications to the core structure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Opened Issue is new

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants