1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

104 Commits

Author SHA1 Message Date
Marian Buschsieweke
97b91b4f8f
boards/stm32: use GPIO LL for LEDs
This fixes a race in `LED<NUM>_TOGGLE`, which is a read-copy-write
operation. Any access to a GPIO pin on the same GPIO port that
happens concurrently could result in data corruption. Using the
GPIO LL API, which is thread-safe, fixes the issue.

Note: The used GPIO LL functions will work even in when the GPIO LL
      module is not used.
2024-08-02 09:55:24 +02:00
Marian Buschsieweke
36e8526046
drivers/periph_gpio_ll: change API to access GPIO ports
The API was based on the assumption that GPIO ports are mapped in memory
sanely, so that a `GPIO_PORT(num)` macro would work allow for constant
folding when `num` is known and still be efficient when it is not.

Some MCUs, however, will need a look up tables to efficiently translate
GPIO port numbers to the port's base address. This will prevent the use
of such a `GPIO_PORT(num)` macro in constant initializers.

As a result, we rather provide `GPIO_PORT_0`, `GPIO_PORT_1`, etc. macros
for each GPIO port present (regardless of MCU naming scheme), as well as
`GPIO_PORT_A`, `GPIO_PORT_B`, etc. macros if (and only if) the MCU port
naming scheme uses letters rather than numbers.

These can be defined as macros to the peripheral base address even when
those are randomly mapped into the address space. In addition, a C
function `gpio_port()` replaces the role of the `GPIO_PORT()` and
`gpio_port_num()` the `GPIO_PORT_NUM()` macro. Those functions will
still be implemented as efficient as possible and will allow constant
folding where it was formerly possible. Hence, there is no downside for
MCUs with sane peripheral memory mapping, but it is highly beneficial
for the crazy ones.

There are also two benefits for the non-crazy MCUs:
1. We can now test for valid port numbers with `#ifdef GPIO_PORT_<NUM>`
    - This directly benefits the test in `tests/periph/gpio_ll`, which
      can now provide a valid GPIO port for each and every board
    - Writing to invalid memory mapped I/O addresses was treated as
      triggering undefined behavior by the compiler and used as a
      optimization opportunity
2. We can now detect at compile time if the naming scheme of the MCU
   uses letters or numbers, and produce more user friendly output.
    - This is directly applied in the test app
2024-08-02 09:55:24 +02:00
Joshua DeWeese
3152301c3f boards/common/stm32: simplify ifdef logic 2024-04-23 16:31:01 -04:00
Jason Parker
a2f4a13beb boards/nucleo-c031c6 initial add 2024-01-30 10:11:57 -05:00
Marian Buschsieweke
3848a37d14
boards/nucleo-f303re: add more timers 2023-11-21 09:02:31 +01:00
Gunar Schorcht
db10337b11 boards/common/stm32: add common USB OTG FS config for U5 family 2023-07-05 09:41:15 +02:00
Marian Buschsieweke
a6e8e1ff7e
boards/common/stm32: Add timer config based on TIM2,15,16
This adds the three general purpose timers on STM32L4 boards in a
central place so that STM32L4 boards can just include it.

