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

8765 Commits

Author SHA1 Message Date
Dylan Laduranty
efab4dd9ea
Merge pull request #20593 from firas-hamdi/fix/correct_debug_output
cpu/samd5x: reword & correct debug output
2024-04-18 14:36:40 +00:00
Firas Hamdi
599967fe26 cpu/samd5x: reword & correct debug output 2024-04-18 15:42:57 +02:00
Dylan Laduranty
7aa7e7954e cpu/nrf5x: implement pm_off() for nRF53/9160
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2024-04-18 13:33:36 +02:00
Teufelchen
5bc8ca5318
Merge pull request #18093 from Ollrogge/remove_flashpage_free_funcs
periph/flashpage: remove deprecated flashpage_*_free functions
2024-04-16 08:47:11 +00:00
Marian Buschsieweke
03914582ea
Merge pull request #20567 from krzysztof-cabaj/esp8266-DOC
cpu/esp8266: fix doxygen unbalanced grouping
2024-04-16 06:04:10 +00:00
Marian Buschsieweke
30c9204322
Merge pull request #20572 from maribu/cpu/msp430/uart_usci
cpu/msp430/periph_uart: Fix uart_write() for USCI peripheral
2024-04-15 13:52:45 +00:00
Marian Buschsieweke
f4baa0f2e1
cpu/msp430/periph_uart: Fix uart_write() for USCI peripheral
In TX-only mode the UART was previously release before all bits of the
last byte were shifted out. This adds a busy loop waiting while the
peripheral is still busy, fixing the issue.

Co-authored-by: benpicco <benpicco@googlemail.com>
2024-04-15 14:43:10 +02:00
Marian Buschsieweke
53edb4e981
Merge pull request #20571 from maribu/cpu/msp430/timer
cpu/msp430/periph_timer: add a static_assert() for clear mask
2024-04-15 10:21:52 +00:00
Marian Buschsieweke
5adf1f1a28
cpu/msp430/periph_timer: fix timer_query_freqs()
`timer_query_freqs()` should return 0 when index is out of range
according to the doc. This changes the code to live up to the
spec.
2024-04-14 20:20:36 +02:00
Marian Buschsieweke
49d59d166d
cpu/msp430/periph_timer: add a static_assert() for clear mask
The driver assumes that timer A and timer B have the same register
layout regarding all the features exposed by the driver. This is
backed by the MCU family datasheets for the MSP430 x1xx and the
MSP430 G2xx / F2xx MCUs (and likely more families).

The assert() is pretty limited in coverage, but more to document why
a "timer A clear" mask is used but still claiming the driver also
works for timer B. It just looks too much like a bug otherwise.
2024-04-14 16:01:58 +02:00
krzysztof-cabaj
2f0a78640f cpu/esp8266: fix issue found by static tests 2024-04-11 19:19:58 +02:00
krzysztof-cabaj
569b4b5294 cpu/esp8266: fix doxygen unbalanced grouping 2024-04-11 19:04:06 +02:00
Teufelchen1
c8d5fe2352 boards/cpu: Add limited GBA boot support to RIOT 2024-04-10 17:06:14 +02:00
Dylan Laduranty
d75595751c cpu/nrf9160: fix gpiote0 vector isr
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2024-04-08 20:13:45 +02:00
Ollrogge
6a8bbe0240 Revert "cpu/cortexm_common: extend flashpage API"
This reverts commit d38f6c68b5.
2024-04-04 17:57:40 +02:00
Ollrogge
4b8355e1d3 Revert "cpu/msp430_common: extend flashpage API"
This reverts commit 741943f021.
2024-04-04 17:57:19 +02:00
Ollrogge
7595d533b4 Revert "cpu/riscv_common: extend flashpage API"
This reverts commit 3a11b1fbd2.
2024-04-04 17:37:16 +02:00
Ollrogge
7c5b16abe5 Revert "cpu/lpc23xx: extend flashpage API"
This reverts commit 4fa25af86c.
2024-04-04 17:37:16 +02:00
Ollrogge
2f67249ae1 Revert "cpu/native: extend flashpage API"
This reverts commit cdd9f303cf.
2024-04-04 17:37:15 +02:00
Teufelchen1
1cb2d7caed cpu/sam0: Remove deprecated muxpos 2024-04-03 11:59:48 +02:00
Joshua DeWeese
aef5dfec2b cpu/stm32/gpio_ll: make style consistent
This block of code inconsistently made use of else-if statments. The
patch makes the use consistent. The change also makes the code a bit
simpler to read.
2024-04-02 11:51:20 -04:00
Joshua DeWeese
1b1fbfeb5c cpu/stm32/gpio_ll: fix ifdef
APB12 is never defined as a macro. It is an element in the bus_t enum.
Therefore, the test to check if it is defined will always fail.

