Skip to content

Calling sdmmc_host_deinit(...) will reset pin #0 if all SD card slots are not used (IDFGH-16866) #17937

@therealergo

Description

@therealergo

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

This issue is present in ESP-IDF 5.5.1, though I suspect that the issue is also present in previous versions.

Inside of sdmmc_host_deinit(), ESP-IDF loops through all possible SD card slots in the system. It then calls sdmmc_host_deinit_slot_internal(...) on all of those slots, without checking whether the slots have previously been initialized. If a slot has never been initialized, all of the GPIO structures for that slot appear to be zero-filled. As a result, reset_pin_if_valid(0) is repeatedly called for the uninitialized slot. This resets pin #0, causing issues if that pin is used elsewhere for other functions.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions