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

77 Commits

Author SHA1 Message Date
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
benpicco
6929577c76
Merge pull request #15845 from benpicco/boards/adafruit-itsybitsy-m4
boards: add adafruit-itsybitsy-m4
2021-02-09 19:41:43 +01:00
Benjamin Valentin
73f58bfa04 cpu/samd5x: Kconfig: don't provide periph_eth on CPU level
It's up to the board to expose it.
2021-02-09 16:15:33 +01:00
Benjamin Valentin
9c1455d55f cpu: make pm_layered a DEFAULT_MODULE
Allow to disable pm_layered in the bootloader to save some ROM.
2021-01-27 13:21:20 +01:00
Benjamin Valentin
8004aa4d34 cpu/sam0_common: not every CPU has DMA 2021-01-12 15:48:37 +01:00
dylad
c934d5dde3 kconfig: add PERIPH_ETH feature to samd5x 2020-12-13 22:30:54 +01:00
Benjamin Valentin
8f72212eb0 cpu/sam0_common: SPI: add support for QSPI in SPI mode
We can use the QSPI peripheral as an additional (non-Quad) SPI peripheral.
2020-12-11 22:33:08 +01:00
Benjamin Valentin
edbb5fe9d0 cpu/samd5x: add NVM User Page Mapping 2020-11-10 12:18:47 +01:00
Bas Stottelaar
22243aec7a cpu/*: realign ENABLE_DEBUG 2020-10-23 00:46:26 +02:00
Bas Stottelaar
ab6188cea3 cpu/*: add missing include of assert.h 2020-10-22 11:13:08 +02:00
Benjamin Valentin
310eb4970c cpu/sam0_common: GPIO: use tamper detection to wake from Deep Sleep
On samd5x only the RTC can wake the CPU from Deep Sleep (pm modes 0 & 1).
The external interrupt controller is disabled, but we can use the tamper
detection of the RTC.

If an gpio interrupt is configured on one of the five tamper detect pins,
those can be used to wake the CPU from Deep Sleep / Hibernate.
2020-09-17 18:46:25 +02:00
Benjamin Valentin
cd5a847684 cpu/sam0_common: define CPU_FAM based on CPU_MODEL 2020-08-24 16:13:18 +02:00
Benjamin Valentin
7ed4979148 cpu/samd5x: define CPU_COMMON_SAMD5X symbol and use it 2020-08-24 16:13:18 +02:00
Benjamin Valentin
2cd0236a8c cpu/samd5x: add all parts to Kconfig 2020-08-24 16:11:48 +02:00
János Brodbeck
7a7f06a3e1
cpu/samd5x: add ADC resolution type 2020-08-19 17:48:37 +02:00
Benjamin Valentin
548f59d380 cpu/samd5x: remove RTC workaround
This is no longer needed.
2020-07-31 22:00:09 +02:00
Leandro Lanzieri
1c9a95e955
cpu/samd5x: Add Kconfig symbols 2020-07-16 15:33:29 +02:00
Benjamin Valentin
93b43e5753 cpu/samd5x: make SAM0_GCLK_TIMER configurable 2020-06-20 00:25:54 +02:00
Benjamin Valentin
fba3aab2f3 cpu/samd5x: rename GCLK defines
Now that the GCLK defines are not always at a fixed frequency, rename
them to better reflect this.
2020-06-20 00:25:54 +02:00
Benjamin Valentin
17304d390c cpu/samd5x: use MHZ() macro 2020-06-20 00:25:53 +02:00
Benjamin Valentin
b5f407f9a4 cpu/samd5x: enable buck voltage regulator when possible
When an external oscillator is used and the internal fast oscillators
are off, we can enable the buck converter if the board supports it.
2020-06-20 00:25:53 +02:00
Benjamin Valentin
849c76578a cpu/samd5x: allow to use XOSC as clock source
Allow to run the main clock and all peripheral clocks off XOSC.
This is necessary if we want to use the buck voltage regulator.
2020-06-20 00:10:08 +02:00
Francisco Molina
36baec4512
cpu/samd5x: add unified rtt configuration 2020-06-19 09:16:23 +02:00
Leandro Lanzieri
4d65bc8e0a
cpu: Rename CPU_ARCH to CPU_CORE 2020-06-16 12:05:40 +02:00
73c8911e62
cpu/samd5x: Add DMA peripheral to init 2020-06-12 20:04:05 +02:00
Benjamin Valentin
bfb3d52a63 cpu/sam0_common: implement periph/dac
The sam0 MCUs all have a DAC peripheral.
The DAC has a resulution of 10 or 12 bits and can have one or two
output channels.

The output pins are always hard-wired to PA2 for DAC0 and PA5 for DAC1
if it exists.

On the same54-xpro I would only get a max value of ~1V when using the
internal reference, so I configured it to use an external voltage reference.

The external reference pin is hard-wired to PA3, so you'll have to connect
that to 3.3V to get results.
2020-05-02 18:31:55 +02:00
Benjamin Valentin
49fda3e900 cpu/samd5x: don't run DFLL on-demand
The DFLL on samd5x has a hardware bug that requires a special
re-enabling sequence when it is disabled and then re-enabled again.

When running the clock on-demand, the hardware handles the disabling
and re-enabling so that sequence does not get executed.

To reproduce, run `tests/periph_uart` on `same54-xpro`.

Without this patch the test will get seemingly stuck on `sleep_test()`.
(In fact it keeps running, but the DFLL has the wrong frequency so the
UART baudrate is wrong).

In this test, on `same54-xpro` only UART0 is sourced from DFLL.
So if the UART is disabled the DFLL will be turned off as well.
2020-04-02 20:11:41 +02:00
Benjamin Valentin
5d123cbb22 cpu/sam0_common: distribute PM_NUM_MODES among siblings
Also adapt the defines to the documentation

 - CPUs define up to 4 power modes (from zero, the lowest power mode,
   to PM_NUM_MODES-1, the highest)
 - >> there is an implicit extra idle mode (which has the number PM_NUM_MODES) <<

Previously on saml21 this would always generate pm_set(3) which is an illegal state.
Now pm_layered will correctly generate pm_set(2) for IDLE modes.

Idle power consumption dropped from 750µA to 368µA and wake-up from standby is also
possible. (Before it would just enter STANDBY again as the mode register was never
written with the illegal value.)
2020-04-01 18:10:23 +02:00
Benjamin Valentin
f6139ae346 cpu/samd5x: work around errata when (re-)initializing DFLL
When a previously disabled DFLL gets enabled again, the frequency will
be incorrect. Follow the procedure outlined in the errata sheet, section 2.8.3
to work around the issue.

This fixes wake from standby.
2020-04-01 15:41:20 +02:00