APB12 is not a real bus. It is the second register of the APB1 bus. I am
not aware of any STM32 family where the ABP2 bus is implmented (ie
RCC_APB2ENR_SYSCFGEN is defined) and devices attached to said bus are
enabled via the APB1 second register. For this reason, the fix is to
simply remove the check.
2024-04-02 11:34:50 -04:00
benpicco
ad51739c26
Merge pull request #20521 from Ollrogge/rtc_support
cpu/stm32u5: Enable rtc support
2024-04-01 19:06:06 +00:00
Ollrogge
013e884550 cpu/stm32u5: Enable rtc support 2024-03-29 10:19:42 +01:00
Karl Fessel
3e2ab59f4d
Merge pull request #20431 from cogip/native_fixes
cpu/native: add gpio-mock
2024-03-28 22:07:10 +00:00
Karl Fessel
9d2dda27ce
Merge branch 'master' into cpu/samd5x-write-CAN-driver 2024-03-28 09:52:26 +01:00
Marian Buschsieweke
4b3308cdef
Merge pull request #20357 from maribu/cpu/msp430/usci
cpu/msp430/f2xx: clean up periph_uart,periph_spi
2024-03-27 19:57:47 +00:00
Marian Buschsieweke
aef5b65244
cpu/msp430/f2xx: clean up periph_uart,periph_spi
This cleans up the USCI based UART and SPI implementations and allows
multiple instances of either interface to be configured by the
boards. In addition, it allows sharing the USCI peripherals to provide
multiple serial interfaces with the same hardware (round-robin).
2024-03-27 18:54:07 +01:00
Marian Buschsieweke
04620d471c
Merge pull request #20438 from MrKevinWeiss/pr/kconfig/dep/removal
Remove Kconfig dependency modelling
2024-03-27 16:39:56 +00:00
MrKevinWeiss
e0fdc3c16c
*Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
Benjamin Valentin
16cfaab235 cpu/samd5x: fix C++ build 2024-03-27 00:15:36 +01:00
Firas Hamdi
e4e5558694 cpu/samd5x: implement driver for samd5x CAN controller
cpu/samd5x: load RX mailbox
2024-03-26 15:17:48 +01:00
Kevin "Tristate Tom" Weiss
6c6d2f9100
Merge pull request #20410 from benpicco/cpu/esp8266-spi_clk
cpu/esp8266: allow arbitrary SPI clocks
2024-03-26 14:15:50 +00:00
MrKevinWeiss
7a68fb0d5e
*Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
MrKevinWeiss
0a9c51fdf9
*.config: Modify all .config kconfig files 2024-03-26 14:53:40 +01:00
MrKevinWeiss
0f2b71c60e
*Makefile.features: Remove TEST_KCONFIG includes 2024-03-26 14:53:39 +01:00
Gilles DOFFE
ebf95d2545 cpu/native: enhance GPIO mocking with 2D array representation
This commit introduces a more robust GPIO mocking mechanism by utilizing
a 2-dimensional array. Each element of the array holds a gpio_mock_t
structure describing a pin's attributes such as value, mode, flank,
interruption callback, and callback argument.

This enhancement allows for the arbitrary simulation of GPIOs across
various microcontroller architectures using the current API, while
maintaining consistency through the use of the GPIO_PIN macro.

Additionally, it should be noted that only the maximum number of ports
and maximum number of pins can be altered according to the context.

The implemented API in gpio_mock.c remains rudimentary, providing no
validation but fulfilling the required functions. However, it remains
customizable as all its functions are marked as weak.

Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
2024-03-24 23:12:24 +01:00
9f51daeb53
Merge pull request #20495 from Enoch247/simplify-stm32-clk-includes
cpu/stm32: remove redundant conditional compile block
2024-03-22 12:04:49 +00:00
Joshua DeWeese
1e4526111f cpu/stm32: moved includes out of header where not used 2024-03-21 11:02:29 -04:00
Marian Buschsieweke
ad4b8f202c
Merge pull request #20479 from Enoch247/simplify-stm32-gpio-code
cpu/stm32/periph/gpio: simplify condition code
2024-03-21 12:33:25 +00:00
Joshua DeWeese
fd105b7e77 cpu/stm32: remove redundant conditional compile
This patch removes a largely redundant block of conditional includes.

