1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2026-01-01 01:41:18 +01:00

105 Commits

Author SHA1 Message Date
Karl Fessel
ca5a3227fb cpu/samd5x: seperate irq handlers 2025-05-21 22:34:04 +02:00
Karl Fessel
3139df7e52 samd54: fix buffer handling 2025-05-20 18:10:52 +02:00
Marian Buschsieweke
e29bfedf44
cpu/sam*: update style to coding convention
- Use `#pragma once`
- Indent preprocessor directives inside conditional compilation
- Drop unused `#include`s
2025-05-05 08:59:00 +02:00
Marian Buschsieweke
5926a7d3ec
cpu/samd5x/periph_can: allow starting in monitor mode
Allowing to configure the CAN controller to start in monitor mode right
away reduces the risk to change traffic (e.g. by sending an ACK)
between initialization and the switch to monitor mode, if intneded to
be a passivle listnener only.
2025-04-08 07:29:00 +02:00
Marian Buschsieweke
0e44951dcb
cpu/samd5x/periph_can: allow specifying initial bitrate
Being able to specify the bitrate from the peripheral config makes
a lot more sense than starting up the CAN with an incorrect bitrate and
letting the app change it later on.
2025-04-08 07:28:59 +02:00
Marian Buschsieweke
3532ceca91
cpu/samd5x/periph_can: Implement monitoring mode
This implements the missing monitoring mode.
2025-04-08 07:28:58 +02:00
Marian Buschsieweke
34c34d9a24
cpu/samd5x/periph_can: Make TXP configurable
Allow the board to configure whether the transmit pause feature of the
CAN controller should be used or not.

The default is to not enable transmit pause feature for consistency with
other CAN controllers. For many use cases enabling the transmit pause is
the better option though, as it will only slightyly decrease the maximum
throughput by inserting a 2 bit time pause between two subsequent
frames to send. The benefit is that it will ensure that nodes on the CAN
bus with a lower priority (according to their CAN ID) will not starve,
effectively prevending the "Babbling Idot Syndrome".
2025-04-08 07:28:58 +02:00
Marian Buschsieweke
cd42e4355b
cpu/samd5x/periph_can: Make DAR configurable
Allow the board to configure whether automatic retransmission is to be
used or disabled.

This also changes the default to enabling automatic retransmission, as
this is the best choice for most use cases.
2025-04-08 07:28:57 +02:00
Karl Fessel
c44f01a4b3
Merge pull request #21173 from kfessel/p-sam-caninit
cpu/samd5x: improve can-initialization
2025-04-05 18:13:31 +00:00
Marian Buschsieweke
571a87358d
cpu/samd5x/periph_can: fix use of format specifiers
Use correct format specifiers to make clangd happy.
2025-03-12 16:05:41 +01:00
Marian Buschsieweke
d9ab9585d9
cpu/samd5x: add enable pin to CAN configuration
This extends the `can_conf_t` CAN configuration to allow power
management of the CAN transceiver to be done by the CAN driver.
2025-03-11 21:17:05 +01:00
Marian Buschsieweke
c48525fc4e
cpu/samd5x/periph_can: fix RX
CAN required CLK_CANx_APB and CLK_CANx_APB to be running and will not
request any clock by itself. We can ensure both clocks to be running
by preventing the MCU from entering IDLE state.

The SAMD5x/SAME5x Family Data Sheet says in Section
"39.6.9 Sleep Mode Operation" says:

> The CAN can be configured to operate in any idle sleep mode. The CAN
> cannot operate in Standby sleep mode.
>
> [...]
>
> To leave low power mode, CLK_CANx_APB and GCLK_CANx must be active
> before writing CCCR.CSR to '0'. The CAN will acknowledge this by
> resetting CCCR.CSA = 0. Afterwards, the application can restart CAN
> communication by resetting bit CCCR.INIT.

tl;dr: At most SAM0_PM_IDLE is allowed while not shutting down the CAN
controller, but even that will pause communication (including RX).

Apparently, the CAN controller was never tested without also using the
USB peripheral, which kept the clocks running as side effect.
2025-02-01 14:13:42 +01:00
Karl Fessel
1fa6e094fe cpu/samd5x: improve can-initialization 2025-01-30 22:01:45 +01:00
Benjamin Valentin
7fab445e94 cpu/samd5x: add support for SAM E51 2025-01-07 11:36:45 +01:00
Marian Buschsieweke
33195d7965
cpu/sam{d21,d5x,l21}: Claim support for BlackMagic Probe
Using `PROGRAMMER=bmp` has been proven to work reliably at least on
SAMD21, SAMD5x and SAML21.

Since using unsupported programmers is treated as a warning, this change
only reduces the noise in the shell a bit and is not a functional
change.

