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

267 Commits

Author SHA1 Message Date
Benjamin Valentin
b6642a8cb7 cpu/samd21: add samd10 to Kconfig 2020-12-11 18:25:36 +01:00
Benjamin Valentin
a94919aeed cpu/samd21: add support for SAMD10 2020-12-11 18:25:36 +01:00
Benjamin Valentin
c5f8742877 cpu/samd21: add NVM User Page Mapping 2020-11-10 12:18:47 +01:00
Marian Buschsieweke
60802f864a
Merge pull request #15149 from benpicco/cpu/samd21-gclk7
cpu/samd21: improve GCLK7 magic
2020-11-03 18:14:09 +01:00
Benjamin Valentin
3aa46b6f58 cpu/samd21: fix vectors definition
Some SAMD21 CPUs from the D series have an additional TCC3 and / or
an additional analog comperator.

Add those to `vectors.c`.

Also rename the i2s interrupt to the proper name used by other sam0
devices.
2020-10-26 20:35:16 +01:00
Benjamin Valentin
5f2cd55e3c cpu/samd21: prepare for samd20
If a peripheral is not present on samd2x, the IRQ is used by
the next peripheral instead, there are no gaps.
2020-10-26 20:33:16 +01:00
Bas Stottelaar
22243aec7a cpu/*: realign ENABLE_DEBUG 2020-10-23 00:46:26 +02:00
Benjamin Valentin
91604d0217 cpu/samd21: clean up 'disabled GCLK' magic
It turns out hooking up an unused peripheral to a disabled GCLK
leads to surprising power savings.

Name the GCLK to be more explicit (and since not all members of
the extended samd2x family have a GCLK7).

Turns out we can just use a non-existing GCLK ID for this, this
even saves us a real GCLK that we can use for something else.

Also make sure to disable *all* peripherals by using
`GCLK_CLKCTRL_ID_Msk` instead of relying on a magic value.

Looks like we previously missed some, since this leads to some
additional power savings:

master:     4.22 mA
this patch: 4.09 mA
2020-10-02 23:16:52 +02:00
Benjamin Valentin
d9116684e5 cpu/cortexm_common: advertise puf_sram feature
`puf_sram` is a feature of the linker script, it does not need vendor
specific hardware support.
2020-09-11 16:30:45 +02:00
benpicco
5715f5776b
Merge pull request #14804 from bergzand/pr/sam0/gpio_iobus
sam0_common: Use Single-cycle I/O Port for GPIO when available
2020-09-10 23:45:43 +02:00
6007a31813
sam0: Add periph_gpio_fast_read feature where applicable 2020-09-10 22:13: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
e32b0783c4 cpu/samd21: define CPU_COMMON_SAMD21 symbol and use it 2020-08-24 16:13:18 +02:00
Benjamin Valentin
6b7cce02ec cpu/samd21: add all parts to Kconfig 2020-08-24 16:11:48 +02:00
benpicco
30ebabb84e
Merge pull request #14007 from benpicco/cpu/sam0_common-pwm
cpu/sam0_common: move PWM to common code, add support for saml21, samd5x
2020-07-09 10:01:08 +02:00
Francisco Molina
eefb3fa555
cpu/samd21: add unified rtt configuration 2020-06-19 09:16:22 +02:00
Francisco
5bb8c4b303
Merge pull request #14296 from leandrolanzieri/pr/cpu/adapt_kconfig_classification
cpu/kconfig: Rename CPU classification symbols
2020-06-17 10:26:20 +02:00
Leandro Lanzieri
d87f0cc66b
cpu/kconfig: Rename CPU classification symbols
This removes the `CPU_FAMILY` and `CPU_SERIES` common CPU symbols and
adds `CPU_FAM` instead.
2020-06-16 14:27:27 +02:00
Leandro Lanzieri
4d65bc8e0a
cpu: Rename CPU_ARCH to CPU_CORE 2020-06-16 12:05:40 +02:00
5dc1d87f74
cpu/samd21: add DMA peripheral to init 2020-06-12 20:04:05 +02:00
Benjamin Valentin
824f7aa82b cpu/sam0_common: move PWM to common code 2020-06-07 16:50:17 +02:00
Leandro Lanzieri
004162060e
cpu/samd21: Add CPU series specific Kconfig symbols 2020-06-02 17:42:16 +02:00
Dylan Laduranty
57c1a49a82
Merge pull request #13957 from benpicco/cpu/samd21-pwm_flex
cpu/samd21: PWM don't hard-code number of channels to 3
2020-05-02 20:52:56 +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
da89f6ac5f cpu/samd21: don't hard-code number of channels
Each TCC can have 8 PWM channels, so don't hard-code
3 channels/TCC.
2020-04-26 22:26:01 +02:00
Benjamin Valentin
4d90a9c6b5 cpu/samd21: pwm: fix GCLK_ID & APBCMASK calculation
GCLK_ID and APBCMASK entries are not always uniform.
The previous hack would already break for TCC3.

Just explosively write down the cases, there are only 5 at most.
2020-04-08 15:24:05 +02:00
Benjamin Valentin
01c573c612 cpu/samd21: pwm: allow to use channels > 3
Channels 4…7 are on the CCB register.
2020-04-03 01:02:38 +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
Dylan Laduranty
6bba4188fc
Merge pull request #13764 from benpicco/cpu/saml11/use_buck_converter
cpu/saml1x: select buck voltage regulator when possible
2020-04-01 14:47:47 +02:00
Benjamin Valentin
895eb943d8 cpu/sam0_common: add cpu_pm_cb_enter()/leave()
This allows to implement needed work-arounds surrounding sleep on
a per-MCU basis.
2020-03-31 17:18:58 +02:00
Leandro Lanzieri
c43543c21a
cpu/samd21: Add Kconfig file 2020-03-31 13:39:40 +02:00
Benjamin Valentin
51fa5afef7 cpu/samd21: default 1kHz clock to same source as 32kHz clock
The split between GEN2_ULP32K and GEN3_ULP32K was introduced to fix
a failure in tests/periph_wdt when the external oscillator was used.

By not running the external oscillator on demand, the failure can no
longer be observed, so default GEN3_ULP32K to GEN2_ULP32K.
2020-02-27 16:01:44 +01:00
Benjamin Valentin
2d7bc9e467 cpu/samd21: don't run XOSC32K on demand
This significantly reduces start-up time.
The XOSC32K is only configured when needed anyway.
2020-02-27 15:59:10 +01:00
benpicco
0edfd13df0
Merge pull request #13310 from benpicco/sam0-exti-common
cpu/sam0_common: use generic exti_config
2020-02-26 08:40:49 +01:00
Juergen Fitschen
1265efc785 cpu/sam0*: Wrap cortexm_sleep call 2020-02-24 11:48:13 +01:00
Benjamin Valentin
fd9a247200 cpu/sam0_common: use generic exti_config
Creating an `exti_config` array for a new MCU manually is tedious and error prone.
Luckiely all information is already availiable in the vendor files.

Credit for this discovery & method goes to @Sizurka

The file was generated with

```C

int main(void) {
        puts("static const int8_t exti_config[PORT_GROUPS][32] = {");

        for (unsigned port = 1; port < 5; ++port) {
                printf("#if PORT_GROUPS >= %d\n{\n", port);
                for (unsigned pin = 0; pin < 32; ++pin) {
                        printf("#ifdef PIN_P%c%02uA_EIC_EXTINT_NUM\n", '@' + port, pin);
                        printf("    PIN_P%c%02uA_EIC_EXTINT_NUM,\n", '@' + port, pin);
                        printf("#else\n    -1,\n#endif\n");
                }
                printf("},\n#endif\n\n");
        }

        puts("};");

        return 0;
}
```

No changes in generated code are expected, but this makes adding new members
of the sam0 CPU families much easier.
2020-02-20 11:23:51 +01:00
d7c0102115
cpu/cortexm: move CPU_ARCH/FAM to Makefile.features 2020-02-17 16:02:48 +01:00
1a75f26133 cpu/*: update to PM_BLOCKER_INITIAL as single value 2020-02-14 12:06:05 +01:00
Dylan Laduranty
03b6658721
Merge pull request #13313 from benpicco/samd21-asf
cpu/sam0_common: update samd21 vendor files to version 1.3.395
2020-02-11 21:50:56 +01:00
benpicco
33291ad675
Merge pull request #13306 from fjmolinas/pr_samr21_use_xosc
boards/sam[r/d]21-xpro: prefer XOSC32K for RTC/RTT (GCLK2)
2020-02-11 15:18:36 +01:00
Benjamin Valentin
e03780c8ca cpu/sam0_common: update samd21 vendor files to version 1.3.395
This release adds EXTINT defines compatible with later versions of
the sam0 series of MCUs.
2020-02-08 03:28:14 +01:00
Francisco Molina
238d56e474
cpu/samd21/cpu: reset GCLK before configuring them 2020-02-07 16:11:42 +01:00
Francisco Molina
2e542a2488
cpu/samd21: cleanup XOSC32K initialization 2020-02-07 15:54:56 +01:00
Francisco Molina
9ab22b6926
cpu/samd21: add GEN3_ULP32K selector 2020-02-07 15:53:32 +01:00
Benjamin Valentin
bd1953dd80 cpu/sam0_common: use vendor files to dispatch MCU headers
Instead of manually re-creating the files from ASF, just use
the vendor provided dispatch headers and ease the maintainance
burden.
2020-02-06 19:52:05 +01:00
Benjamin Valentin
38b6ee56f3 cpu/sam0: use defines for GCLK IDs
Give the clocks explicit names to better identify their meaning.
2020-02-04 21:16:54 +01:00
Benjamin Valentin
df33ffd0d3 cpu/samd21: only configure one 32kHz GCLK
Use the same 32 kHz GCLK to feed the PLL and the RTT, etc.
2020-02-04 21:16:54 +01:00
Benjamin Valentin
1496149bba cpu/sam0: don't hard-code peripheral clocks
Instead of hard-coding the peripheral clocks to CLOCK_CORECLOCK
introduce helper functions to return the frequency of the individual
GCLKs and use those for baud-rate calculations.

This requires the GCLK to be part of the peripheral's config struct.
While this is already the case for most peripherals, this also adds
it for those where it wasn't used before.

As it defaults to 0 (CLOCK_CORECLOCK) no change is to be expected.
2020-02-04 21:06:21 +01:00
925445d0ff
cpu/sam0: factorize dependencies in Makefile.dep 2020-01-28 13:18:39 +01:00
Benjamin Valentin
0d977b3b3c cpu/sam0_common/periph/uart: implement buffered write
Implement interrupt based uart_write() using a tsrb for the TX buffer.

To enable it, add

    USEMODULE += periph_uart_nonblocking

to your Makefile.
2019-11-27 19:01:00 +01:00