The removed includes are moved into the family specific headers so that
the more specific headers may override defaults defined in the shared
headers.
2024-03-20 11:29:25 -04:00
Teufelchen
30e745d242
Merge pull request #20467 from dylad/pr/cpu/stm32/usbdev_fs/dont_autopull_ztimer
cpu/stm32/periph/usbdev_fs: avoid using ztimer when not needed
2024-03-20 12:03:32 +00:00
Marian Buschsieweke
23d30cb106
Merge pull request #18870 from Teufelchen1/fix/llvm_gnrc_lorawan
llvm: Fix unused function warning
2024-03-19 20:00:58 +00:00
Teufelchen1
d19182c3e6 llvm: cpu/stm32: Fix unused function warning 2024-03-19 17:20:17 +01:00
Dylan Laduranty
92c36df77b cpu/sam0: don't enable TRFAIL interrupts
these interrupts were used to generate USBDEV_EVENT_TR_FAIL which is deprecated and will be removed

Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2024-03-19 16:39:59 +01:00
Joshua DeWeese
8555a66e23 cpu/stm32/periph/gpio: simplify conditional code
This patch similifies some of the handling of differences between STM32
chips. The intent is to improve scaling of the code as more chips are
added.
2024-03-19 09:04:21 -04:00
Dylan Laduranty
ba8b3dc2b4 cpu/rpx0xx: add PWM support
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2024-03-18 21:04:27 +01:00
Gilles DOFFE
24d9657b40 cpu/native: mark gpio_mock function as weak
This allows developpers to override gpio behavior into their
applications.

Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
2024-03-15 20:27:11 +01:00
Gilles DOFFE
5b4c8fe92d cpu/native: return 0 for all gpio_init*() calls
If the gpio is initialized as an input or interruptable pin, the
gpio_mock driver returns -1 leading to failed initialization.
However that is not because nothing can change the GPIO state that it
has to be an error.
Return 0 in all cases.

Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
2024-03-15 20:27:11 +01:00
Gilles DOFFE
3bfabb4a6c cpu/native/periph/qdec: remove useless loop
Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
2024-03-15 20:27:11 +01:00
Dylan Laduranty
df044f4f56 cpu/stm32/periph/usbdev_fs: avoid using ztimer when not needed
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2024-03-13 21:39:07 +01:00
Benjamin Valentin
6389b3c83b Revert "cpu/sam0_common: RTC: avoid negative month after POR"
This reverts commit 897a3ceda9.
2024-03-07 13:52:35 +01:00
Benjamin Valentin
8c4d0c53f2 cpu/sam0_common: RTC: avoid negative month after POR 2024-03-07 13:52:35 +01:00
Benjamin Valentin
897a3ceda9 cpu/sam0_common: RTC: avoid negative month after POR 2024-03-06 18:48:26 +01:00
Benjamin Valentin
5164a6cc59 cpu/native: return _native_retval with NATIVE_AUTO_EXIT 2024-03-04 14:08:52 +01:00
benpicco
ba171a1075
Merge pull request #20444 from Ollrogge/u575zi-q-board
boards/nucleo-u575zi-q: Add support
2024-03-01 17:33:14 +00:00
Ollrogge
53d53d8cc8 boards/nucleo-u575zi-q: Add support 2024-03-01 11:18:18 +01:00
Benjamin Valentin
d26937fe9c cpu/gd32v: don't set FW_ROM_LEN to ROM_LEN
FW_ROM_LEN is supposed to be a subset of ROM_LEN that contains the firmware
(without bootloader, AUX slot).
2024-02-28 13:49:12 +01:00
Benjamin Valentin
a417a3e72c cpu/riscv_common: allow to define AUX slot on flash 2024-02-28 11:49:05 +01:00
Benjamin Valentin
308374fc29 cpu/cortexm_common: allow to define AUX slot on flash 2024-02-28 11:49:05 +01:00
chrysn
6714a77026
Merge pull request #20339 from chrysn-pull-requests/native64-rust
cpu/native: Enable Rust on 64bit
2024-02-23 10:41:47 +00:00
chrysn
1070175da8 cpu/native: 64bit works with Rust 2024-02-23 11:24:02 +01:00
Marian Buschsieweke
047fb8d3c7
Merge pull request #20419 from benpicco/cpu/native_assert-reval
cpu/native: return error code on failed assertion
2024-02-22 16:31:51 +00:00
Benjamin Valentin
9e9a906f4d cpu/native: return error code on failed assertion 2024-02-22 16:06:32 +01:00
chrysn
6e892d9b1c
Merge pull request #20416 from chrysn-pull-requests/alt20415
cpu/esp: Use CPU_ESP8266 define instead of the removed MCU_ESP8266
2024-02-22 14:31:43 +00:00
chrysn
c3020ce3b7 cpu/esp: Use CPU_ESP8266 define instead of the removed MCU_ESP8266
Follow-up-for: https://github.com/RIOT-OS/RIOT/pull/20397
Closes: https://github.com/RIOT-OS/RIOT/pull/20409
Closes: https://github.com/RIOT-OS/RIOT/pull/20415
2024-02-22 14:26:43 +01:00
benpicco
d83ec632e3
Merge pull request #20406 from FlapKap/fix_eeprom_debug_off_by_one
periph/eeprom: fix off-by-one error in debug statement
2024-02-22 08:48:41 +00:00
Benjamin Valentin
75bf0e33e0 cpu/esp8266: allow arbitrary SPI clocks 2024-02-21 23:15:21 +01:00
Kasper Hjort Berthelsen
9e6276351d periph/eeprom: fix off-by-one error in debug statement
Since p is incremented DEBUG prints the next value instead of the current
I also took the liberty to add debugs to the `write` function
2024-02-21 13:26:36 +01:00
chrysn
756a384442 makefiles, treewide: Remove MCU variable 2024-02-18 20:46:09 +01:00
Marian Buschsieweke
aeca9a52c6
cpu/stm32: implement periph_spi_reconfigure
Fixes https://github.com/RIOT-OS/RIOT/issues/20227
2024-02-15 19:11:37 +01:00
Mihai Renea
fc3d0d8676 cpu/native: fix native_async_read_remove_handler() + enable all baudrates 2024-02-10 15:46:00 +01:00
benpicco
9501f64c4e
Merge pull request #20365 from derMihai/mir/native_uart_poweroff
cpu/native/periph/uart: uart_poweroff() closes the file descriptor + extended baud-rate support on Linux
2024-02-10 10:35:31 +00:00
benpicco
55b6728224
Merge pull request #19738 from benpicco/stdio_dispatch
stdio_dispatch: allow to select multiple stdio methods at the same time
2024-02-09 16:13:27 +00:00
Benjamin Valentin
35ef7ca389 cpu/esp32/stdio_usb_serial_jtag: port to new interface 2024-02-09 15:24:22 +01:00
Mihai Renea
795415d59e cpu/native/periph/uart: uart_poweroff() closes the file descriptor 2024-02-09 12:55:40 +01:00
Marian Buschsieweke
26946a721b
Merge pull request #20360 from maribu/stm32-adc-typo
cpu/stm32/periph_adc: fix register access
2024-02-08 16:31:46 +00:00
Marian Buschsieweke
4ed287cec8
cpu/stm32/periph_adc: fix register access
The register access to SMPR1/SMPR2 was incorrect in three aspects:

1. For channels < 10, SMPR1 was cleared but SMPR2 should have been
   cleared
2. The code was not thread-safe
3. An unneeded write was issued. (The compiler won't combine the
   in-place bitwise operations into a single read-modify-write
   sequence on `volatile` memory.)

Fixes https://github.com/RIOT-OS/RIOT/issues/20261
2024-02-08 14:51:25 +01:00
benpicco
c07eca7696
Merge pull request #20356 from maribu/boards/msp-fixup
boards/olimex-msp430-h2618: change UART config
2024-02-08 10:18:02 +00:00
Marian Buschsieweke
cbd918daab
cpu/msp430/x1xx: fix typo in doc 2024-02-07 20:07:53 +01:00
Benjamin Valentin
453a8be4f3 sys/cpp_new_delete: always enable the module when C++ is used 2024-02-07 11:40:23 +01:00
benpicco
4d9e8a8dde
Merge pull request #20335 from fzi-haxel/pr/native64-board
native64: Separate board for 64-bit native
2024-02-05 22:58:02 +00:00
Frederik Haxel
0c2cfe99e6 native64: Add Linux/x86_64 board
Adds a separate board for native64 instead of the `NATIVE_64BIT` workaround.
The files in `boards/native64` are more or less dummy files and just include
the `boards/native` logic (similar to `openlabs-kw41z-mini-256kib`).
The main logic for native is in `makefiles/arch/native.inc.mk`, `cpu/native`
and `boards/native`.

