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

74 Commits

Author SHA1 Message Date
Benjamin Valentin
9dcb3991d2 cpu/sam0_common: move adc_res_t to common code 2023-01-17 17:18:07 +01:00
Jue
24461b43f8 cpu/sam0/spi: generalize pm_layered interaction
In DMA mode SPI transfers are carried out by HW. We need to block certain pm modes during transfer.
2022-11-03 14:53:44 +01:00
Jue
5866262122 cpu/sam0/usbdev: generalize pm_layered interaction
periph_cpu.h should define the required pm modes.
Additionally, some CPUs require a certain pm mode in USB IDLE mode.
2022-11-03 14:27:47 +01:00
Benjamin Valentin
361a94460a cpu/sam0_common: add ADC pin aliases 2022-08-31 18:23:44 +02:00
Benjamin Valentin
84add70772 cpu/samd21: define ADC pins 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
0340ac6129 cpu: include IDLE in PM_NUM_MODES 2022-04-06 12:29:25 +02:00
ee175fb583
cpu/samx21: allow to override #ifndef PM_BLOCKER_INITIAL 2022-03-11 10:48:12 +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
c5f8742877 cpu/samd21: add NVM User Page Mapping 2020-11-10 12:18:47 +01: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
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
Benjamin Valentin
824f7aa82b cpu/sam0_common: move PWM to common code 2020-06-07 16:50:17 +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
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
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
1a75f26133 cpu/*: update to PM_BLOCKER_INITIAL as single value 2020-02-14 12:06: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
Yegor Yefremov
5b0252b150 doxygen/ADC: don't include overridden typedefs
Add missing #ifndefs to overridden ADC resolution typedefs.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2019-11-15 10:35:32 +01:00
ca5b5a6d0f
samd21: Expose numerical PM states 2019-03-18 13:44:26 +01:00
Benjamin Valentin
5b0e427a52 samd21: enable idle modes
tested on samr21-xpro, UART and 802.15.4 still work as before, but
current draw drops from 12mA to 8mA.
2019-02-27 11:20:49 +01:00
dylad
a06ace7904 cpu/sam0: share GPIO configuration
Signed-off-by: dylad <dylan.laduranty@mesotic.com>
2017-11-10 10:43:08 +01:00
dylad
1e5262506d cpu/sam0: merge GPIO driver 2017-10-01 14:48:12 +02:00
dylad
89c885ea40 sam0/uart: merge samd21 & saml21 uart driver
Signed-off-by: dylad <dylan.laduranty@mesotic.com>
2017-08-29 21:26:42 +02:00
24a1aacca2 cpu/sam0: add missing doxygen group definition + cleanup 2017-08-24 14:54:47 +02:00
0fcc7d3834 cleanup: apply headerguard script output 2017-05-24 17:54:02 +02:00
dylad
44dd56c3e8 sam0/adc: merged samd21 & saml21 adc driver
Signed-off-by: dylad <dylan.laduranty@mesotic.com>
2017-05-12 21:02:17 +02:00
Bumsik Kim
dfba4394c6 cpu/samd21: move adc channel struct definition to periph_cpu.h 2017-05-05 10:19:39 -04:00
Hauke Petersen
5c7ed2228d pm_layerd: fix initial value for PM_BLOCKER_INITIAL
the current value was a debugging left-over and should
actually be 0.
2017-03-28 19:32:32 +02:00
Hauke Petersen
ea07a6817c cpu/sam0+boards: adapted to new SPI API
- adapted the SPI driver
- merged SPI driver for samr21 and saml21
- adapted all boards using the CPU
2017-01-25 16:46:45 +01:00
245f60edfa cpu: fix typo in author email 2017-01-19 21:45:23 +01:00
f42e5381ee cpu: samd21: add periph/pm support 2017-01-12 16:26:01 +01:00
Hauke Petersen
bfb52afde9 cpu/sam21: unified structure for sam[drl]21 CPUs 2016-12-15 11:39:19 +01:00
Hauke Petersen
ac6b73a35c cpu/samd21(common): cleaned up pad selection macros
- renamed uart and spi pad selection macros to consistent style
- adapted uart and spi implementation to use new names
2016-10-07 11:02:14 +02:00
Kees Bakker
4ad3313ae5 cpu/sam21_common: add a few typedefs for SERCOM
A generic function is added to initialize a SERCOM.

Notice that uart_conf_t was expanded with pad settings, but it isn't used
yet.
2016-09-21 20:34:21 +02:00
Kees Bakker
8644b5f7a0 cpu/samd21: introduce sam0.h so that we can select samr21.h or other
In the Makefile.include of the board it is required to set the correct
define.

Currently only SAMRG18A is supported, as required by samr21-xpro.
2016-09-21 19:43:30 +02:00
Kees Bakker
2869d7729d cpu/samr21: rename ASF include files to prepare for ASF update 2016-09-21 19:43:30 +02:00
Oleg Hahm
d2e8efc6cc samd21: do not redefine LITTLE_ENDIAN 2016-07-05 12:10:30 +02:00
Ian Martin
49ae438dd5 doc: eliminate clutter in adc and gpio periph docs 2016-06-29 15:08:32 -04:00
zhuoshuguo
efbbca1322 cpu: Fix header include guards 2016-06-20 10:18:59 +02:00
Hauke Petersen
d3b21ddf96 cpu/samd21: adapted GPIO driver 2016-03-17 14:39:11 +01:00
6881f65f46 cpu: cortexm*: move cpu_conf.h stuff from cpu.h into cpu_conf_common.h 2016-03-05 18:20:17 +01:00
Hauke Petersen
bc1013b54e cpu/samd21: allowed third PWM channel per device 2016-02-21 16:49:45 +01:00
Hauke Petersen
48a639f8fd cpu/sam21_common: used shared periph_cpu.h 2016-02-08 19:04:28 +01:00
Hauke Petersen
940097336a cpu: cleanup and unification of CPUID implementations
- moved definition of CPUID_LEN to periph_cpu.h
- fixed some doxygen
- simplyfied some implementations
2016-02-08 14:36:03 +01:00
Hauke Petersen
476167a86c cpu: fixed any doxygen warning realated to 'periph' 2015-11-19 16:08:38 +01:00
Hauke Petersen
13fcefb638 s cpu: moved pwm_conf_[chan_]t to periph_cpu.h 2015-10-23 11:41:04 +02:00