Skip to content

Conversation

@renzenicolai
Copy link

@renzenicolai renzenicolai commented Sep 21, 2025

Description

Adds a kconfig option for resetting the SDIO slave using a callback function instead of a GPIO.

This change is needed because on my product the reset line of the ESP32-C6 slave is not directly connected to the ESP32-P4.

This PR adds support for optionally defining a function in user code to replace the reset action normally executed using a GPIO pin, allowing for a custom reset procedure. In our case we send a command to an I2C device in order to reset the ESP32-C6 radio.

Related

Testing

Tested on our hardware using an ESP32-C6 as SDIO slave device.


Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

mantriyogesh and others added 30 commits March 6, 2025 17:06
enhance(transport_config) Get config from transport_config

See merge request app-frameworks/esp_hosted_mcu!22
fix(slave/compiler): Optimization to be performance, -O2 instead of -Og

See merge request app-frameworks/esp_hosted_mcu!36
- add GPIOs for Handshake and Data Ready for C5 as co-processor. Other
  SPI GPIO on C5 subboard are default values
- for P4 Host, define GPIOs used to communicate with C5 subboard
  - tested with standard SPI and SPI-HD (4 data lines)
- add GPIO settings for H2 as host
  - tested with standard SPI and SPI-HD (2 data lines)
- remapped C5_SPI_CLK to CS_WAKE_UP
- bumped version
feat(h2_c5_board) Add C5 sub board for P4 host, add H2 as host

See merge request app-frameworks/esp_hosted_mcu!38
- add reset pin config to transport configs
- add API to get reset pin config
- get and use reset pin config in `reset_slave()`
- bumped version
enhance(transport_config_reset) Add Reset pin config to transport config

See merge request app-frameworks/esp_hosted_mcu!39
workaround(sdio_host): restart host if sdio slave is unresponsive

See merge request app-frameworks/esp_hosted_mcu!41
bugfix(stats) Fix build failure when raw throughput test is enabled

See merge request app-frameworks/esp_hosted_mcu!44
…fter SPI CS deasserted

- added config to deassert Handshake only after CS is deasserted, and
  wait for the next CS assertion to start a transaction
- on some MCUs, deasserting the SPI CS signal can be delayed after the
  end of a SPI transaction
- when this happens, the slave may mis-detect this as the start of a new
  SPI transaction (since CS is still low), resulting in data loss
- removed extra GPIO pin config for C5
enhance(deassert_hs_after_cs) Deassert HS and start new transaction after SPI CS deasserted

See merge request app-frameworks/esp_hosted_mcu!45
- Make sure mempool memory is allocated from DMA capable memory, even
  if PSRAM is enabled
bugfix(fg_mempool): Allocate mempool from DMA capable memory

See merge request app-frameworks/esp_hosted_mcu!47
- Kconfig option to select slot
- adjust SDIO GPIOs used based on selected SDMMC slot
- added a workaround for a ESP-IDF check on SDMMC slot 0 that
  prevented proper operation in 1-bit SDIO mode
- tested both slots on ESP32-P4 Dev Board:
  - slot 0 with ESP32 on a SDMMC card: OK
  - slot 1 with ESP32C6 on-board: OK
- compiled for ESP32: OK
- compiled for ESP32-S3: OK
enhance(support_sdio_slots) Add SDIO slot configuration

See merge request app-frameworks/esp_hosted_mcu!46
bugfix(reset_config) Fixes the usage of sdkconfig to switch reset active high/low

See merge request app-frameworks/esp_hosted_mcu!48
- bumped version to 2.0.0
- preparation for adding porting code for other MCUs
- move code from `host/port` to `host/port/esp/freertos`
- moved hosted api for OTA update into porting layer
  - code to fetch OTA is system dependent
- updated documentation on doing OTA
- tested by building for ESP32-P4, and fetching OTA to update
  co-processor
  - works as expected
feat(code_reorg) Moved ESP porting layer

See merge request app-frameworks/esp_hosted_mcu!49
- Fix a build break using latest ESP-IDF master due to changes in
  `wifi_sta_config_t`
- conditional compile using `ESP_IDF_VERSION` for backward
  compatibility
- Use `H_xxx` instead of `CONFIG_ESP_HOSTED_xxx` to calculate counting
  semaphore size
- Bump version
- Closes espressif#47
bugfix(idf_master): Fix build break using ESP-IDF master

See merge request app-frameworks/esp_hosted_mcu!50
- prefix function names in `rpc_slave_if` with `rpc_slaveif_`
- to prevent function name collision with `espressif/console_cmd_wifi`
- clean-up: removed unused functions
bugfix(rename_wifi_fn): Renamed wifi functions in RPC slave code

See merge request app-frameworks/esp_hosted_mcu!51
- added code to print mem stats along with packet stats
- added code to increment pkt_stats.sta_rx_out
mantriyogesh and others added 23 commits October 3, 2025 19:37
  - Add staging branch as default MR target
  - Create staging branch rules for regression testing
  - Add job to promote staging to main after regression passes
  - Update scheduled jobs to run on staging branch