The remaining changes concern the build system, and change native board checks
to native CPU checks to cover both boards.
2024-02-05 22:01:40 +01:00
Marian Buschsieweke
06a05370a2
cpu/sam0_common: Implement gpio_ll_switch_dir 2024-02-05 10:56:16 +01:00
Marian Buschsieweke
c011764022
cpu/atmega_common: implement gpio_ll_switch_dir 2024-02-05 10:56:16 +01:00
Marian Buschsieweke
8bf61336a2
Merge pull request #20290 from maribu/drivers/periph/gpio_ll/features
drivers/periph_gpio_ll: Fix GPIO_DISCONNECT handling and add compile time feature checks
2024-02-05 07:30:54 +00:00
Marian Buschsieweke
f10a994a9e
cpu/gd32v/periph_gpio_ll: fix and clean up
Use analog mode for GPIO_DISCONNECT, as this is said to have the lowest
current leakage due to disabling the Schmitt trigger and correctly
detect this in `gpio_ll_query_conf()`.

Also drop the `schmitt_trigger_disabled` member in `gpio_conf_t`, as
the Schmitt trigger is only ever disabled in Analog mode anyway and
cannot be freely configured.
2024-02-05 08:21:52 +01:00
Marian Buschsieweke
1351c61c6a
cpu/efm32: expose pull up on GPIO_DISCONNECT
Allow enabling the pull on on `GPIO_DISCONNECT` and query that
correctly.
2024-02-05 08:21:51 +01:00
Marian Buschsieweke
6028097132
cpu/stm32/periph_gpio_ll: Fix and clean up
The separate Schmitt trigger bit in the configuration is dropped, as
the Schmitt trigger is only every disabled when in `GPIO_DISCONNECT`
mode. So no need to encode the same information twice.

The `gpio_state_t` is improved to be a bitmask that holds the
MODER register value and a flag indicating whether open-drain mode
should be enabled.

Finally, `GPIO_DISCONNECT` is implemented. This is done by placing the
GPIO in analog mode, which by disabling the Schmitt trigger reduces
power consumption.
2024-02-05 08:21:51 +01:00
Benjamin Valentin
895a6f87ed cpu/stm32/rtc: add support for STM32G0 2024-02-04 19:44:56 +01:00
Marian Buschsieweke
3b3da09ec6
Merge pull request #20313 from maribu/sys/byteorder/cleanup-implementation
sys/byteorder: clean up implementation
2024-02-02 05:38:33 +00:00
benpicco
5bd879b406
Merge pull request #20315 from fzi-haxel/native-x86-64-support
native: Linux/x86_64 support
2024-02-01 17:11:56 +00:00
benpicco
ad743820f4
Merge pull request #20317 from Wer-Wolf/native_timer_init
Fix for `periph_timer` on `native`
2024-02-01 09:08:20 +00:00
benpicco
4ea27d4c13
Merge pull request #20300 from jparker324/stm32c0_and_nucleo_c031c6
cpu/stm32: add support for STM32C0 and NUCLEO-C031C6
2024-01-31 15:09:25 +00:00
Marian Buschsieweke
b42b1998ec
cpu/sam0_common: fix vendor header files
Ran the `fix_headers.sh` to fix the vendor header files and removed
the no longer needed work around for them.
2024-01-31 14:46:23 +01:00
Marian Buschsieweke
1425dc0652
cpu/sam0_common: Update script to fix vendor headers
The script to fix the vendor header files has been renamed to
`fix_headers.sh` and now does two things:

1. Strip bogus type qualifiers in front of padding (as before)
2. Strip bogus `LITTLE_ENDIAN` defines.
2024-01-31 14:46:23 +01:00
Armin Wolf
d8dc6d3963 cpu/native: timer: Delete POSIX timer upon error
If `register_interrupt` somehow fails, we leak the already created
POSIX timer by returning immediately.

Fix this by calling `timer_delete` before returning.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
2024-01-30 22:28:13 +01:00
Armin Wolf
eac719166b cpu/native: timer: Stop using err
When using `err`, no stacktrace is generated and the standard panic
functionallity of RIOT is sidestepped.

Use `core_panic` instead.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
2024-01-30 22:28:13 +01:00
Armin Wolf
acbe7a8af3 cpu/native: timer: Remove unnecessary uses of (void)
In `timer_init`, `freq` is being check so its not unused.
In `timer_set_periodic`, `flags` is being used too.

Remove the uses of `(void)` in both cases.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
2024-01-30 22:11:14 +01:00
Benjamin Valentin
a21acf0858 cpu/sam0_common: flashpage: disable interrupts while writing 2024-01-30 18:48:01 +01:00
Frederik Haxel
16eff9b6ed native: Linux/x86_64 support
Initial version to test 64 bit compatibility.

Instead of a separate board, the inital version for Linux/x86_64 is enabled
by setting the environment variable `NATIVE_64BIT=y` and compiling as usual.

Not currently implemented:
* Architectures other than x86_64 or operating systems other than Linux
    * No FreeBSD support
    * No Aarch support
* Rust support for x86_64
2024-01-30 16:33:19 +01:00
Marian Buschsieweke
57cd430363
Merge pull request #20306 from Wer-Wolf/native_timer_freq
cpu/native: Add support for periph_timer_query_freqs
2024-01-30 08:20:23 +00:00
Armin Wolf
6070c57e21 cpu/native: Add support for periph_timer_query_freqs
Add support for querying the frequency supported by
`periph_timer`. This allows applications which require
this feature to run on the `native` board.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
2024-01-30 02:01:50 +01:00
Jason Parker
b5d72d8242 cpu/stm32: add CPU_FAM_STM32C0 support 2024-01-29 14:44:10 -05:00
Armin Wolf
d04df84b76 cpu/native: Fix executable stack warning
The tramp assembly was missing a `.note.GNU-stack` section,
meaning the compiler was forced to assume that we require
an executable stack.

