Currently running Chibios on a Giga devices GD32F405(STM32F4xx). Virtually everything works apart from the USB FS Device.
It looks to start enumerating but windows then show error as device not known.
Having spoken the GD FAE Manager, they say this
"In most cases, the configuration order of USB FIFO needs to be modified. ST's USB library refreshes FIFO first, then configures it. GD's USB must be configured with USB FIFO before refreshing. The order in which FIFOs are refreshed and configured applies to OTG devices and HOST."
Just wondering if anyone else has any other knowledge of this ?
Giga devices GD32F405 USB Device
Moderators: RoccoMarco, lbednarz, utzig, tfAteba, barthess
Re: Giga devices GD32F405 USB Device
Still trying to get to the bottom of this issue
if i comment out these two asserts
osalDbgAssert(!usbGetReceiveStatusI(usbp, ep), "already receiving");
osalDbgAssert(!usbGetTransmitStatusI(usbp, ep), "already transmitting");
and in usb_lld_start i put a break point on otg_core_reset(usbp);
hitting the break point means the system halts at the break point, when continues is pressed the USB CDC will work....
Now if remove the break point and run the system, USB CDC errors.
Seems this otgp->GCCFG = GCCFG_INIT_VALUE; needs time
if i comment out these two asserts
osalDbgAssert(!usbGetReceiveStatusI(usbp, ep), "already receiving");
osalDbgAssert(!usbGetTransmitStatusI(usbp, ep), "already transmitting");
and in usb_lld_start i put a break point on otg_core_reset(usbp);
hitting the break point means the system halts at the break point, when continues is pressed the USB CDC will work....
Now if remove the break point and run the system, USB CDC errors.
Seems this otgp->GCCFG = GCCFG_INIT_VALUE; needs time
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Giga devices GD32F405 USB Device
Probably it is a race condition, that driver needed insertion of small delays in the past. Probably the OTG is configured a bit differently on this device.
Giovanni
Giovanni
Re: Giga devices GD32F405 USB Device
Giovanni wrote:Probably it is a race condition, that driver needed insertion of small delays in the past. Probably the OTG is configured a bit differently on this device.
Giovanni
do you have any recommendations to help debug this ?
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Giga devices GD32F405 USB Device
Adding small delays or try to slow down the core using -O0 or a lower clock.
That OTG IP is hard to use.
Giovanni
That OTG IP is hard to use.
Giovanni
- russian
- Posts: 364
- Joined: Mon Oct 29, 2012 3:17 am
- Location: Jersey City, USA
- Has thanked: 16 times
- Been thanked: 14 times
Re: Giga devices GD32F405 USB Device
Tabulous wrote:do you have any recommendations to help debug this ?
Did you get this to work?
http://rusefi.com/ - electronic fuel injection
Re: Giga devices GD32F405 USB Device
russian wrote:Tabulous wrote:do you have any recommendations to help debug this ?
Did you get this to work?
Sort of but only by adding delays which makes the enumeration slow, i would really like to get to the route cause and fix it correctly, but just not had the time.
Re: Giga devices GD32F405 USB Device
this is what i found works. Adding a delay here if MCU type is GD32.
Code: Select all
static void otg_polled_delay(rtcnt_t cycles)
{
rtcnt_t start = chSysGetRealtimeCounterX();
rtcnt_t end = start + cycles;
do
{
__asm("");
WWDG->CR = ( 127 );
WWDG->SR = ( 000 );
}
while (chSysIsCounterWithinX(chSysGetRealtimeCounterX(), start, end));
}
static void otg_core_reset(USBDriver *usbp) {
stm32_otg_t *otgp = usbp->otg;
osalSysPolledDelayX(32);
if(systemGetMcuType() == APP_MCU_GD32F)
{
otg_polled_delay(25000000);
}
/* Core reset and delay of at least 3 PHY cycles.*/
otgp->GRSTCTL = GRSTCTL_CSRST;
while ((otgp->GRSTCTL & GRSTCTL_CSRST) != 0)
;
osalSysPolledDelayX(18);
/* Wait AHB idle condition.*/
while ((otgp->GRSTCTL & GRSTCTL_AHBIDL) == 0)
;
}
Who is online
Users browsing this forum: No registered users and 32 guests