[1]: https://black-magic.org/supported-targets.html
2024-11-21 17:20:48 +01:00
Marian Buschsieweke
2ea8601b69
cpu/samd5x/periph_cph.h: drop non-UTF-8 chars
There were some bogus chars in a comment. Let's drop them.
2024-10-08 14:16:24 +02:00
Marian Buschsieweke
20e218680c
cpu/samd5x/cpu.c: reformat code
This formats the code to improve readability and apply the coding
convention. This is a whitespace only change that will not change
generated binaries.
2024-09-17 22:07:46 +02:00
Dylan Laduranty
26b3583aa9 cpu/samd5x: avoid the use of bitfield in periph
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2024-06-29 13:26:51 +02:00
Dylan Laduranty
41c003d670 cpu/samd5x: avoid the use of bitfield in cpu init
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2024-06-27 21:51:13 +02:00
Firas Hamdi
59c9f68307 cpu/samd5x: Enable and handle errors interrupts 2024-05-16 15:00:28 +02:00
Firas Hamdi
b35e60e720 cpu/samd5x: add CAN error codes 2024-05-16 15:00:28 +02:00
Karl Fessel
c623c50fcf cpu/samd5x/can: assert eff-flag if extended id range 2024-05-08 22:43:01 +02:00
Karl Fessel
1d53d31339 cpu/samd5x/can: set EFF and RTR Flag if received 2024-05-07 10:48:14 +02:00
Firas Hamdi
599967fe26 cpu/samd5x: reword & correct debug output 2024-04-18 15:42:57 +02:00
Karl Fessel
9d2dda27ce
Merge branch 'master' into cpu/samd5x-write-CAN-driver 2024-03-28 09:52:26 +01: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
Urs Gompper
12acc8dec9 cpu/samd5x: make GCLK definitions overwritable 2023-11-23 21:00:16 +01:00
Urs Gompper
b1e31fbf61 cpu/samd5x: define GCLK pins 2023-11-23 21:00:15 +01:00
Urs Gompper
5479c7eb96 cpu/samd5x: add conditional enabling of freqm peripheral 2023-11-23 20:53:14 +01:00
Gunar Schorcht
33d1e82b73 cpu/samd5x: define power modes 2023-09-23 19:26:30 +02:00
Gunar Schorcht
b859da8495 cpu/samd5x: change FDPLL1 frequency to 100 MHz
The only peripheral that currently uses the FDPLL1 is SDHC. However, the SDHC IP can only be clocked at up to 150 MHz. Therefore, 100 MHz is currently used as the frequency of the FDPLL1. If another peripheral device requires 200 MHz in the future, this must be realized via different clock generators.
2023-06-20 12:48:54 +02:00
Dylan Laduranty
6607ed10f6 cpu/samd5x: add support for FDPLL1 running at 200MHz
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-05-16 16:04:17 +02:00
Dylan Laduranty
f790d9fe36 cpu/samd5x: replace fdpll0_init by two generic functions
These functions can be used to set both FDPLL0 and FDPLL1 by using an extra argument 'idx' (index) and allow to set the ONDEMAND bit using the 'flags' argument

Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-05-16 16:03:15 +02:00
Dylan Laduranty
af2fa99470 cpu/samd5x: remove duplicate USE_VREG_BUCK
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-05-16 15:54:18 +02:00
Dylan Laduranty
ba83e13d10 cpu/samd5x: fix SAM0_DPLL_FREQ_MAX_HZ value
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-05-16 15:53:20 +02:00
Benjamin Valentin
9dcb3991d2 cpu/sam0_common: move adc_res_t to common code 2023-01-17 17:18:07 +01:00
Benjamin Valentin
124b849503 cpu: call early_init() 2023-01-08 22:26:12 +01:00
benpicco
baf1687951
Merge pull request #18146 from benpicco/cpu/sam0_common/adc-diffmode
cpu/sam0_common: adc: add support for differential mode
2022-09-27 17:34:07 +02:00
Benjamin Valentin
361a94460a cpu/sam0_common: add ADC pin aliases 2022-08-31 18:23:44 +02:00
Benjamin Valentin
babee877ce cpu/sam0_common: add SD Host Controller implementation 2022-05-31 11:07:20 +02:00
Benjamin Valentin
75ee373b01 cpu/samd5x: define ADC pins
rg define\ PIN_.*_AIN | grep ADC | cut -d' ' -f2 | sort | uniq | sed -E "s/PIN_(P[A-F])([0-9][0-9])B_ADC0_AIN([0-9]*)/\3 GPIO_PIN(\1, \2),/" | sort -n | grep GPIO | cut -d ' ' -f2- | sed -E "s/0([0-9])/\1/"
rg define\ PIN_.*_AIN | grep ADC | cut -d' ' -f2 | sort | uniq | sed -E "s/PIN_(P[A-F])([0-9][0-9])B_ADC1_AIN([0-9]*)/\3 GPIO_PIN(\1, \2),/" | sort -n | grep GPIO | cut -d ' ' -f2- | sed -E "s/0([0-9])/\1/"
2022-05-30 20:41:18 +02:00
Benjamin Valentin
11acdd0526 cpu/samd*: adjust PM_BLOCKER_INITIAL to the new API
For saml1x and samd5x this becomes now obsolete as the default provides
this behavior.
2022-04-06 12:29:25 +02:00
Benjamin Valentin
7c3bfb980e cpu/samd5x: allow to block IDLE mode
Make it possible to prevent the CPU clock from stopping.
2022-03-29 18:14:41 +02:00
benpicco
e8cbf1ea90
Merge pull request #16681 from benpicco/drivers/dose-collision
drivers/dose: make use of UART collision detection feature
2021-12-08 20:48:28 +01:00
Benjamin Valentin
a51fb298dc cpu/sam0_common: implement periph_uart_collision feature 2021-12-08 17:35:00 +01:00
Benjamin Valentin
669104d841 cpu/sam0_common: SPI: don't perform DMA transfer for small buffers
Setting up a DMA transfer can take longer than sending out a buffer
byte by byte if the buffer is small.

DMA only shows advantages for large buffers, using it for every transfer
will cause a net slowdown.

Since we did not come up with a good way to determine the treshold based
on the SPI frequency, just use a fixed buffer for now so that DMA can be
used without slowing things down overall.
2021-11-19 17:22:51 +01:00
Jean-Pierre De Jesus DIAZ
480e22be66 cpu/sam*: fix doxygen grouping warnings
Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
2021-09-11 12:45:15 +02:00
Benjamin Valentin
3fbf473a07 cpu/sam0_common: implement periph_rtc_mem 2021-09-03 11:43:43 +02:00