Fix this by adding the necessary section.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
2024-01-28 04:43:42 +01:00
chrysn
8f111a3c29
Merge pull request #20299 from chrysn-pull-requests/nrf52-spi-bugs-2
cpu/nrf52 i2c: Wait for complete transmission when writing NOSTOP
2024-01-27 08:56:05 +00:00
chrysn
790e808deb cpu/nrf52 i2c: Wait for complete transmission when writing NOSTOP 2024-01-27 09:41:26 +01:00
chrysn
1073df2ce2
Merge pull request #20298 from chrysn-pull-requests/nrf52-spi-bugs
cpu/nrf52 i2c: Always buffer writes
2024-01-25 16:09:28 +00:00
chrysn
52a976e147 cpu/nrf52 i2c: Add shortcut when data is in RAM
See-Also: https://github.com/RIOT-OS/RIOT/pull/20298#discussion_r1466508505
2024-01-25 16:33:25 +01:00
chrysn
b80d1e622f cpu/nrf52 i2c: Always buffer writes
The underlying peripheral can only read from RAM. This uses the
existing infrastructure (already needed to work around the lack of a
hardware support for I2C_NOSTART) to unconditionally copy any to-be-sent
data into RAM.
2024-01-25 15:24:57 +01:00
Marian Buschsieweke
807fcd7614
cpu/sam0_common/periph_gpio_ll: fix doc
Fix some copy-paste bugs in the doc.
2024-01-23 15:51:36 +01:00
Marian Buschsieweke
f3bd3476ee
cpu/atmega_common: Make GPIO_DISCONNECT alias for GPIO_INPUT
Since on ATmega GPIOs cannot be disconnected and the reset state is
them being an input, this may help making code more portable.
2024-01-23 15:03:34 +01:00
Marian Buschsieweke
bd3f54ac8f
drivers/periph_gpio_ll: Add features for compile-time-checks
This adds the features

 - periph_gpio_ll_input_pull_down:
        To indicate support for input mode with internal pull down
 - periph_gpio_ll_input_pull_keep:
        To indicate support for input mode with internal resistor
        pulling towards current level
 - periph_gpio_ll_input_pull_up:
        To indicate support for input mode with internal pull up
 - periph_gpio_ll_disconnect:
        To indicate a GPIO can be disconnected
 - periph_gpio_ll_open_drain:
        To indicate support for open drain mode
 - periph_gpio_ll_open_drain_pull_up:
        To indicate support for open drain mode with internal pull up
 - periph_gpio_ll_open_source:
        To indicate support for open source mode
 - periph_gpio_ll_open_source_pull_down:
        To indicate support for open source mode with internal pull down
2024-01-23 15:03:34 +01:00
Marian Buschsieweke
0a06b0c1d8
Merge pull request #20282 from chrysn-pull-requests/nrf52-i2c-nostop
cpu/nrf5x i2c: Set up correct interrupts after NOSTOP transmissions
2024-01-23 09:05:35 +00:00
chrysn
fce82dec6e cpu/nrf5x i2c: Forbid receive NOSTOP, document rationale 2024-01-22 23:29:24 +01:00
Marian Buschsieweke
63ec7fc7b5
Merge pull request #19835 from maribu/msp430
cpu/msp430: rework MSP430 x1xx periph drivers
2024-01-22 18:41:23 +00:00
Marian Buschsieweke
675dcc381c
cpu/msp430: rework MSP430 x1xx periph drivers
- Move common code for USART (shared SPI / UART peripheral) to its
  own file and allow sharing the USART peripheral to provide both
  UART and SPI in round-robin fashion.
- Configure both UART and SPI bus via a `struct` in the board's
  `periph_conf.h`
    - this allows allocating the two UARTs as needed by the use case
    - since both USARTs signals have a fixed connection to a single
      GPIO, most configuration is moved to the CPU
    - the board now only needs to decide which bus is provided by
      which USART

Note: Sharing an USART used as UART requires cooperation from the app:
- If the UART is used in TX-only mode (no RX callback), the driver
  will release the USART while not sending
- If the UART is used to also receive, the application needs to power
  the UART down while not expecting something to send. An
  `spi_acquire()` will be blocked while the UART is powered up.
2024-01-22 16:59:23 +01:00
Marian Buschsieweke
1484d305bf
cpu/sam0_common: implement periph_gpio_ll_irq
Co-authored-by: benpicco <benpicco@googlemail.com>
2024-01-22 16:28:30 +01:00
Marian Buschsieweke
855756524f
cpu/sam0_common: Implement periph_gpio_ll
Co-authored-by: benpicco <benpicco@googlemail.com>
2024-01-22 16:28:16 +01:00
chrysn
b91161dfce cpu/nrf5x i2c: Set up correct interrupts after NOSTOP transmissions 2024-01-22 02:03:46 +01:00
Marian Buschsieweke
922276296e
drivers/periph/gpio_ll: pass gpio_conf_t by value
Now that `gpio_conf_t` is on all implemented platforms no larger than
a register, we can more efficiently pass it by value rather than via
pointer.
2024-01-21 09:19:08 +01:00
Marian Buschsieweke
2a00ec13e5
drivers/periph/gpio_ll: shrink gpio_conf_t
This commit optimizes the `gpio_conf_t` type in the following
regards:

- The "base" `gpio_conf_t` is stripped from members that only some
  platforms support, e.g. drive strength, slew rate, and disabling of
  the Schmitt Trigger are no longer universally available but
  platform-specific extensions
- The `gpio_conf_t` is now crammed into a bit-field that is 8 bit or
  16 bit wide. This allows for storing lots of them e.g. in
  `driver_foo_params_t` or `uart_conf_t` etc.
