0
\$\begingroup\$

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! :)

EDIT:

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. :)

\$\endgroup\$
  • \$\begingroup\$ The question would be, does the ESP32 release the SDIO pins when it is not enabled? If not, the STM32 won't be able to access the card. \$\endgroup\$ – Dave Tweed Aug 16 '19 at 22:40
  • 1
    \$\begingroup\$ MicroSD cards are stateful; you would have to make sure that whatever processor "owns" it at a given time be able to finish up and put the card into a state where the other could take it over. \$\endgroup\$ – TimWescott Aug 16 '19 at 22:43
  • \$\begingroup\$ As I know when the CHIP_PU pin is pulled low the entire ESP32 is disabled. That means that SDIO pins will also be released, I think. \$\endgroup\$ – Dada Kräuter Aug 16 '19 at 22:47
  • \$\begingroup\$ Yes, accessing SD card will be managed carefully and I will consider everything. I am worried about connecting them together so when ESP32 will be in operating mode it will be also connected to STM32's SDIO pins and I don't want to damage anything, that's why I am interested if open drain high impedance mode will isolate STM32's SDIO pins from ESP32. \$\endgroup\$ – Dada Kräuter Aug 16 '19 at 22:50
  • 2
    \$\begingroup\$ If you mean that power is removed from the ESP32, then beware. Its internal protection diodes may effectively tie the SDIO lines to ground, making them unusable. \$\endgroup\$ – Dave Tweed Aug 16 '19 at 23:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.