Skip to main content
Explorer II
August 19, 2024
Solved

STM32H7 with eMMC and USB Mass Storage Class electronics/software question

  • August 19, 2024
  • 2 replies
  • 4524 views

Hello everyone!

 

I have a very important question about a PCB design that I'm making.

I basically have a PCB with a bunch of sensors, a 4Gb eMMC memory and a USB-C connector. Here's the related schematics : 


- Power section : 

yaxsomo_0-1724068353566.png

- Microcontroller (I'm sorry for this layout, I'll make it more readable in the near future) : 

yaxsomo_1-1724068391301.png

- eMMC memory and USB-C connector : 

yaxsomo_2-1724068461863.png

If you see some issues on the schematics please do not hesitate to let me know.
The desired behavior is : 

 

1)  The USB is not connected and the module is powered up -> Data gathering from sensors and logging into the eMMC memory.

2) The USB is connected and powers up the module (with the VBUS pin that goes from the USB to the input of the DC/DC converter) -> Data Retrieval mode -> The sensors are not gathering data neither logging into the eMMC memory, but the module can be accessed with a PC as a USB stick so i can pick up the log data easily. 

 

My question is : Are the electronics schematics showed above good for what i'm doing? How can i switch between this 2 modes by detecting a connection via USB? 

I found this function on the USBD driver that can maybe do the job: 

 

yaxsomo_3-1724068921221.png


Do you know if there's a basic implementation of this function for what I'm trying to do ?

 

I hope my post is clear enough, thank you in advance for your help!



    This topic has been closed for replies.
    Best answer by TDK

    > Are the electronics schematics showed above good for what i'm doing?

    • BOOT0 should be tied to GND, or pulled to ground. It does not need a decoupling capacitor.
    • VCAP pins should have a 2.2 uF capacitor.
    • NRST should have a 0.1 uF decoupling capacitor (possibly exists, but not shown).

    > How can i switch between this 2 modes by detecting a connection via USB?

    This is typically done by sensing the VBUS voltage. When it's present, the USB connection is present. You can put a resistor divider from this voltage to an ADC pin to measure the actual voltage, or you can read it with a digital pin for an on/off indication.

     

    2 replies

    TDKAnswer
    Super User
    August 19, 2024

    > Are the electronics schematics showed above good for what i'm doing?

    • BOOT0 should be tied to GND, or pulled to ground. It does not need a decoupling capacitor.
    • VCAP pins should have a 2.2 uF capacitor.
    • NRST should have a 0.1 uF decoupling capacitor (possibly exists, but not shown).

    > How can i switch between this 2 modes by detecting a connection via USB?

    This is typically done by sensing the VBUS voltage. When it's present, the USB connection is present. You can put a resistor divider from this voltage to an ADC pin to measure the actual voltage, or you can read it with a digital pin for an on/off indication.

     

    yaxsomoAuthor
    Explorer II
    August 19, 2024

    Thank you for the fast response!! For the electronics I'm looking at the microcontroller datasheet, especially this page here : 

    yaxsomo_0-1724073290582.png

    And that's why I used a 100nF capacitor for VCAPs : 

    yaxsomo_1-1724073334681.png

     

    The NRST pin already have a decoupling capacitor here (didn't show that before sorry) : 

    yaxsomo_2-1724073414713.png

    For BOOT0, it's already pulled to ground isn't it? 

    yaxsomo_3-1724073457069.png

     

    So, based on what you've said, if I activate the VBUS on CubeIDE as follows :

    Capture 1.png

    And on my schematics, connect the VBUS of the USB : 

    yaxsomo_4-1724073814615.png

    To the new available VBUS pin of the STM32H7 : 

    yaxsomo_5-1724073876020.png

    I should be able to know whenever a USB connection with my PC is made right ?



     

     

    Super User
    August 19, 2024

    And that's why I used a 100nF capacitor for VCAPs : 

    Is LDO disabled for your layout? This means you need to supply the VCAP voltage yourself, which I don't see in the schematic.

    > For BOOT0, it's already pulled to ground isn't it? 

    That's a capacitor, not a resistor. There will be some leakage, but I would not rely on that to pull down the pin. In any case, having a capacitor instead of a resistor here makes very little sense to me.

     

    The USB is correct in theory, but you may want to put it as a GPIO. Not sure how well integrated VBUS detection is in the USB software stack.

    Technical Moderator
    August 19, 2024

    Additionally:

    • R42 connects VDDA to VREF+, but is short-circuited by a parallel wire. I assume you only want to apply the 3.3V to VDDA and supply VREF+ via the low-pass filter R42+C80/C81, right?

     

    yaxsomoAuthor
    Explorer II
    August 19, 2024

    Dang, I just saw that.. Thank you for pointing the issue, I just tried to follow the datasheet :

    yaxsomo_0-1724074153993.png

    But it seems very confusing. Do you know how can I solve it ?

    Technical Moderator
    August 19, 2024

    As mentioned - feed VDDA by 3.3V directly and just connect the 47ohms from VDDA to VREF+, and keep the caps on both sides of the resistor.