Some other families may also have TIM15 and TIM16 and could use this,
but likely some generalization is needed to use this for other
families as well. This can be added later on.
2023-05-30 13:03:19 +02:00
Marian Buschsieweke
190cfdb206
boards/common/stm32: Add timer conf for TIM5 + TIM2
This adds a common configuration file that provides two periph timers
using TIM5 and TIM2.
2023-04-17 12:24:48 +02:00
329727784b
Revert "boards/stm32f429-disc*: do not use periph_usbdev_hs"
This reverts commit 05160f9c2a.
2023-03-31 16:43:51 +02:00
Gunar Schorcht
05160f9c2a boards/stm32f429-disc*: do not use periph_usbdev_hs
The board uses the USB OTG HS peripheral together with the on-hip FS PHY. Using the `periph_usbdev_hs` module increases the EP data size for the CDC ECM bulk endpoint to 512 bytes, which does not work for the FS interface. Module `periph_usbdev_hs` is therefore not used.
2023-03-31 12:21:41 +02:00
Gunar Schorcht
658d6b69b5 boards/common/stm32: add common configuration for internal USB HS PHY 2022-10-16 11:35:42 +02:00
Gunar Schorcht
d2f7fd6a0e boards/common/stm32: rename cfg_usb_otg_hs_fs.h to clarify the usage
The `fs` in the file name means that on-chip FS PHY is configured for USB OTG HS. The file is renamed to `cfg_usb_otg_hs_phy_fs.h`
- to clarify that USB OTG HS is just configured with PHY FS and not HS and FS,
- to allow a configuration of USB OTG FS and HS in one file called `cfg_usb_otg_hs_fs.h` or whatever, and
- to allow a configuration of USB OTG HS with ULPI PHY in a file called `cfg_usb_otg_hs_phy_ulpi.h`.
f
2022-10-06 06:25:38 +02:00
Gunar Schorcht
641e343f7d boards/common/stm32: use usbdev_synopsys_dwc2 driver as periph_usbdev 2022-09-27 01:00:57 +02:00
Marian Buschsieweke
77270e241a
boards/common/stm32: Fix LED configuration
The inverted and non-inverted `LED<num>_ON` and `LED<num>_OFF` macros
are swapped. This didn't reveal in testing as the
`LED<num>_IS_INVERTED` macros where not properly evaluated, due to a
typo in the check. This fixes both.
2022-09-13 08:34:31 +02:00
Marian Buschsieweke
1fd9913293
boards/common/stm32: clean up LED definitions
Let boards only define the port and pin number of each LEDs. The common
definitions in `stm32_leds.h` will provide `LED<x>_ON`, `LED<x>_OFF`,
`LED<x>_TOGGLE`, `LED<x>_PIN`, `LED<x>_MASK` and `LED<x>_PORT`.

In addition to code de-duplication, this also makes it easier to use
LEDs in GPIO LL, which can be beneficial for super low overhead
debugging output - e.g. when a bug is timing sensitive and `DEBUG()`
would spent to much time for stdio to reproduce a bug.
2022-08-08 23:35:06 +02:00
fdacb1a118
boards/stm32: adapt I2C configuration where needed 2022-03-23 10:10:08 +01:00
62a682dd2c
boards/b-u585i-iot02a: add initial basic support 2021-12-23 11:04:42 +01:00
Marian Buschsieweke
7cd9d615fa
cpu/stm32/periph: Use uintptr_t for periph addr
The peripheral register addresses are fixed, properly aligned addresses. Storing
them as uintptr_t makes live easier when casting them to helper structs, as no
intermediate cast to uintptr_t is needed to silence -Wcast-align.
2021-12-03 10:12:32 +01:00
Akshai M
fd8ddd6161 boards: add nucleo-wl55jc
Co-authored-by: Kevin "Tristate Tom" Weiss <weiss.kevin604@gmail.com>
2021-04-20 21:04:29 +02:00
Akshai M
c485c774cf cpu/stm32: add stm32wl 2021-04-20 20:57:48 +02:00
Gilles DOFFE
58f90c986f boards/common/stm32: add openocd config stm32mp1.cfg
Add common openocd configuration for stm32mp1 boards.

Signed-off-by: Gilles DOFFE <gilles.doffe@savoirfairelinux.com>
2020-11-13 10:43:08 +01:00
Gilles DOFFE
2ac0467807 cpu/stm32: configure timer2 for stm32mp1 boards
This timer will be used by RIOT-OS as the scheduling timer for
stm32mp157c-dk2 board.

