Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Fix disabled GPIO groups D & E on some of STM32L4xx family caused by a ChibiOS "Oops!" #14280

Closed
donicrosby opened this issue Sep 2, 2021 · 1 comment

Comments

@donicrosby
Copy link

Update ChibiOS to the latest version of the stable 20.3.x branch to allow for the STM32L4xx (found in at least the STM32L443 but possibly other MCUs). ChibiOS has in the stm32_registry.h for the STM32L4xx family it says it does not have a GPIO D & E group but the MCU does in fact have those GPIO groups.

Describe the Bug

For at least the STM32L443 (QMK uses that as the MCU for the STM32L433 as well), the ChibiOS does not enable a few of the GPIO groups for that MCU even through they are actually on the MCU and don't have a "programmatic" cost to enable them.

Currently is:

#if defined(STM32L443xx) || defined(__DOXYGEN__)
-- snip --
#define STM32_HAS_GPIOA                     TRUE
#define STM32_HAS_GPIOB                     TRUE
#define STM32_HAS_GPIOC                     TRUE
#define STM32_HAS_GPIOD                     FALSE
#define STM32_HAS_GPIOE                     FALSE
-- snip --
#define STM32_HAS_GPIOH                     TRUE
-- snip --
#define STM32_GPIO_EN_MASK                  (RCC_AHB2ENR_GPIOAEN |          \
                                             RCC_AHB2ENR_GPIOBEN |          \
                                             RCC_AHB2ENR_GPIOCEN |          \
                                             RCC_AHB2ENR_GPIOHEN)

Should be:

#if defined(STM32L443xx) || defined(__DOXYGEN__)
-- snip --
#define STM32_HAS_GPIOA                     TRUE
#define STM32_HAS_GPIOB                     TRUE
#define STM32_HAS_GPIOC                     TRUE
#define STM32_HAS_GPIOD                     TRUE
#define STM32_HAS_GPIOE                     TRUE
-- snip --
#define STM32_HAS_GPIOH                     TRUE
-- snip --
#define STM32_GPIO_EN_MASK                  (RCC_AHB2ENR_GPIOAEN |          \
                                             RCC_AHB2ENR_GPIOBEN |          \
                                             RCC_AHB2ENR_GPIOCEN |          \
                                             RCC_AHB2ENR_GPIODEN |          \
                                             RCC_AHB2ENR_GPIOEEN |          \
                                             RCC_AHB2ENR_GPIOHEN)

Additional Context

From my discussion with Giovanni it looks like there may be some other MCUs that had this error so this would fix those as well. These changes are backported from the more recent 21.6.x branch.

There is no way to override the stm32_registry.h in ChibiOS during the build so for things like this meaning QMK is dependent on upstream configuration changes. It may make sense to allow for keyboards to supply a stm32_registry.h so that there isn't so much extra work to get things like configuration updates for the project.

@tzarc
Copy link
Member

tzarc commented Aug 29, 2022

Fixed in latest ChibiOS.

@tzarc tzarc closed this as completed Aug 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants