STM32 OTGv1 GCCFG initialization bug.
Posted: Mon Apr 10, 2023 8:23 pm
https://github.com/jiaxin96/ChibiOS/blo ... _lld.c#L43,
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_VBUSASEN | \
GCCFG_VBUSBSEN | GCCFG_PWRDWN)
#else
#define GCCFG_INIT_VALUE (GCCFG_VBUSASEN | GCCFG_VBUSBSEN | \
GCCFG_PWRDWN)
#endifWhen 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