I am new to this community so I am sorry if I'm asking in a wrong place or something out of topic. I think I have considered everything. :)
So, now the basic info: I am working on a project which involves two MCUs, STM32(STM32L496VGT6) and ESP32(ESP32-PICO-D4). STM32 is the main MCU in my project, it controls wireless power receiver, battery charger, captures video, records audio and so on. ESP32 is used for data transfer(video, audio...). By default ESP32 is disabled and is only activated by the main MCU(Pulling CHIP_PU(EN) pin of ESP32 to high) when wireless functionality is needed.
The micro SD card is connected to STM32 via the SDIO interface so the video and audio data can be written on it. But when I want to send data over WiFi I want to connect the same micro SD card directly to ESP32's SDIO with the same traces to maintain max transfer speed between ESP32 and micro SD card. Because I was not confident of the reliability and safety of such connection, because now ESP32 and STM32 share the same pins, I have added SDIO demultiplexer from Texas Instruments(TS3A27518ERTWR) to my project.
I tought about one solution. I really want to remove this demux IC from my project to save cost and space. What if I put every SDIO pin of STM32(which are conneted to micro SD card) in GPIO_Output open drain high impedance mode when ESP32 is ready to use the micro SD card(ESP32 will be able to communicate to micro SD card only when STM32 will give it a signal over USART line)? After that when ESP32 will finish it's tasks the STM32 will disable ESP32 and will reinitialize SDIO pins as needed for normal operation.
So, my question is exactly that. If I put STM32's SDIO pins in GPIO_Output open drain high impedance mode will I be safe to use the micro SD card from ESP32?
I think I was pretty specific and I hope you will understand everything. Big thanks for your help! :)
Okay, after some replies and additional research I got some updates.
Firstly it is true that SDIO(MTMS, MTDO, GPIO2, GPIO4, MTDI, MTCK) pin states of ESP32 when it is in shutdown mode must be considered. I think they can't be tied directly to STM32's SDIO pins because they are also strapping pins according to ESP32's datasheet and in shutdown mode they are configured as GPIO_Inputs with internal weak pull-up/pull-downs enabled, so maybe they will interfere with STM32<->micro SD communication.
Secondly, if we assume that ESP32 will "not present at all" when it's in shutdown mode STM32 will normally, without any problems, talk with the micro SD card. But what about the second scenario, when ESP32 is talking with the micro SD card? I still don't know if setting SDIO pins of STM32 as GPIO_Outputs with open drain high impedance mode will "remove" STM32 from that line. Can someone answer me on that? :)
So, if first statement is true about interference caused by internal pull-up/pull-down resistors inside ESP32 I need to use SDIO demultiplexer. And if it's not a problem but STM32 can't be "removed" from SDIO line by configuring it's pins as GPIO_Outputs with open drain high impedance mode I still need the demultiplexer.
Thanks to everyone. :)