cancel
Showing results for 
Search instead for 
Did you mean: 

Hello guys, I am working with STM32G0C1RET6. I want to use STM32 as a USB host and want to save data on USB flash stick. I followed some tutorial from ST microcontroller's youtube channel but I am still not able to mount my USB device. what should I do?

jsoda.1
Associate III

Here are details about my project:

  • I have connected my USB_DM and USB_DP pin directly to USB connector.
  • I enable A9 and selected as a GPIO output using VBUS setting in CUBEIDE. Which is providing me 3.3V
  • I read that there is inbuilt pull up resistor in STM32G0C1RET6. So, I connected USB connector directly to pins
  • I used "f_mount" function to mount my usb device.

My USB device is using FAT32 format. I AM SORRY if I made some dumb mistake; I am newbie

12 REPLIES 12
Muhammed Güler
Senior III

0693W00000NpnHjQAJ.pngIf your USB connection is as above, I recommend that you find the MX_DriverVbusFS function in the usbh_platform.c file and make its content compatible with your power switch IC.

https://www.st.com/resource/en/application_note/dm00296349-usb-hardware-and-pcb-guidelines-using-stm32-mcus-stmicroelectronics.pdf

Hiii, thank you so much for suggestion. Is it necessary to set USB connection as you showed in image??

I​ didn't make any connection like that. I just connected USB connector pin to STM32's A9 pin.

A couple of times I accidentaly swapped USB DATA+ and DATA- Lines, double check you didnt do the same.

https://www.youtube.com/watch?v=vwlXUOY7KY0&list=PLnMKNibPkDnFFRBVD206EfnnHhQZI4Hxa&index=7&ab_channel=STMicroelectronics

Available for consulting/freelancing , hit me up in https://github.com/javiBajoCero
Javier1
Principal

Leave a link to the youtube tutorial youre trying to follow and maybe some pictures of your hardware

Available for consulting/freelancing , hit me up in https://github.com/javiBajoCero

Hi, thank you so much for reply. No, I made sure that I don't interchange DP and DM lines. Both connections are correct..Here is link of the video I am following:

https://www.youtube.com/watch?v=dC0d8CVEPrQ&list=PLnMKNibPkDnFFRBVD206EfnnHhQZI4Hxa&index=20

Sorry but I can't get picture of hardware. Do I need to use "Current limiter power switch"??

When I run program FRESULT shows FR_DISK_ERR. what does that mean?

0693W00000NpqstQAB.png

>>When I run program FRESULT shows FR_DISK_ERR. what does that mean?

Means your DISKIO layer isn't working, fix that first.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Okay. I will update after fixing this. Thank you so much.

Do I need to use "current limiter switch" as shown in below diagram OR I can just directly connect STM32 pin with USB connector??

During the installation phase, the power of the usb disk needs to be cut and re-applied. It is necessary for safety to have current limitation, but you must use a switch

Muhammed Güler
Senior III

You can use STMPS2141 as switch. I also recommend adding a protection element such as USBLC6-2SC6 to the USB data line.​