Signed-off-by: Gilles DOFFE <gilles.doffe@savoirfairelinux.com>
2020-11-13 10:43:08 +01:00
7fbfb92f03
boards/stm32gx: move Kconfig clock config to cpu 2020-10-29 23:00:44 +01:00
f2e2c89424
cpu/stm32: move clock configuration headers to cpu 2020-10-26 11:16:23 +01:00
80518e6525
boards/stm32l4: adapt default clock config for 110MHz cpus 2020-10-23 18:28:27 +02:00
0afb9456da
boards/stm32: adapt default i2c config for stm32l5 2020-10-23 18:28:27 +02:00
22645cbfe4
boards/stm32: adapt tim5 default config for stm32l5 2020-10-23 18:21:50 +02:00
34f3b4406d
boards/stm32: add stm32l5 config for openocd 2020-10-23 18:21:50 +02:00
72c17588b9
boards/stm32: remove unused CLOCK_LSE define 2020-10-21 12:11:17 +02:00
d0dd196c30
boards/stm32gx: use correct clock base for CLOCK_APBx defines 2020-10-20 15:47:21 +02:00
a50eab59c4
boards/stm32g0/g4: cleanup Kconfig clock configuration 2020-10-20 14:29:22 +02:00
20894e47a6
cpu: boards: stm32gx: use IS_ACTIVE macro for clock config 2020-10-20 14:29:11 +02:00
d78a316139
cpu: boards: stm32gx: compile code for all possible clock modes 2020-10-20 14:29:11 +02:00
00ea7ffa55
cpu/stm32l4wb: cleanup clock initialization 2020-10-20 11:37:46 +02:00
d7d5d9d651
boards/stm32l4: extend clock configuration
- add PLLQ default value
- better tune default PLLM value depending on HSE value
- ensure CLOCK_PLL_SRC is always defined
2020-10-20 11:37:45 +02:00
6b3c11b151
boards/stm32: remove unused default 96 and 168MHz common headers 2020-10-06 22:07:19 +02:00
67d03c91d1
boards/stm32f2f4f7: adapt 180MHz clock config for USB 2020-10-06 22:07:12 +02:00
0828400eb0
boards/stm32f2f4f7: adapt 100MHz clock config for USB 2020-10-06 22:07:12 +02:00
c448470b0d
boards/stm32f2/4/7: rework common clock configuration 2020-10-06 16:10:05 +02:00
bcbe3ac1d5
Merge pull request #15114 from aabadie/pr/boards/stm32f0_apb2_clock_fix
boards/stm32f0: fix missing CLOCK_APB2 define
2020-09-29 17:37:19 +02:00
d407878bc5
Merge pull request #15112 from aabadie/pr/boards/nucleo64-g431kb
boards/nucleo-g431rb: add initial support
2020-09-29 15:26:39 +02:00
a7bb409eb5
boards/stm32f0: fix missing CLOCK_APB2 define 2020-09-29 14:28:33 +02:00
b06c252a33
boards/stm32: add default tim2 config for stm32g4 2020-09-29 12:26:26 +02:00
042a550f0d
boards: cpu: stm32f1/f3: rework clock configuration and init 2020-09-24 11:27:24 +02:00
8ac1909ea3
cpu: boards: stm32l0l1: use IS_ACTIVE where possible in stmclk 2020-09-22 22:30:19 +02:00
5e886a76c9
boards/stm32l0/l1: merge default clock configuration headers 2020-09-22 22:30:19 +02:00
67a1c029b4
boards/stm32l0: set LSE to 0 default, override in boards 2020-09-22 22:30:19 +02:00
23117a844e
boards: cpu: stm32l0: rework clock configuration 2020-09-22 22:30:19 +02:00
4a5d9a30b1
boards/stm32l0*: rename shared clock config header 2020-09-22 22:30:08 +02:00
Francisco
adb0bcab47
Merge pull request #14866 from aabadie/pr/boards/stm32l4wb_clock_kconfig
boards: cpu: stm32l4/wb: rework clock configuration and initialization
2020-09-09 09:35:29 +02:00