cancel
Showing results for 
Search instead for 
Did you mean: 

Bug when I plug a USB device

quentin23
Associate II
Posted on April 01, 2016 at 16:05

Hi,

I'm facing trouble when I try to connect a USB device (whatever it is) to my

http://www.st.com/web/en/catalog/tools/PF260320

. As I plug it, my program is stuck here : 0690X00000605NYQAY.png Here is a little connection diagram : 0690X00000605NdQAI.png The LP2980 is a linear regulator. Its ground is connected with the ST's one. The ST32 is powered by the micro-usb (U5V so). This is how I configure my GPIOs into usb_conf.c :

GPIO_InitStruct.Pin = (GPIO_PIN_11 | GPIO_PIN_12);
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); 
GPIO_InitStruct.Pin = GPIO_PIN_6;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

Then I set PA6 to have 3.3V. Has Anyone a idea about this ? #usb #stm32f411re
4 REPLIES 4
torsten2
Associate II
Posted on April 01, 2016 at 20:20

> Has Anyone a idea about this ?

Looks like an exception handler gets called that has just a default implementation and that default implementation is just an endless loop.
quentin23
Associate II
Posted on April 04, 2016 at 12:05

Thanks,

Indeed I forgot to add OTG_FS_IRQHandler in stm32f4xx_it.c. Now I'm facing another problem when I plug it. When I do that, the programm stops running and get stuck somewhere in the dissassembly code.

0x08003068 BEAB           BKPT                          0xAB

When I look into the .map file I've got :

[...]

fputc     0x0800305d   Thumb code     18   fputc.o

free       0x08003071   Thumb code     75   malloc.o

[...]

I precise that I'm using Keil and I began with the Hal_TimeBase (from STM32F411RE-Nucleo) example and be inspired by the MSC_Standalone (from STM324xG_EVAL) to make my project.

I didn't find yet what could be wrong.

Posted on April 04, 2016 at 12:24

You have some printf() but lack any retargeting code that associates that with some output method or USART on your board?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
quentin23
Associate II
Posted on April 04, 2016 at 14:05

Hi clive1,

You point out the right thing. I delete the usb's debug messages which use printf() and now my program run.

Still I cannot detect my device but this is another story and I can debug correctly now.

Thanks you both.