USB-CDC not enumerating

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
Debbio
Posts: 16
Joined: Fri Jan 11, 2013 10:42 am

USB-CDC not enumerating

Post by Debbio »

Hi,
i ask you some suggestions on usb enumeration process, some debug tips..

Here's my context:
-chibios 2.5.2 from github (very recent)
-stm32f105vc device
-custom board (see usb scheme attached)
-usb over serial code pasted from UDB_CDC demo ( f107 devices ,connectivity line)
-chibios system seems to work correctly
-same usb pinout config as testhal demo : usb pins as input ( usb redirects pin automatically)
-systems continue running well, just does not care about usb ..

USB CONNECTOR SCHEME
USB connector scheme
USB connector scheme
usbScheme.png (30.81 KiB) Viewed 9867 times



When i plug the cable o i reset the chip i got USB_EVENT_RESET but i never get USB_EVENT_ADDRESS or USB_EVENT_CONFIGURED..

SIGNALS :
VBUS = HIGH
USBID = HIGH
D+ / D - = LOW

CHIBIOS USB DRIVER STATE
GDB usb driver state during normal running
GDB usb driver state during normal running
usbDriver.PNG (13.49 KiB) Viewed 9867 times


On PC side of course nothing happens when i plug or unplug usb cable..

So , can someone prepare a short list of what i've to check in order to narrow this problem ?
I tried even the hal demo itself and i got the same result ..

Thanks in advance.
Matteo D.

p.s. It's my first message , i want to say that Chibios it's very very powerfull and well built...
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: USB-CDC not enumerating

Post by Giovanni »

Hi Matteo,

I would check things in this order:

1) I/O pins settings. I think the F107 should use the same setting of the USB demo in .\testhal\STM32F1xx\USB_CDC_F107. You have a custom board.h I assume, verify that.
2) Clock settings, the driver should complain about clock settings related problems but that happens at compile time only, it could be an HW problem, you could verify the real clock using the MCO pin.

I will try to re-run the demo as soon as possible, I don't have a board at hand right now with a CL device.

Giovanni
Debbio
Posts: 16
Joined: Fri Jan 11, 2013 10:42 am

Re: USB-CDC not enumerating

Post by Debbio »

well,
I checked clock configuration mcuconf.h and mco pin
72 mhz outpup on MCO when system clock is seleceted as source
36 mhz output on MCO when PLLDIV2 is seleceted as source
STM32_OTGFSPRE == 3 -> 48 mhz ( 72 * 2 / 3 == 48 )

PINOUT :
i tried every kind of pin configuration and the right one according to datasheet should be : all pin as input floating for OTG .

I checked if OTG V1 module is compiled ( not the USB ) and even this one is ok..

i tried the demo again and nothing ..

Of course i tried with an other usb cable..but nothing happens..

There is some hw check to do in order to see if chibios driver really try to start usb otg peripheral ?

Thank you for hints.
Matteo D.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: USB-CDC not enumerating

Post by Giovanni »

Examine registers but the driver is routinely used on the F407 so I doubt it has problems, I will be able to make a test in the evening.

Giovanni
Debbio
Posts: 16
Joined: Fri Jan 11, 2013 10:42 am

Re: USB-CDC not enumerating

Post by Debbio »

i found something but is not enough :

- physel on otgp->GUSBCFG in chibios driver refers to bit 6 but datasheet refers to bit 7
- trdt value : my ahb prescaler is set to 1 so trdt value should be 9 instead of 5 : ahb 72 mhz

But that's not enough ( if my modifications are corrects !! ) have you made some driver changes in some recent implementation explaing this variation for physel bit ?
Maybe if driver was modified a lot i can find other variations explaining my specific behaviour.

Thank you for very quick response Giovanni.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: USB-CDC not enumerating

Post by Giovanni »

Hi,

I compiled the demo ./testhal/STM32F1xx/USB_CDC_F107 running on an Olimex STM32-P107 (rev.A) and it worked immediately (code from trunk). You should verify the HW at this point because the driver works, the peripheral is enumerated and recognized.

You may consider getting one of those boards as reference. Also verify your board.h comparing it with the board.h of the Olimex board, of course the pins that are related to USB.

Giovanni
Debbio
Posts: 16
Joined: Fri Jan 11, 2013 10:42 am

Re: USB-CDC not enumerating

Post by Debbio »

Thank you for testing driver immediatly..

I made a check on olimex board configuration to identify hw differencies from my custom board hw and configurations..well there is no substantial variation in board.h and xxxconf.h except for internal resonator HSI (enabled in olimex but both have external 25Mhz ).

Maybe there is some clock propagation related problem due to the fact another periphal ,I2c is not working ( ther is no clock and data out in master trasmit even sda and scl both go at low logic level in start bit ) while EXTI and TIM4 & TIM5 are working.

I'll keep you informed on it in the case i find something os related .. but after your tests i don't think so.

Your help is very appreciated!

Matteo D.
Debbio
Posts: 16
Joined: Fri Jan 11, 2013 10:42 am

[SOLVED] Re: USB-CDC not enumerating

Post by Debbio »

As you said it was an HW issue..OTG_VBUS does not get connected to USB VBUS on the connector.

SORRY FOR HOURS YOU WASTED. My hardware specialist will pay for that :D ( iwas kidding ..)

Driver behaves ok with STM32F105VC.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: USB-CDC not enumerating

Post by Giovanni »

Good :) good luck with your project.

Giovanni
Post Reply