cancel
Showing results for 
Search instead for 
Did you mean: 

stm32cube f1 master usb host msc not working

ABhat.7
Associate III

i try to implement stm32f10c example on a custom board with stm32f107 as my controller but it causing the controller to always goes in to hard fault please suggest what to do

10 REPLIES 10
Imen.D
ST Employee

Hello @ABhat.7​ ,

Which Cube package version are you using ? Make sure that you are using the version V1.8.1 (that contains USB update) or upper.

Have you made any changes on the provided example?

Check the heap and stack sizes defined in the startup.s (should be increased).

Please mark my answer as best by clicking on the "Select as Best" button if it helped.

If you still need help, feel free to ask your question in more detail.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

Use an effective Hard Fault Handler and debug the situation..

Stack or Heap size issues?

In any case you're going to have to get a lot more into the details to understand why it is not working.

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

please find my attached .ioc file , i am using v4.3 of cube mx and also increase the stack and heap size accordingly but cannot understand that every time is debug the code i found my application state as start even though i have connected the usb as per hardware point of view i have connected a resistor divider across v bus so that supply is less than 5v please suggest what i am doing wrong

i have already does it but it causing the same situation so i decide to create my own project in cubemx and after increasing heap and stack size also my appli state is always application start which i noticed during debug please suggest what i am doing wrong.

Hi @ABhat.7​ ,

Sorry for the delay to answer you, as I'm working from home and I haven't the STM32F107 board at home.

But, after checking your ioc file, there are some warnings to configure USB parameters in the Platform Settings Tab.

When running your project, I get several errors and warnings.

0693W00000AMcw2QAD.jpg 

I recommend you to use the CubeF1 version V1.8.1 or upper (as contains USB update and enhancements) and refer to the USB MSC example with STM32CubeF1 MCU package:

STM32Cube_FW_F1_V1.x.x\Projects\STM3210C_EVAL\Applications\USB_Host\MSC_Standalone

You can use the example code provided and compare the code/functions with yours. 

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

Hi,@Imen DAHMEN thank for reply first the pics you share is cause warning since i am not using any gpio for the vbus i simply put a resistor divider across the vbus pin and activate it so cubemx is showing error and right now i am using library version v1.8.1 and last i have a custom board with stm32f107 controller so i put just simply compile and debig the code in to the controller but it is causing the hard fault which i notes during debugging so please tell me what i am doing wrong is it necessary to take a gpio for activating vbus and also i note that when we are generating code with cubemx it not defining Dp and Dm as gpio please help me in this

Hi,@Imen DAHMEN thank for reply first the pics you share is cause warning since i am not using any gpio for the vbus i simply put a resistor divider across the vbus pin and activate it so cubemx is showing error and right now i am using library version v1.8.1 and last i have a custom board with stm32f107 controller so i put just simply compile and debig the code in to the controller but it is causing the hard fault which i notes during debugging so please tell me what i am doing wrong is it necessary to take a gpio for activating vbus and also i note that when we are generating code with cubemx it not defining Dp and Dm as gpio please help me in this

Hi, @Imen DAHMEN​  as per your advise i revised my project with latest stm32cubef1 library v1.8.3 so i am attached my latest .ioc file and the warning is coming since i have not selected any option for vbus activation since my idea is to always keep vbus on i.e i simply put a resistor divider that has 4k7 and 10k resistance so that i can get supply as per mentioned in hal usb host document i simply donot want to use any gpio apart from that all configuration is done as per ST usb training video ,kindly advise me what is wrong i am doing that my device is not getting detected while debug i always notice my appli state as application start.

Thanks & wait for early reply

Thank you very much for your support ,now i am able to do mass storage with my custom board having STM32F107 as main controller ,once again thank a lot and except same in future