STM32 OTGv1 GCCFG initialization bug. Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
Post Reply
JasonRen
Posts: 1
Joined: Mon Apr 10, 2023 8:17 pm
Been thanked: 1 time

STM32 OTGv1 GCCFG initialization bug.

Post 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
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32 OTGv1 GCCFG initialization bug.

Post by Giovanni »

Hi,

Change committed, thanks.

Giovanni
Post Reply