- A `union` of the `struct` with bit-field members and a `bits` is used
  to allow accessing all bits in a simple C statement and to ensure
  alignment for efficient handling of the type

Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2024-01-21 08:38:40 +01:00
Marian Buschsieweke
504c169346
Merge pull request #20270 from maribu/boards/gd32vf103c-start
boards/gd32vf103c-start: new board
2024-01-20 16:11:31 +00:00
Marian Buschsieweke
8b1c43afb0
cpu/gd32v: Allow configuration of SWJ_CFG
Expose the compile time configuration knob `CONFIG_AFIO_PCF0_SWJ_CFG`
to allow freeing some/all JTAG pins and use them as GPIOs.

As default, PB4 is remapped from NJTRST to be usable as regular GPIO.
This still allows using the JTAG interface for debugging/flashing,
but makes an GPIO exposed by some boards available.
2024-01-19 23:17:35 +01:00
benpicco
d5f1fda70d
Merge pull request #20230 from benpicco/CONFIG_UART_DMA_THRESHOLD_BYTES
cpu/stm32: uart: don't do DMA for small transfers
2024-01-18 12:26:30 +00:00
Marian Buschsieweke
3b5ed6d390
cpu/gd32v: Fix periph_pwm
The API doc clearly states that arbitrary high PWM frequencies can
be requested and the driver should reduce the frequency while keeping
the resolution, when required. So change the code to just do that
rather than blowing assertions.
2024-01-17 21:58:56 +01:00
Benjamin Valentin
9d70fbf2e1 cpu/sam0_common: SDHC: make use of busy_wait() 2024-01-15 14:30:56 +01:00
Benjamin Valentin
7add6c2fcc cpu/avr8_common: make pm_layered a DEFAULT_MODULE
This lets us disable it.
2024-01-11 21:14:43 +01:00
benpicco
714958ad3c
Merge pull request #20241 from benpicco/busy_wait
sys/busy_wait: add busy wait helper
2024-01-11 12:19:31 +00:00
Benjamin Valentin
fff9ff14da cpu/esp32: add busy loop cycles for all sub-arches 2024-01-10 22:43:31 +01:00
Benjamin Valentin
8bcfe7b7b6 cpu/esp8266: ESP8266 needs 5 cycles per busy loop 2024-01-10 22:43:31 +01:00
Benjamin Valentin
5dc43bd62d cpu/avr8_common: AVR-8 needs 7 cycles per busy loop 2024-01-10 22:43:31 +01:00
benpicco
2e3037c3aa
Merge pull request #20240 from benpicco/cpu/atmega-no_thread
cpu/avr8_common: fix build with !core_thread
2024-01-09 22:13:30 +00:00
Benjamin Valentin
cb76cc17e9 cpu/native: fix build with !core_thread 2024-01-09 23:02:01 +01:00
Benjamin Valentin
79b51efc15 cpu/cortexm_common: Cortex M0/M23 needs 4 cycles/busy loop 2024-01-09 19:03:15 +01:00
Benjamin Valentin
bfd29f0fa7 sys/busy_wait: add busy wait helper 2024-01-09 19:03:15 +01:00
Benjamin Valentin
112e378fcc cpu/avr8_common: fix build with !core_thread 2024-01-09 19:00:22 +01:00
Gunar Schorcht
92657f5fd2 cpu/esp32: add SDMMC support 2024-01-05 07:22:27 +01:00
Kevin "Tristate Tom" Weiss
7fef2e4b6f
Merge pull request #20214 from benpicco/CONFIG_SPI_DMA_THRESHOLD_BYTES
cpu/stm32/periph_spi: only perform DMA transfer above threshold
2024-01-04 17:32:02 +00:00
Benjamin Valentin
ca9bf1a29a cpu/stm32: uart: don't do DMA for small transfers 2024-01-04 17:34:18 +01:00
Marian Buschsieweke
616b48d354
Merge pull request #20228 from benpicco/cc2538_get_eui64_primary
cpu/cc2538: fix EUI provider
2024-01-04 14:30:19 +00:00
Benjamin Valentin
94ad4d7ba3 cpu/cc2538: update function signature of EUI provider 2024-01-04 13:15:47 +01:00
Marian Buschsieweke
f860d96a25
Merge pull request #19891 from chrysn-pull-requests/ws2181x_timer
drivers/ws281x: Add gpio_ll and timer based driver
2024-01-03 09:22:26 +00:00
krzysztof-cabaj
29502b2dc4 cpu/stm32/periph: fix typo - or RAM 2024-01-01 13:26:24 +01:00
Benjamin Valentin
753fae6936 cpu/stm32/periph_spi: only perform DMA transfer above threshold 2023-12-23 17:36:30 +01:00
Benjamin Valentin
fbeb1f9a26 drivers/periph/spi: move DMA threshold to common code 2023-12-23 17:35:29 +01:00
Gunar Schorcht
337a63ecb5 cpu/stm32/periph: add SDMMC support for F2/F4/F7/L4 2023-12-21 18:37:43 +01:00
Gunar Schorcht
d91f438589 cpu/stm32/periph/dma: dma_setup_ext for extended configuration
The function configures additional features of the DMA stream for F2/F4/F7.
`dma_setup_ext` added to configure F2/F4/F7 specific additional features like `MBURST`, `PBURST`, `FIFO` and Peripheral flow controller. It is supposed to be used after `dma_setup` and `dma_prepare`.
2023-12-20 09:14:28 +01:00
MrKevinWeiss
7b80348f31
drivers/ws281x: Fix Kconfig
Patch from https://github.com/RIOT-OS/RIOT/pull/19891#pullrequestreview-1753651538
2023-12-19 11:13:43 +01:00
chrysn
02285fd63a
drivers/periph: Add timer_poll feature and timer_poll_channel function 2023-12-19 11:13:41 +01:00
chrysn
abf95d14a6
cpu/nrf5x: Tolerate NULL callback in timers
timer_set has no documented restriction on this being not null, other
implementations explicitly tolerate it (rpx0xx checks inside the ISR,
but doing it at init time keeps the ISR slim).

