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
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
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...
USB-CDC not enumerating
Moderator: RoccoMarco
- 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
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
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
Re: USB-CDC not enumerating
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.
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.
- 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
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
Giovanni
Re: USB-CDC not enumerating
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.
- 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.
- 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
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
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
Re: USB-CDC not enumerating
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.
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.
[SOLVED] Re: USB-CDC not enumerating
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
( iwas kidding ..)
Driver behaves ok with STM32F105VC.
SORRY FOR HOURS YOU WASTED. My hardware specialist will pay for that
Driver behaves ok with STM32F105VC.
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times