2021-04-22 05:02 AM
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
2021-04-22 05:44 AM
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
2021-04-22 08:55 AM
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.
2021-04-22 10:16 AM
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
2021-04-22 10:18 AM
2021-04-27 04:15 AM
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.
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
2021-04-27 06:12 AM
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
2021-04-27 06:13 AM
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
2021-04-27 08:43 PM
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
2021-05-05 11:02 PM
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