This is useful when using a timer just to read, without any action when
it triggers (the action is taken depending on read values, eg. in a
thread context).
2023-12-19 11:13:40 +01:00
benpicco
208790a5f1
Merge pull request #20108 from benpicco/drivers/dose-uart_ondemand_tx
drivers/periph/uart: add periph_uart_tx_ondemand feature
2023-12-14 20:42:55 +00:00
Benjamin Valentin
60f8468191 cpu/sam0_common: implement uart_tx_ondemand 2023-12-14 18:30:38 +01:00
Gunar Schorcht
d089c122c1 cpu/sam0_common: improve doc consistency for MTDs 2023-12-14 17:26:29 +01:00
benpicco
6eac1e1761
Merge pull request #15380 from benpicco/mtd_drop_write
mtd/*: drop .write() if .write_page() is implemented
2023-12-13 20:35:53 +00:00
Benjamin Valentin
c6646125f7 native/mtd: drop .write()
The old .write() function is only used as a fall-back if .write_page()
is not implemented.
We can drop it.
2023-12-13 16:50:41 +01:00
Benjamin Valentin
2235dc2464 cpu/esp_common: flash: drop .write()
The old .write() function is only used as a fall-back if .write_page()
is not implemented.
We can drop it.
2023-12-13 16:50:41 +01:00
Benjamin Valentin
6b86e274d9 cpu/sam0/uart: implement uart_pin_cts()/uart_pin_rts() 2023-12-12 20:26:17 +01:00
Marian Buschsieweke
3002f1efa3
cpu/stm32: fix periph_i2c for F1, F2, L1 and F4 families
- boot the I2C after init in low power mode
    - otherwise I2C will consume more power until the first time it is
      used, which is surprising
- STM32 F1 only: reconfigure SCL and SDA as GPIOs while the I2C
  peripheral is powered down
    - When the I2C peripheral is not clocked, it drives SCL and SDA
      down. This will dissipate power across the pull up resistor.
2023-12-12 09:55:47 +01:00
Marian Buschsieweke
13f0a5062d
cpu/stm32/periph_i2c: improve DEBUG output 2023-12-12 09:55:47 +01:00
Marian Buschsieweke
bb07bb6613
Merge pull request #20160 from maribu/cpu/msp430/timer
cpu/msp430: improve periph_timer
2023-12-10 13:02:30 +00:00
Marian Buschsieweke
a3cd9ef387
Merge pull request #20111 from maribu/cpu/nrf5x_common/cleanup_uart
cpu/nrf5x_common: clean up UART implementation
2023-12-10 08:32:30 +00:00
Marian Buschsieweke
e6154a04a1
cpu/msp430: aid optimizer
Declare functions retrieving the clock domains frequency as pure so
that common subexpressions can be eliminated more easily.
2023-12-10 09:11:23 +01:00
Marian Buschsieweke
7044699388
cpu/msp430: improve periph_timer
- add support for multiple timers
- add support for selecting clock source in the board's `periph_conf.h`
- add support for the prescaler
- implement `periph_timer_query_freqs`
- add a second timer to all MSP430 boards
    - the first timer is fast ticking, high-power
    - the second is slow ticking, low-power
2023-12-10 09:11:23 +01:00
Marian Buschsieweke
43e62e68f7
Merge pull request #20149 from maribu/cpu/stm32/buf-wfi
cpu/cortexm_common: work around bug on WFI for STM32
2023-12-09 15:45:12 +00:00
Marian Buschsieweke
46571b6aec
Merge pull request #20144 from maribu/periph_timer_query_freq-kinetis
cpu/kinetis: implement periph_timer_query_freqs
2023-12-09 12:39:06 +00:00
Marian Buschsieweke
95be5edf5c
Merge pull request #20145 from maribu/periph_timer_query_freq-nrf5x
cpu/nrf5x_common: implement periph_timer_query_freqs
2023-12-09 07:42:56 +00:00
Marian Buschsieweke
b40ab8f833
cpu/nrf5x_common: implement periph_timer_query_freqs 2023-12-08 23:23:07 +01:00
Marian Buschsieweke
2a6ef9fda4
Merge pull request #20146 from maribu/periph_timer_query_freq-qn908x
cpu/qn908x: implement periph_timer_query_freqs
2023-12-08 14:46:01 +00:00
Marian Buschsieweke
9718e9afc0
Merge pull request #20143 from maribu/periph_timer_query_freq-cc26xx_cc13xx
cpu/cc26xx_cc13xx: implement periph_timer_query_freqs
2023-12-08 14:45:55 +00:00
Marian Buschsieweke
481e3a95d4
Merge pull request #20142 from maribu/periph_timer_query_freq-atmega
cpu/atmega_common: implement periph_timer_query_freqs
2023-12-08 11:22:56 +00:00
Marian Buschsieweke
b0261f31ab
Merge pull request #20148 from maribu/periph_timer_query_freq-stm32
cpu/stm32: implement periph_timer_query_freqs
2023-12-07 21:57:49 +00:00
Marian Buschsieweke
eb2e6983d1
Merge pull request #20147 from maribu/periph_timer_query_freq-sam0
cpu/sam0_common: implement periph_timer_query_freqs
2023-12-07 16:24:32 +00:00
Marian Buschsieweke
b6a7815b48
cpu/sam0_common: implement periph_timer_query_freqs 2023-12-07 16:18:09 +01:00
Marian Buschsieweke
35e140b540
cpu/qn908x: implement periph_timer_query_freqs 2023-12-07 16:17:57 +01:00
Marian Buschsieweke
f52e20c248
cpu/kinetis: implement periph_timer_query_freqs 2023-12-07 16:17:31 +01:00
Marian Buschsieweke
c18c47d621
cpu/cc26xx_cc13xx: implement periph_timer_query_freqs 2023-12-07 16:15:43 +01:00
Marian Buschsieweke
e78630fc40
cpu/atmega_common: implement periph_timer_query_freqs 2023-12-07 16:15:22 +01:00
Marian Buschsieweke
3868a7fa10
cpu/stm32: implement periph_timer_query_freqs 2023-12-07 16:15:06 +01:00
Gunar Schorcht
d59d48d58b cpu/native: replace external mtd0 declaration
Since the `extern mtd_dev_t *` declarations were removed from board definitions, `mtd_dev_get` has to be used instead.
2023-12-07 15:32:49 +01:00
Marian Buschsieweke
dd88935f46
cpu/msp430: consistently use msp430 prefix in names
Previously sometimes `msp_` was used as prefix, sometimes `msp430_`.
This makes the naming consistent.
2023-12-06 17:10:11 +01:00
Marian Buschsieweke
1c281d2768
cpu/cortexm_common: work around bug on WFI for STM32
See [1] for details. (archive.org backup at [2]).

Fixes https://github.com/RIOT-OS/RIOT/issues/13918
Fixes https://github.com/RIOT-OS/RIOT/issues/14015

[1]: https://cliffle.com/blog/stm32-wfi-bug/
[2]: https://web.archive.org/web/20231205101603/https://cliffle.com/blog/stm32-wfi-bug/
2023-12-05 15:16:55 +01:00
benpicco
182700fef4
Merge pull request #20134 from benpicco/cpu/sam0_common-adc_continuous-fix
cpu/sam0_common: fix adc_continuous_sample()
2023-12-01 20:05:27 +00:00
Benjamin Valentin
1e9b1992df cpu/sam0_common: fix adc_continuous_sample() 2023-12-01 19:45:54 +01:00
Gerson Fernando Budke
166ee62300
cpu/atxmega: Drop unnecessary test config
Co-authored-by: MrKevinWeiss <weiss.kevin604@gmail.com>
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-12-01 14:12:24 +01:00
Gerson Fernando Budke
ab70f20069
cpu/avr8_common: Fix PM and Common peripherals build
Co-authored-by: Marian Buschsieweke <marian.buschsieweke@posteo.net>
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-12-01 14:12:24 +01:00
Gerson Fernando Budke
c64a64f549
cpu/atmega_common: Increase stack a little bit
This is necessary to allow run the thread_duel example.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-12-01 14:12:24 +01:00
Gerson Fernando Budke
9dfdedcaf7
cpu/atmega_common: Add PM on peripherals
Add PM blocks to adc/i2c/spi peripherals.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-12-01 14:12:23 +01:00
Gerson Fernando Budke
549e2b4de1
cpu/atxmega: Fix PM states on peripherals
Fix the required PM state on i2c and spi peripherals.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-12-01 14:12:23 +01:00
Gerson Fernando Budke
3b9368a99e
cpu/avr8: Enable PM periph to all SoC
This refactor the current xmega PM peripheral to avr8 common and extend
PM to cpus families.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-12-01 14:12:23 +01:00
david-vankampen
b09713e058
Merge branch 'RIOT-OS:master' into stm32_adc_cal 2023-11-27 14:22:39 -05:00
benpicco
c93a5b84a3
Merge pull request #20020 from gompper/periph/freqm
drivers/include/periph: add FREQM peripheral driver
2023-11-27 16:06:52 +00:00
Marian Buschsieweke
659ef97730
cpu/nrf5x_common: clean up UART implementation
The functions `uart_poweron()`, `uart_poweroff()` and  `uart_mode()`
can share code between the UART (UART without EasyDMA) and UARTE
(UART with EasyDMA) implementations, so let's do that.
2023-11-27 09:49:01 +01:00
Marian Buschsieweke
73bde97e9d
Merge pull request #20102 from maribu/cpu/nrf5x_common/clean_up_uart
cpu/nrf5x: clean up periph_uart
2023-11-26 20:43:29 +00:00
Marian Buschsieweke
a28003f0fa
cpu/nrf5x_common: add whitespace to please linter
Fixes the "comma should be followed by whitespace" warning from
`static-tests`.
2023-11-26 21:33:23 +01:00
Marian Buschsieweke
63faa5f162
cpu/nrf5x: clean up periph_uart
- nRF51: Use `uart_conf_t` for consistency with nRF52
- nRF52832: Use UARTE (UART with EasyDMA) over UART (without DMA), as
  done for all other nRF52 family members
- use `UARTE_PRESENT` to detect whether an UARTE can be used, rather
  than family names
2023-11-26 21:33:23 +01:00
Marian Buschsieweke
60676bfd5c
Merge pull request #20107 from maribu/cpu/nrf51/periph/i2c.c
cpu/nrf51: fix periph_i2c driver
2023-11-24 10:23:57 +00:00
Marian Buschsieweke
e407460243
cpu/nrf51: fix periph_i2c driver
The `i2c_read_bytes()` and `i2c_write_bytes()` function return the
number of bytes written / read, instead of `0` as the API contract
says. This fixes the issue.
2023-11-24 10:03:07 +01:00
Marian Buschsieweke
f4729c28ec
cpu/stm32/periph_spi: improve prescaler calculation
With only 8 possible prescalers, we can just loop over the values
and shift the clock. In addition to being much easier to read, using
shifts over divisions can be a lot faster on CPUs without hardware
division.

In addition an `assert()` is added that checks if the API contract
regarding the SPI frequency is honored. If the requested clock is too
low to be generated, we should rather have a blown assertion than
hard to trace communication errors.

Finally, the term prescaler is used instead of divider, as divider may
imply that the frequency is divided by the given value n, but
in fact is divided by 2^(n+1).
2023-11-24 08:49:25 +01:00
Marian Buschsieweke
63a2a50b5f
cpu/stm32/periph_spi: Fix /CS handling
Previously, the /CS signal was performed by enabling / disabling the
SPI peripheral. This had the disadvantage that clock polarity settings
where not applied starting with `spi_acquire()`, as assumed by e.g.
the SPI SD card driver, but only just before transmitting data.

Now the SPI peripheral is enabled on `spi_acquire()` and only disabled
when calling `spi_release()`, and the `SPI_CR2_SSOE` bit in the `CR2`
register is used for hardware /CS handling (as supposed to).
2023-11-24 08:49:25 +01:00