Page 1 of 1

STM32 OTGv1 GCCFG initialization bug.

Posted: Mon Apr 10, 2023 8:23 pm
by JasonRen
https://github.com/jiaxin96/ChibiOS/blo ... _lld.c#L43,

Code: Select all

#if defined(BOARD_OTG_NOVBUSSENS)
#define GCCFG_INIT_VALUE        (GCCFG_NOVBUSSENS | GCCFG_VBUSASEN |        \
                                 GCCFG_VBUSBSEN | GCCFG_PWRDWN)
#else
#define GCCFG_INIT_VALUE        (GCCFG_VBUSASEN | GCCFG_VBUSBSEN |          \
                                 GCCFG_PWRDWN)
#endif


When VBUSSENS is disabled, the initialization parameters are wrong, which leads to some USB pins not working properly as GPIO. It should be changed to the following definition:

Code: Select all

#if defined(BOARD_OTG_NOVBUSSENS)
#define GCCFG_INIT_VALUE        (GCCFG_NOVBUSSENS | GCCFG_PWRDWN)
#else
#define GCCFG_INIT_VALUE        (GCCFG_VBUSASEN | GCCFG_VBUSBSEN |          \
                                 GCCFG_PWRDWN)
#endif

Re: STM32 OTGv1 GCCFG initialization bug.

Posted: Fri Apr 14, 2023 10:00 am
by Giovanni
Hi,

Change committed, thanks.

Giovanni