test the staging architecture with dummy MR

See merge request app-frameworks/esp_hosted_mcu!128
test staging architecture

See merge request app-frameworks/esp_hosted_mcu!129
- renamed pipelines to "sanity" and "regression"
- made the job names unique so they won't clobber one another in the
  YAML file
bugfix(build_ci): Enabled missing jobs on CI regression pipeline

See merge request app-frameworks/esp_hosted_mcu!130
- used compatible version `idf-build-apps` that came with the IDF version
- enabled constraints to prevent incompatible versions of components
  being used while building
- removed IDF v5.3 and v5.3.1 when building for P4: not compatible
  - fix added for v5.3.2 onwards
- fixed bug in building bt_hid_mouse_device example
  - no esp_bt_cod_t::minor parameter in IDF v5.3 and v5.3.1
- fixed bug in `sdkconfig.default` for host_transport_config
  - missing newline at end of file caused append operation in CI
    scripts to misbehave
- fixed bug causing host spi_hd transport building to fail
- fixed bug causing host uart transport building to fail on ESP32-H2
  - missing `Kconfig` UART options
Bugfix/build ci 2

See merge request app-frameworks/esp_hosted_mcu!131
- added SPI support for C61
- use `SOC_SPI_SUPPORT_SLAVE_HD_VER2` to check for SPI Slave HD
  support
- updated GPIOs for SPI-FD and SPI-HD
- marked SPI-HD pins D4-7 as unused to prevent GPIO warnings in spi
  driver during spi initialisation
- updated docs
  - corrected CONFIG_xxx values to use to setup wi-fi settings
  - added optimised Wi-Fi settings for various co-processors
- fixed build errors when raw throughput is enabled
- fixed bug in SDIO on co-processor causing it to work in packet mode only
feature(esp32c61_support): Add support for C61 as co-processor

See merge request app-frameworks/esp_hosted_mcu!90
  - 2.6.0
- Changes
  - Added public OTA APIs for slave firmware updates
  - Added host-triggered slave OTA example with support for HTTP, partition, and filesystem sources
  - Support for LittleFS filesystem-based OTA updates
- APIs added
  - `esp_hosted_ota_begin`
  - `esp_hosted_ota_write`
  - `esp_hosted_ota_end`
  - `esp_hosted_ota_activate`
- APIs deprecated
  - `esp_hosted_slave_ota` - Use the new OTA examples instead for more flexible OTA implementations
- Examples added
  - `host_performs_slave_ota` - Host-triggered slave OTA example supporting HTTP URLs, partition sources and  LittleFS filesystem sources
ESP-Hosted Slave OTA APIs with example

See merge request app-frameworks/esp_hosted_mcu!133
Minor fixes in slave ota example

See merge request app-frameworks/esp_hosted_mcu!134
- fixed bug in enabling `esp_eap_client_set_eap_methods` on co-processor based on ESP-IDF version
- Closes: espressif#114
bugfix(set_eap_methods): Fixed bug in enabling set_eap_methods

See merge request app-frameworks/esp_hosted_mcu!135
- increased reset timing from 1 ms to 10 ms delay, to account for
  100Hz FreeRTOS clock tick
- corrected version where some RPC commands were implemented
- add earlier versions to Changelog
- used iPerf diagram in performance optimization documentation
- updated sdio wrapper and driver
  - made delay after co-processor reset a Kconfig option
  - retry sdio card init several times
- Closes espressif#116
fix(reset_timing): Fixed reset timing for transports

See merge request app-frameworks/esp_hosted_mcu!132
fix(wifi): remove  incorrect clearing of esp_hosted_init_done in esp_wifi_remote_deinit()

See merge request app-frameworks/esp_hosted_mcu!139
@renzenicolai
Copy link
Author

renzenicolai commented Nov 12, 2025

I'd love to know when this could be merged or if adding support for such a feature is planned in some other way. Suggestions for changes are welcome of course, just let me know what is needed.

@mantriyogesh
Copy link
Collaborator

I understand why you needed to make this change.

IMO, instead of giving options like this, better we move the slave reseting to port layer.

The port layer implements the function pointer based logic. so if you wish your own way to reset, should be able to hook with that function. the sdio, spi hd, spi fd & uart transports basically should then use the ported function to reset the slave.

I think the port layer here should give you fair idea what I meant.

for example,
_h_msleep interface is defined here and implemented as hosted_msleep()
hosted_msleep definition . Then called in main code base as, g_h.funcs->_h_msleep(10);

I hope you are following till here. in the same way, we can create the g_h.funcs->h_reset_slave() or ``g_h.funcs->h_reset_coprocessor()` can be added in similar lines and used. the port layer is meant to change as per your convenience. but the main code then remains intact.

@renzenicolai
Copy link
Author

Sounds like a good idea, would this be something Espressif is interested in developing?

@mantriyogesh
Copy link
Collaborator

yes. the changes are small.. if you can accomodate in your PR, would be highly useful.

Otherwise, we will take it ahead later..

@renzenicolai renzenicolai deleted the feat/sdio-reset-using-callback branch December 16, 2025 00:11
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.