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

cpu/stm32: Implement periph/gpio_ll{,_irq} except for STM32F1 #17981

Merged
merged 1 commit into from
May 24, 2022

Conversation

maribu
Copy link
Member

@maribu maribu commented Apr 22, 2022

Contribution description

Implements gpio_ll and gpio_ll_irq for STM32* except for STM32F1.

Testing procedure

make BOARD=nucleo-<foo> -C tests/periph_gpio_ll

Testing State

  • STM32F0 (bluepill-stm32f030c8, @maribu)
  • STM32F1 (Cannot test, no implementation yet)
  • STM32F2
  • STM32F3 (Nucleo-F303RE, @maribu)
  • STM32F4 (Nucleo-F446RE, @maribu)
  • STM32F7 (Nucleo-F767ZI, @maribu)
  • STM32G0
  • STM32G4
  • STM32L0 (Nucleo-L011K4, @maribu)
  • STM32L1
  • STM32L4 (Nucleo-L432KC, @maribu)
  • STM32L5 (Nucleo-L552ze-q, @krzysztof-cabaj)
  • STM32MP1
  • STM32U5
  • STM32WB
  • STM32WL

Issues/PRs references

Depends on and includes: #16787

@github-actions github-actions bot added Area: build system Area: Build system Area: cpu Area: CPU/MCU ports Area: doc Area: Documentation Area: drivers Area: Device drivers Area: Kconfig Area: Kconfig integration Area: tests Area: tests and testing framework Platform: ARM Platform: This PR/issue effects ARM-based platforms labels Apr 22, 2022
@maribu maribu added Type: new feature The issue requests / The PR implemements a new feature for RIOT State: waiting for other PR State: The PR requires another PR to be merged first and removed Platform: ARM Platform: This PR/issue effects ARM-based platforms Area: doc Area: Documentation Area: tests Area: tests and testing framework Area: build system Area: Build system Area: Kconfig Area: Kconfig integration labels Apr 22, 2022
@benpicco benpicco removed the State: waiting for other PR State: The PR requires another PR to be merged first label Apr 22, 2022
Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Co-authored-by: Alexandre Abadie <alexandre.abadie@inria.fr>
@github-actions github-actions bot added Area: Kconfig Area: Kconfig integration Platform: ARM Platform: This PR/issue effects ARM-based platforms and removed Area: drivers Area: Device drivers labels Apr 22, 2022
@maribu maribu added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Apr 22, 2022
@krzysztof-cabaj
Copy link
Contributor

Hi. I tested this PR using Nucleo-L552ze-q. Test output:

<snip>
TEST SUCCEEDED
{ "threads": [{ "name": "main", "stack_size": 1536, "stack_used": 440 }]}

@benpicco benpicco requested a review from fabian18 April 23, 2022 08:55
@bergzand
Copy link
Member

Tested the nucleo-g474re:

2022-05-17 10:21:58,552 # TEST SUCCEEDED
2022-05-17 10:21:58,558 # { "threads": [{ "name": "main", "stack_size": 1536, "stack_used": 432 }]}

Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we could make porting a bit easier though while we're at it

# ifdef PWR_CR2_IOSV
# define PORTG_REQUIRES_EXTERNAL_POWER
# endif
#elif defined(CPU_FAM_STM32MP1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#elif defined(CPU_FAM_STM32MP1)
#elif defined(RCC_MC_AHB4ENSETR_GPIOAEN)

defined(CPU_FAM_STM32G4) || defined(CPU_FAM_STM32L5) || \
defined(CPU_FAM_STM32U5) || defined(CPU_FAM_STM32WL)
#define GPIO_BUS AHB2
# if defined(CPU_FAM_STM32U5)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# if defined(CPU_FAM_STM32U5)
# if defined(RCC_AHB2ENR1_GPIOAEN)

#if defined(CPU_FAM_STM32F0) || defined(CPU_FAM_STM32F3) || defined(CPU_FAM_STM32L1)
# define GPIO_BUS AHB
# define GPIOAEN RCC_AHBENR_GPIOAEN
#elif defined(CPU_FAM_STM32L0) || defined(CPU_FAM_STM32G0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#elif defined(CPU_FAM_STM32L0) || defined(CPU_FAM_STM32G0)
#elif defined(RCC_IOPENR_GPIOAEN)

#include "bitarithm.h"
#include "periph/gpio_ll.h"

#if defined(CPU_FAM_STM32F0) || defined(CPU_FAM_STM32F3) || defined(CPU_FAM_STM32L1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#if defined(CPU_FAM_STM32F0) || defined(CPU_FAM_STM32F3) || defined(CPU_FAM_STM32L1)
#if defined(RCC_AHBENR_GPIOAEN)

/* enable clock of the SYSCFG module for EXTI configuration */
#if !defined(CPU_FAM_STM32WB) && !defined(CPU_FAM_STM32MP1) && \
!defined(CPU_FAM_STM32WL)
#ifdef CPU_FAM_STM32F0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#ifdef CPU_FAM_STM32F0
#if defined(RCC_APB2ENR_SYSCFGCOMPEN)

!defined(CPU_FAM_STM32WL)
#ifdef CPU_FAM_STM32F0
periph_clk_en(APB2, RCC_APB2ENR_SYSCFGCOMPEN);
#elif defined(CPU_FAM_STM32G0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#elif defined(CPU_FAM_STM32G0)
#elif defined(RCC_APBENR2_SYSCFGEN)

periph_clk_en(APB2, RCC_APB2ENR_SYSCFGCOMPEN);
#elif defined(CPU_FAM_STM32G0)
periph_clk_en(APB12, RCC_APBENR2_SYSCFGEN);
#elif defined(CPU_FAM_STM32U5)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#elif defined(CPU_FAM_STM32U5)
#elif defined(RCC_APB3ENR_SYSCFGEN)

@benpicco benpicco merged commit 9b8f032 into RIOT-OS:master May 24, 2022
@maribu
Copy link
Member Author

maribu commented May 24, 2022

Thanks :)

@maribu maribu deleted the gpio_ll/stm32 branch May 24, 2022 09:38
@chrysn chrysn added this to the Release 2022.07 milestone Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: cpu Area: CPU/MCU ports Area: Kconfig Area: Kconfig integration CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants