cancel
Showing results for 
Search instead for 
Did you mean: 

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

yaxsomo
Associate III

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!



1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

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

 

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

10 REPLIES 10
TDK
Guru

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

 

If you feel a post has answered your question, please click "Accept as Solution".
Peter BENSCH
ST Employee

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?

 

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
yaxsomo
Associate III

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 ?



 

 

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 ?

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.

If you feel a post has answered your question, please click "Accept as Solution".
yaxsomo
Associate III

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

Oh I didn't know that. I just assumed it was a functionnality that I didn't need. Made the change and switched to 2.2uF capacitors!


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.

That's so *** of me, you're totally right. An attention error, I'll change it right away, thanks!

 

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.

I see, I'll put it as GPIO and use it as voltage detector. Do you think that i can connect it "as is" or do i have to add extra passive components?

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.

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

I see now : 

yaxsomo_0-1724078869845.png

Looks better now!

> I see, I'll put it as GPIO and use it as voltage detector. Do you think that i can connect it "as is" or do i have to add extra passive components?

I would put a resistor divider so the voltage is max 3.3V when USB is connected. 5V can be safe, but you would need to verify the pin can handle it. Most can.

If you feel a post has answered your question, please click "Accept as Solution".