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

521 Commits

Author SHA1 Message Date
dylad
e98459f414 cpu/saml11: fix GPIO/IOBUS management 2020-12-15 17:00:54 +01:00
Dylan Laduranty
aec905d697
Merge pull request #15620 from benpicco/cpu/sam0_common/dac_startup
cpu/sam0_common: DAC: wait for DAC to be ready
2020-12-15 12:25:32 +01:00
dylad
a1f5b6182d cpu/sam0: add initial Ethernet support 2020-12-13 22:01:50 +01:00
Benjamin Valentin
c5c46ba35b cpu/sam0_common: DAC: wait for DAC to be ready
The DAC can have some start-up delay.
If we try to write to it before it's ready, it will get stuck.

This happens now that `tests/driver_dac_dds` immediately sets a DAC
value after init.

The samd2x class of MCUs doesn't have this bit, but a quick test on
samd10 shows that it might not be nececary there - the DAC does not
get stuck when writing to it immediately after init.
2020-12-13 02:11:36 +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
94c7f40b9c cpu/sam0_common: SPI: add support for SAMD20 2020-12-11 22:33:07 +01:00
Benjamin Valentin
fb2a6b7024 cpu/sam0_common: SPI: cleanup
Insert whitespace and factor out functions to make it easier to
add functionality.
2020-12-11 22:33:07 +01:00
Benjamin Valentin
531fca952b cpu/sam0_common: add samd10 vendor files
Files from Atmel.SAMD10_DFP.1.1.77.atpack
2020-12-11 18:25:36 +01:00
Benjamin Valentin
2845554b4e cpu/sam0_common: flashpage: rename to sam0_flashpage_aux_write()
`flashpage_write_raw()` got renamed to `flashpage_write()`.
Now `sam0_flashpage_aux_write_raw()` is the only remaining 'raw'
function, even though it behaves just like `flashpage_write()`.

So let's also rename that for consistency.
2020-11-17 00:34:31 +01:00
72d7a903a2
sam0: Adapt to flashpage/flashpage_pagewise API 2020-11-11 23:16:41 +01:00
Benjamin Valentin
4e8c461f46 cpu/sam0_common: flashpage: invalidate cache on _lock() 2020-11-10 14:21:47 +01:00
Benjamin Valentin
e6192a13bd cpu/sam0_common: flashpage: support unaligned writes
We can pad the unaligned bytes with 0xFF to make up a whole word that
can be written.
2020-11-10 12:18:47 +01:00
Benjamin Valentin
20f093ede6 cpu/sam0_common: flashpage: introduce functions to write to user page 2020-11-10 12:18:47 +01:00
Leandro Lanzieri
7185edb070
cpu/sam0_common/periph: add periph_rtc_rtt module to Kconfig 2020-11-06 15:57:56 +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
Marian Buschsieweke
d046772e7f
Merge pull request #15348 from maribu/periph_timer_type
drivers/periph_timer: Use uint32_t over unsigned long for frequency
2020-10-30 23:22:51 +01:00
Marian Buschsieweke
125c892c03
drivers/periph/timer: Use uint32_t for frequency
For all currently supported platforms `unsigned long` is 32 bit in width. But
better use `uint32_t` to be safe.
2020-10-30 22:02:12 +01:00
Benjamin Valentin
8e4af4d778 cpu/sam0_common: remove unused linker script
`samd21j18a_arduino_bootloader.ld` is not referenced anywhere else
in the codebase and it's job is performed by the generic `ROM_OFFSET`
variable.
2020-10-28 23:17:48 +01:00
Bas Stottelaar
22243aec7a cpu/*: realign ENABLE_DEBUG 2020-10-23 00:46:26 +02:00
Bas Stottelaar
fb61443bbd cpu/*: remove unused assert.h include 2020-10-22 11:13:09 +02:00
Bas Stottelaar
ab6188cea3 cpu/*: add missing include of assert.h 2020-10-22 11:13:08 +02:00
Cenk Gündoğan
f05ac07f19
Merge pull request #15217 from leandrolanzieri/pr/kconfig/allow_merge_configs
makefiles/kconfig: always allow to use KCONFIG_ADD_CONFIG
2020-10-13 15:11:09 +02:00
Leandro Lanzieri
4d7ea1b50a
makefiles/kconfig: always allow to use KCONFIG_ADD_CONFIG 2020-10-13 09:53:00 +02:00
Leandro Lanzieri
fe6d66d92a
kconfig: add ERROR symbol for conflicting modules 2020-10-09 18:04:17 +02:00
Benjamin Valentin
35d6736d9d cpu/sam0_common: PWM: use named GCLK for disabling peripheral 2020-10-02 23:17:53 +02:00
35f357a9ad
cpu/sam0_common: fix typos
- 'acces' -> 'access'
- 'withing' -> 'within'
2020-10-02 07:58:35 +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
0499d016ad cpu/sam0_common: implement RTC tamper detection 2020-09-17 18:45:50 +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
Dylan Laduranty
4db8a1f602
Merge pull request #14478 from benpicco/cpu/sam0/tc_pwm
cpu/sam0_common: add support to run PWM off TC timers
2020-09-10 23:04:58 +02:00
ddb22a3c56
sam0_common: Use Single-cycle I/O Port for GPIO when available
The Cortex-m0 based ATSAM devices can use the Single-cycle I/O Port for
GPIO. This commit modifies the gpio_t type to use this port when
available. It is mapped back to the peripheral memory space for
configuration access.  When it is not available, the _port_iobus() and
_port() functions behave identical, which is the case for the samd51.
2020-09-10 22:13:24 +02:00
Benjamin Valentin
0437461812 cpu/sam0_common: PWM: add support to run PWM off TC timers 2020-09-10 21:47:03 +02:00
Leandro Lanzieri
2e79e00ca7
treewide: change Kconfig prefix for module symbols
This changes the prefix used for the symbols that reprensent modules
(not the ones generated from USEMODULE).

MOD_ => MODULE_
2020-08-31 09:57:28 +02:00
Leandro Lanzieri
d25fc243c4
treewide: change prefix for generated Kconfig symbols.
This changes the prefixes of the symbols generated from USEMODULE and
USEPKG variables. The changes are as follow:

   KCONFIG_MODULE_ => KCONFIG_USEMODULE_
   KCONFIG_PKG_ => KCONFIG_USEPKG_
   MODULE_ => USEMODULE_
   PKG_ => USEPKG_
2020-08-31 09:37:09 +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
52a95642d5 sam0/adc: make driver MCU family agnostic
Replace checks for `CPU_SAMD21` with checks for actual defines.
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
cc7f897cbc cpu/saml1x: define CPU_COMMON_SAML1X symbol and use it 2020-08-24 16:13:18 +02:00
Benjamin Valentin
5d96151775 cpu/saml21: define CPU_COMMON_SAML21 symbol and use it 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
582da9b233 cpu/sam0_common: add script to generate Kconfig files for all parts
e.g. Usage:

	./sam0_common/dist/kconfig_gen.sh samd51
2020-08-24 16:13:18 +02:00
János Brodbeck
083b3c167f
sam0/adc: add support for samd5x/same5x
Add samd5x/same5x support  through introducing ADC_DEV as alias for ADC0/ADC1/ADC. ADC (respectively ADC0) is the default if no device is set.
2020-08-19 18:00:29 +02:00
Leandro Lanzieri
7dc6639f59
cpu/cortexm_common: add default Kconfig configuration 2020-08-12 12:22:43 +02:00
Leandro Lanzieri
f4e651e26d
cpu/sam0_common: Add default Kconfig configuration
The configuration file is included by samd21 so it is merged when using
Kconfig.
2020-08-12 12:22:42 +02:00
Leandro Lanzieri
0ddd2886b7
cpu/sam0_common: add sam0_common_periph module to Kconfig 2020-08-12 12:22:39 +02:00
benpicco
419ee52ddc
Merge pull request #14711 from benpicco/cpu/sam0_common/gpio-intermediate_irq
cpu/sam0_common: GPIO: ignore stale interrupts
2020-08-11 16:32:57 +02:00
benpicco
3ef906c841
Merge pull request #14563 from benpicco/cpu/sam0_common-bitarithm_test_and_clear
cpu/sam0_common: GPIO: use bitarithm_test_and_clear()
2020-08-11 14:05:06 +02:00
Francisco
16f47fc893
Merge pull request #14502 from benpicco/cpu/sam0_common/flashpage_cleanup
cpu/sam0_common: flashpage: clean up implementation
2020-08-10 08:21:49 +02:00
Benjamin Valentin
d02aa4a6b5 cpu/sam0_common: RTC: use RIOT_EPOCH 2020-08-07 13:24:10 +02:00
Benjamin Valentin
39d71ac671 cpu/sam0_common: GPIO: ignore interrupts when interrupts are disabled
If we disable an external interrupt, GPIO events that would generate an interrupt will still set the interrupt flag.
That means once we enable the interrupt again, a stale interrupt will be triggered.

This is surprising and probably not what the user wants, unfortunately the API documentation is not very clear about what to expect.
There is however no way to drop those intermediate interrupts with the current API.

Ignoring the events that occurred while the GPIO interrupt were disabled is probably the right (and expected) thing to.
2020-08-05 16:57:05 +02:00
Leandro Lanzieri
d7dbbb71ac
Merge pull request #14226 from benpicco/cpu/sam0_common/i2c_arbitrary_freqs
cpu/sam0_common: i2c: fix BAUD handling & cleanup
2020-08-04 14:49:10 +02:00
Benjamin Valentin
1472d2095c cpu/sam0_common: i2c: document frequency constraints 2020-08-04 12:13:28 +02:00
Benjamin Valentin
e560042488 cpu/sam0_common: flashpage: split RWWEE and normal functions
Move common code into helper functions and extract the commands
that differ between normal and RWWEE page reading / writing.
This cuts down on `#ifdef` use.
2020-08-04 12:00:49 +02:00
Benjamin Valentin
83a56ae666 cpu/sam0_common: merge RTC & RTT implementation
The RTC and RTT share the same peripheral, so they can also
share the same code.

This is needed to integrate the Tamper Detection into common
RTC/RTT code.
2020-07-31 22:00:09 +02:00
Benjamin Valentin
cc2a3c9fd3 cpu/sam0_common: GPIO: use bitarithm_test_and_clear() 2020-07-28 12:43:39 +02:00
Benjamin Valentin
003c25b2e8 cpu/sam0_common: uart: document frequency constraints 2020-07-28 11:22:22 +02:00
Benjamin Valentin
e1f84de6c5 cpu/sam0_common: UART: simplify init sequence
We don't need to read-modify-write the CTRLA register to disable
the UART.
The entire CTRLA register is re-written just a few lines below, so
we can just set it to 0 to disable the UART.

There is also no need to reset the UART since we re-write all config
registers in init.
2020-07-28 11:22:22 +02:00
Benjamin Valentin
28c1c502bc cpu/sam0_common: UART: implement arithmetic BAUD mode
SAMD20 does not implement a Fractional Baud mode, so we have to
implement Asynchronous Arithmetic mode.
2020-07-28 11:22:22 +02:00
Benjamin Valentin
e6f33fc436 cpu/sam0_common: uart: implement the periph_uart_reconfigure feature 2020-07-28 10:10:15 +02:00
Benjamin Valentin
62dbb21f19 cpu/sam0_common: UART move pin configuration to function
Makes the init code easier to read.
2020-07-28 10:10:15 +02:00
Benjamin Valentin
4df36cbfda cpu/sam0_common: i2c: improve readability of baud rate calculation
Use variables to represent fSCL an fGCLK to make the baud rate calculation
more readable.
2020-07-25 15:14:55 +02:00
Benjamin Valentin
2fb0d9061f cpu/sam0_common: i2c: fix High Speed 2020-07-25 15:14:55 +02:00
Benjamin Valentin
7269dc4e3a cpu/sam0_common: i2c: allow arbitrary I2C frequencies
The Atmel I2C peripheral supports arbitrary I2C frequencies.
Since the `i2c_speed_t` enum just encodes the raw frequency values,
we can just use them in the peripheral definition.

We just have to remove the switch-case block that will generate an error
for values outside of `i2c_speed_t`.
2020-07-25 15:14:55 +02:00
Benjamin Valentin
c5f6a5c6f5 cpu/sam0_common: PWM: prepare for TC timers as PWM source 2020-07-19 01:38:15 +02:00
Benjamin Valentin
a96e5666b4 cpu/sam0_common: PWM: fix doxygen group 2020-07-19 01:38:15 +02:00
Benjamin Valentin
48340f971f cpu/sam0_common: flashpage: clean up helper function 2020-07-14 20:50:50 +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
Benjamin Valentin
bce7d25f10 cpu/sam0_common: add PWM support for saml2x, samd5x 2020-07-08 21:51:12 +02:00
Francisco
325b7a8d8e
Merge pull request #13631 from benpicco/cpu/sam0_common/spi-deinit
drivers/periph/spi: add periph_spi_reconfigure feature & implementation for sam0
2020-06-30 15:34:53 +02:00
Francisco
48bdd7018a
Merge pull request #14302 from fjmolinas/pr_sam0_rtt_opt
cpu/sam0_common/rt%: use READREQUEST when accessing CLOCK/COUNT regs
2020-06-24 08:42:03 +02:00
Bas Stottelaar
6774f7e412
Merge pull request #14337 from benpicco/TIMER_CHANNEL_NUMOF
use TIMER_CHANNEL_NUMOF instead of TIMER_CHANNELS
2020-06-24 01:19:17 +02:00
Benjamin Valentin
c8ff026640 cpu/sam0_common: use TIMER_CHANNEL_NUMOF 2020-06-24 00:45:35 +02:00
Francisco
a73b61e30b
Merge pull request #14320 from benpicco/cpu/sam0_common-gpio_gclk
cpu/sam0_common: GPIO always default to MAIN clock for EXTI, make configurable
2020-06-23 22:48:45 +02:00
Benjamin Valentin
3e91914831 cpu/sam0_common: spi: implement the periph_spi_reconfigure feature 2020-06-21 21:19:17 +02:00
Francisco Molina
bdda25c534
cpu/sam0_common/rt%: issue READREQUEST to access CLOCK/COUNT regs
read-synchronized register will stall immediatly when read, instead
issue READREQUEST and wait for sync to be unset.
2020-06-19 14:10:31 +02:00
Benjamin Valentin
c0203ad35c cpu/sam0_common: GPIO default to MAIN clock for EXTI, make configurable
Currently only samd21 used the 32 kHz clock for EXTI which makes it miss fast events.
All newer members of the family use the MAIN clock.

While touching this, also make the clock source configurable to this can be overwritten,
e.g. in the board config if desired.
2020-06-19 13:27:48 +02:00
Francisco
a970163812
Merge pull request #14312 from benpicco/cpu/sam0_common/periph/uart-rxonly
cpu/sam0_common: UART: allow RX only configuration
2020-06-19 11:44:10 +02:00
benpicco
c3314e1a0c
Merge pull request #14303 from fjmolinas/pr_sam0_unified_rtt
cpu/sam0: unified rtt configuration
2020-06-19 11:30:06 +02:00
Francisco Molina
ff24aa61f3
cpu/sam0_common/periph/rtt: uncrustify 2020-06-19 09:16:24 +02:00
Francisco Molina
15bbd95b6a
cpu/sam0_common/rtt: add configurable RTT_FREQUENCY 2020-06-19 09:16:24 +02:00
Benjamin Valentin
5c3ae77df9 cpu/sam0_common: UART: allow RX only configuration 2020-06-19 00:33:50 +02:00
Dylan Laduranty
6bf0a41399
Merge pull request #13600 from benpicco/sam0-gpio
cpu/sam0_common: GPIO IRQ optimizations
2020-06-17 21:23:19 +02:00
07c78efc83
Merge pull request #14285 from fjmolinas/pr_uart_nb_race
sam0/stm32: fix possible uart_nonblocking deadlock
2020-06-17 12:14:25 +02:00
Francisco Molina
80d682becd
cpu/sam0: avoid deadlock on nonblocking write
If a write to a full tsrb is attempted with disabled interrupts
or in a interrupt then a deadlock will occure. To avoid this make
space in the ringbuffer by synchronously writing to uart.
2020-06-17 10:01:21 +02:00
Francisco Molina
0b8adb2d27
cpu/sam0-stm32/uart: rename tx buf size to UART_TXBUF_SIZE 2020-06-17 10:01:20 +02:00
Benjamin Valentin
585dc15f99 cpu/sam0_common: UART: implement inverted RX & TX
The UART TX and TX lines on SAMD5x and SAML1x can be inverted.
However, the flags don't do exactly what one would expect.

See errata 2.18.5: SERCOM-UART: TXINV and RXINV Bits Reference:

> The TXINV and RXINV bits in the CTRLA register have inverted functionality.
>
> Workaround:
> In software interpret the TXINV bit as a functionality of RXINV, and conversely,
> interpret the RXINV bit as a functionality of TXINV.
2020-06-16 22:55:37 +02:00
benpicco
1992f57765
Merge pull request #14261 from bergzand/pr/sam0_common/spi_dma
sam0_common: Make SPI peripheral DMA compatible
2020-06-14 18:25:37 +02:00
60f4502e6c
cpu/sam0_common: Make SPI peripheral DMA compatible 2020-06-14 14:56:20 +02:00
22c8788b58
sam0_common/dma: Rename len to num 2020-06-14 11:51:36 +02:00
02b2b58358
sam0_common: Add additional documentation on DMA usage 2020-06-14 11:48:43 +02:00
7a8566c391
sam0_common/dma: Mark src parameter as const 2020-06-13 21:02:04 +02:00
benpicco
74299a2b03
Merge pull request #14260 from bergzand/pr/sam0_common/dma_periph
sam0_common: Add DMA peripheral driver
2020-06-12 21:18:31 +02:00
73c8911e62
cpu/samd5x: Add DMA peripheral to init 2020-06-12 20:04:05 +02:00
6be1b27bbb
sam0_common: Add DMA peripheral driver 2020-06-12 20:04:05 +02:00
Benjamin Valentin
54b57bd97f cpu/sam0_common: drop prescaler from timer config
since c05984b341 the prescaler in the timer
config struct is no longer used.

Let's remove it.
2020-06-11 19:29:43 +02:00
Benjamin Valentin
824f7aa82b cpu/sam0_common: move PWM to common code 2020-06-07 16:50:17 +02:00
Leandro Lanzieri
67a43e0ada
drivers/wdt/kconfig: Rename HAS_WDT_WARNING_PERIOD
The symbol now is HAS_PERIPH_WDT_WARNING_PERIOD.
2020-06-02 17:43:19 +02:00
Leandro Lanzieri
079a7ee1e5
cpu/sam0_common: Add family specific Kconfig symbols 2020-06-02 17:42:10 +02:00
Leandro Lanzieri
48759eccdc
drivers/wdt: Add feature to indicate a configurable warning period
This adds the feature `periph_wdt_warning_period` that indicates that a
platform WDT driver implementation supports a configurable
CONFIG_WDT_WARNING_PERIOD.
2020-06-02 12:54:25 +02:00
Leandro Lanzieri
12470f0ed2
cpu/sam0_common: Move periph_timer_periodic feature to Makefile.features 2020-05-29 11:13:59 +02:00
Benjamin Valentin
8486e8c6d1 cpu/sam0_common: implement timer_set_periodic() 2020-05-28 17:37:42 +02:00
Benjamin Valentin
ec7ae668e2 cpu/sam0_common: define TIMER_CHANNELS 2020-05-28 13:24:06 +02:00
Juergen Fitschen
df90176b1f cpu/sam0_common/spi: move clk pin muxing into spi_acquire / spi_release
When the SPI peripheral is disabled, the output lines will become HIGH-Z.
If the clk pin is not pulled HIGH or LOW, connected SPI slaves will start drawing current expectedly.
2020-05-23 13:54:39 +02:00
Benjamin Valentin
5481d8c73a cpu/sam0_common: clean up formatting
Make the code nicer to read.
2020-05-06 14:11:47 +02:00
Benjamin Valentin
e93c9a82f1 cpu/sam0_common: RTC INTFLAG are clear on write
Writing a 1 bit clears the interrupt flag, writing with |= is thus
uneccecary (and actually an error as this would clear *all* flags).

This cleanup was already done for rtt.c, but rtc.c missed out.
2020-05-06 14:05:12 +02:00
Francisco
cea0d1c532
Merge pull request #13421 from benpicco/cpu/sam0_common/i2c-deinit
drivers/periph/i2c: add periph_i2c_reconfigure feature & implementation for sam0
2020-05-05 19:09:47 +02:00
Benjamin Valentin
8c502322f4 cpu/sam0_common: i2c: implement the periph_i2c_reconfigure feature
This adds sam0 implementations for

 - i2c_init_pins()
 - i2c_deinit_pins()
 - i2c_pin_sda()
 - i2c_pin_scl()
2020-05-05 16:12:19 +02:00
benpicco
fbae0a1117
Merge pull request #13901 from benpicco/cpu/sam0_common/timer_flex_freq
cpu/sam0_common: timer: don't ignore frequency in timer_init()
2020-05-04 02:56:01 +02:00
Dylan Laduranty
76870721fe
Merge pull request #13965 from benpicco/cpu/sam0_common/periph/dac
cpu/sam0_common: implement periph/dac
2020-05-02 20:34:40 +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
c05984b341 cpu/sam0_common: timer: don't ignore frequency in timer_init()
Now that we can query the GCLK frequency at run-time, there is no need
to implicitely hard-code the timer frequency in the config struct anymore.
2020-05-01 16:44:06 +02:00
fe299138aa
sam0_common: clarify memcpy in cpuid_get 2020-04-28 14:56:19 +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
Leandro Lanzieri
64552a3b9a
cpu/cortexm_common: Move common modules to Makefile.dep
This moves the following modules to a architecture-specific Makefile.dep
file:
- cortexm_common
- cortexm_common_periph
- newlib
- newlib_nano
- periph
2020-04-01 09:46:21 +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
Benjamin Valentin
9b90fd478a cpu/sam0_common: provide function to switch voltage regulator
Add a fucntion to switch between LDO and Buck concerter to provide the
internal CPU voltage.
The Buck Converter is not compatible with internal fast oscillators (DFLL, DPLL)
and requires an inductivity to be present on the board.
2020-03-31 17:18:20 +02:00
Francisco
1a8b35f54b
Merge pull request #13377 from leandrolanzieri/pr/kconfig_migrate/drivers/periph_wdt
drivers/periph/wdt: Expose configurations to Kconfig
2020-03-31 16:36:36 +02:00
Dylan Laduranty
783ffdc28a
Merge pull request #13607 from benpicco/cpu/sam0_common/generic_RAM_ROM
cpu/sam0_common: derive ROM_LEN & RAM_LEN from part number
2020-03-31 15:55:04 +02:00
Leandro Lanzieri
cf53a86308
cpu/sam0_common: Add CPU-specific WDT peripheral configuration 2020-03-31 13:39:39 +02:00
Leandro Lanzieri
00b71a2708
drivers/wdt: Move WDT_WARNING_PERIOD to 'CONFIG_' namespace 2020-03-31 13:39:37 +02:00
Benjamin Valentin
77961106f9 cpu/sam0_common: derive ROM_LEN, RAM_LEN from part number & vendor file
The ROM size is encoded in the part number of the Atmel SAM chips.
RAM size is not encoded directly, so get it by parsing the chip's vendor file.

The file remains in the page cache for the compiler to use, so the overhead
should be minimal:

on master:

  Benchmark #1: make BOARD=samr21-xpro -j
    Time (mean ± σ):     527.9 ms ±   4.9 ms    [User: 503.1 ms, System: 69.6 ms]
    Range (min … max):   519.7 ms … 537.2 ms    10 runs

with this patch:

  Benchmark #1: make BOARD=samr21-xpro -j
    Time (mean ± σ):     535.6 ms ±   4.0 ms    [User: 507.6 ms, System: 75.1 ms]
    Range (min … max):   530.6 ms … 542.0 ms    10 runs
2020-03-25 15:07:50 +01:00
79431878ac
Merge pull request #13051 from dylad/pr/uart_hw_fc
cpu/uart: create common uart hw fc module
2020-03-10 16:41:36 +01:00
Dylan Laduranty
7a095a80d7 cpu/sam0: use generic hw fc module 2020-03-10 14:22:34 +01:00
benpicco
741b9d3b2d
Merge pull request #13603 from ML-PA-Consulting-GmbH/samd21j17d_add
cpu/sam0_common: add samd21j17d
2020-03-10 12:00:25 +01:00
Benjamin Valentin
eb3f515f55 cpu/sam0_common: gpio: Make use of dedicated GPIO interrupts
saml1x and samd5x have dedicated interrupts per GPIO line.
Use those instead of iterating over the GPIO status bits
to serve IRQs even faster.
2020-03-10 10:33:31 +01:00
Alexandre Moguilevski
648a5b9c58 cpu/sam0_common: add samd21j17d 2020-03-10 10:26:45 +01:00
Benjamin Valentin
5c4c45fd3f cpu/sam0_common: gpio: add gpio_disable_mux() function
Inverse to gpio_init_mux()
2020-03-09 19:23:33 +01:00
Benjamin Valentin
6540609c35 cpu/sam0_common: gpio: save a few cycles in isr_eic()
Don't iterate over all bits in the GPIO status register, instead
just loop as many times as there are set bits.
2020-03-09 18:34:06 +01:00
Juergen Fitschen
0032d35fe8 cpu/sam0_common: mitigate rounding errors of baud rate calculation
Instead of always rounding up, the driver now rounds to the nearest integer. This reduces the absolut rounding error when setting SPI baud rates.
2020-03-03 12:32:42 +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
Benjamin Valentin
a0ac2384ac cpu/sam0_common: samr30: add integer literal macros
All the more recent vendor files have them, so include them for samr30 too.
It is expected for this to become obsolete with the next vendor file update.
2020-02-25 21:52:24 +01:00
Gunar Schorcht
f688f84a15
Merge pull request #12928 from benpicco/newlib-multiheap
sys/newlib: enable multiple heaps in _sbrk_r()
2020-02-25 19:16:42 +01:00
Benjamin Valentin
442ddc1346 cpu/samd21: Switch EIC clock to slow speed on STANDBY mode 2020-02-24 12:02:27 +01:00
Juergen Fitschen
43ff72ad56 cpu/sam0*: Switch EIC clock to slow speed on STANDBY mode 2020-02-24 12:02:25 +01:00
Juergen Fitschen
1265efc785 cpu/sam0*: Wrap cortexm_sleep call 2020-02-24 11:48:13 +01:00
Benjamin Valentin
b77afadb49 cpu/sam0_common/gpio: use explicit GCLK names
For consistency, use named GCLKs.

 - `SAM0_GCLK_32KHZ` will always be 2 for samd21
 - `SAM0_GCLK_MAIN` will always be 0

So no change in functionality, just makes the code easier to understand.
2020-02-21 14:25:43 +01:00
Benjamin Valentin
cfd0ef415e cpu/sam0_common: hook up low power RAM as extra heap
This enables unused low-lower RAM on saml21/samd5x to be used for
heap memory.
2020-02-20 17:11:25 +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
Benjamin Valentin
93d536f761 cpu/sam0_common: samr30 add PIN_(.*)_EIC_EXTINT_NUM to vendor header
samr30 is the only MCU of this family where the vendor files do not
define the PIN_($pin)_EIC_EXTINT_NUM macro yet.

This macro is needed to create a generic EXTI configuration for all
sam0 MCUs.

The defines were generated with

    sed -Ei '/define PIN_(.*)_EIC_EXTINT([0-9]*)/
            {h; x;
             s/define PIN_(.*)A_EIC_EXTINT([0-9]*)(.*)/
               define PIN_\1A_EIC_EXTINT_NUM       _L_\(\2\)
               \/**< \brief EIC signal: PIN_\1 External Interrupt Line *\/
              /g; G}' samr30g18a.h samr30e18a.h
2020-02-18 18:28:10 +01:00
Dylan Laduranty
cc17d3c2ba
Merge pull request #13350 from benpicco/saml21-asf
cpu/sam0_common: update saml21 vendor files to version 1.2.125
2020-02-12 14:27:39 +01:00
Benjamin Valentin
1333a5698c cpu/sam0_common: update saml21 vendor files to version 1.2.125
This release adds EXTINT defines compatible with later versions of
the sam0 series of MCUs.
2020-02-12 11:46: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
Dylan Laduranty
b5bb846d3a
Merge pull request #13312 from benpicco/cpu/sam0-vendor_cleanup
cpu/sam0_common: use vendor provided MCU header dispatch
2020-02-07 20:33:45 +01:00
Benjamin Valentin
b0078b1a98 cpu/sam0_common: update samr21 vendor files to version 1.1.72
This release adds EXTINT defines compatible with later versions of
the sam0 series of MCUs.
2020-02-07 12:14:45 +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
fd793b8917 cpu/samd51: add common header file from ASF
Somehow I forgot to commit this.
2020-02-06 19:49:50 +01:00
benpicco
9b33e1ca92
Merge pull request #13271 from kfessel/patch-shed
core/sched: sched.h: remove not needed bitarithm include to avoid conflict
2020-02-05 14:44:08 +01:00
Karl Fessel
4445faaa3a core/shed: remove not needed bitarithm include add missing
bitarithm.h is not needed for the interface of shed but may cause conflicts
due to different definitions of SETBIT and CLRBIT

common implementations are: (value, offset) xor (value, mask) bitarithm
implements the later

frac.c and nrf52/usbdev.c use bitarithm.h but where missing the include

sam0/rtt.c defined a bit using mask from bitarithm,
changed that to the soulution used in sam0/rtc.c
2020-02-05 12:45:29 +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
Benjamin Valentin
a51d167a43 cpu/sam0: use GCLK ID instead of bitmask
To simplify board definitions and for unification between samd2x and
newer models, don't use the GCLK bitmask in board definitions.
Instead use the GCLK index and generate the bitmask when needed.
2020-02-04 21:06:21 +01:00
Martine Lenders
8d749dc024
Merge pull request #13148 from chrysn-pull-requests/usb-default-vidpid
USB: Use default VID/PID for RIOT-included peripherals
2020-01-30 17:37:52 +01:00
chrysn
e65f3f372b USB VID/PID: Set whitelist define for internals that use usb.h
This list is probably incomplete as it was created experimentally.
2020-01-30 15:04:10 +01:00
925445d0ff
cpu/sam0: factorize dependencies in Makefile.dep 2020-01-28 13:18:39 +01:00
Marian Buschsieweke
47cb59e6e5
cpu/sam0_common/periph: adc_sample() now returns int32_t 2020-01-10 14:13:15 +01:00
dylad
bd06772980 sam0/uart: add support for hardware flow control 2019-12-20 21:19:44 +01:00
dylad
f44d9f88f0 sam0/uart: remove useless read-modify-write op 2019-12-10 20:19:34 +01:00
Dylan Laduranty
6a4259e48a
Merge pull request #12064 from benpicco/sam0-buffered_uart
cpu/sam0_common/periph/uart: implement non-blocking write
2019-11-28 10:07:11 +01:00
83215befd9
sam0: change ADC periph to return -1 on wrong resolution
The common ADC API dictates that a sample call must return -1 on an
incorrect resolution. The sam0 ADC implementation instead threw an
assertion failure.
2019-11-27 21:09:02 +01:00
7d2e10335d
sam0: remove duplicate _done() call 2019-11-27 21:08:28 +01:00
Dylan Laduranty
5287e1c052
Merge pull request #12782 from ML-PA-Consulting-GmbH/fix/20191122__sam0common_spi_release
cpu/sam0_common/periph/spi: power off spi bus on release
2019-11-27 19:13:19 +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
Daniel Lockau
5ea4fcd9c8 cpu/sam0_common/periph/spi: uncrustify 2019-11-27 07:16:22 +01:00
Daniel Lockau
c5ad13cb18 cpu/sam0_common/periph/spi: power off spi bus on release 2019-11-27 07:16:22 +01:00
Francois Berder
4a31f94cfc many typo fixes
Signed-off-by: Francois Berder <18538310+francois-berder@users.noreply.github.com>
2019-11-23 22:39:07 +01:00
Yegor Yefremov
f2127391c4 doxygen/UART: don't include overridden typedefs
Add missing #ifndefs to overridden UART typedefs.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2019-11-15 10:44:52 +01:00
Yegor Yefremov
df7e760588 doxygen/I2C: don't include overridden typedefs
Add missing #ifndefs to overridden I2C typedefs.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2019-11-15 10:35:33 +01:00
Yegor Yefremov
fa3b0ff04b doxygen/SPI: don't include overridden typedefs
Add missing #ifndefs to overridden SPI typedefs.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2019-11-15 10:35:32 +01:00
Kees Bakker
43670aee7b
Merge pull request #12615 from benpicco/samd21-1kHz_gclk
cpu/samd21: use dedicated 1kHz GCLK4 for RTC and WDT
2019-11-13 20:25:55 +01:00
Dylan Laduranty
0e736b8879
Merge pull request #12675 from benpicco/sam0-rtt-fix
cpu/sam0_common: rtt: enable COUNTSYNC in CTRLA
2019-11-13 10:12:07 +01:00
Benjamin Valentin
d21dc25cfe sam0/spi: Don't re-configure SPI device when not needed
Currently, spi_acquire() will always re-configure the SPI bus.
If the configuration did not change, this is entirely uneccecary
and makes SPI operations take longer than needed.

Instead, compare the current configuration with the new configuration
and skip the initialisation if it didn't change since the last call.
2019-11-12 11:31:41 +01:00
Benjamin Valentin
db2fa33660 sam0_common: rtc: use GCLK4 on SAMD21
The RTC expects to be clocked from a 1kHz source.
Previously it would re-configure GCLK2 from 32kHz to 1kHz when used.

Since GCLK2 is also used by EIC, this would break external interrupts
in strange and unexpected ways.

Dedicate a 1kHz clock to it to avoid the damage.
2019-11-12 11:30:02 +01:00
Benjamin Valentin
5fa234e435 sam0_common: wdt: use GCLK4 on SAMD21
GCLK4 will always run at 1kHz on SAMD21, so use it directly.
2019-11-12 11:29:25 +01:00
Benjamin Valentin
89b987494e cpu/sam0_common: rtt: enable COUNTSYNC in CTRLA
From the data sheet:

> The COUNT register requires synchronization when reading.
> Disabling the synchronization will prevent reading valid
> values from the COUNT register.

Without this bit enabled, rtt_get_counter() will always return 0.
2019-11-12 11:28:08 +01:00
1c416185b6
cpu/sam0_common: fix potential undefined result with sercom_id
Scan-build detected that sercom_id could return -1 and the value of this function is affected to uint8_t variables. Since these variables are used for shitfing bit in registers, this could lead to undefined behavior
2019-10-27 12:02:47 +01:00
acdb010669
sam0_common/usb: fix typo in comment 2019-10-23 10:35:47 +02:00
Kees Bakker
04c84ed158 cpu/sam0: refactor ADC_0 into plain ADC
This change is for all boards with a sam0 cpu. This cpu just has one ADC.
It is unnecessary to have defines with ADC_0_ prefix as if multiple ADCs
are possible.

Some defines were not used, such as ADC_0_EN, ADC_0_CHANNELS,
ADC_MAX_CHANNELS, ADC_0_CLK_SOURCE, ADC_0_CHANNELS

Change all ADC_0_ prefixes to ADC_
2019-10-03 20:45:44 +02:00
f85edaf82a
Merge pull request #10941 from keestux/update-samr30-vendor
cpu/samr30: update vendor files using ASF 3.35.1
2019-10-02 13:35:06 +02:00
Dylan Laduranty
aed628f08b
Merge pull request #11486 from benpicco/saml21-lpram
cpu/saml21: Make Low-Power SRAM available to programs
2019-10-01 21:02:42 +02:00
Gunar Schorcht
02d81b717e
Merge pull request #12063 from maribu/i2c_release
drivers/periph/i2c: Updated i2c_release() to return void
2019-10-01 19:50:38 +02:00
Benjamin Valentin
c9b827e5d5 sam0_common: export flag that tells if the CPU woke from deep sleep
It is often useful to know whether the CPU was just powered on afresh
or if it was woken from a deep sleep state, e.g. by RTC or GPIO event.
2019-10-01 18:39:40 +02:00
Gaëtan Harter
4b93f27d83
cpu: use makefiles/utils uppercase
Convert the variables to uppercase using the 'makefiles/utils' function.
2019-09-30 17:25:24 +02:00
Benjamin Valentin
7e5aa7e775 cpu/sam0_common: uart: fix baud rate calculation
In fractional mode, 3 bits are used to store the fractional part.
Therefore we must multiply / divide by 8 instead of 10 in order to
get the correct values.
2019-09-27 10:49:43 +02:00
dylad
e189d085b0 cpu/sam0: add support for SAMR34 MCU 2019-09-26 10:48:03 +02:00
dylad
c9bd7deea0 cpu/sam0: add SAMR34 vendor files 2019-09-26 10:48:03 +02:00
Benjamin Valentin
c9f8ff1cf1 sam0_common: add Watchdog implementation 2019-09-20 19:04:41 +02:00
benpicco
d5c272ed86
Merge pull request #12199 from smlng/fix_timer_returns
periph/timer: Fix return codes of timer API
2019-09-17 23:04:46 +02:00
Dylan Laduranty
88fe7afe2b
Merge pull request #12121 from benpicco/sam0-fix_exti
cpu/sam0_common/gpio: don't hard-code number of ports
2019-09-12 20:17:11 +02:00
Benjamin Valentin
b1724a7d1b periph/rtc: normalize struct tm before usage
A naive implementation may set a RTC alarm in 30s by calling

	struct tm now;
	rtc_get_time(&now);
	now.tm_sec += 30;
	rtc_set_alarm(&now, _cb, NULL);

This works for RTC implementations that use a RTT internally and call
mktime() to convert the struct tm to a unix timestamp, as mktime() will
normalize the struct in the process.

Call rtc_tm_normalize() when the RTC uses separate registers for time / date
components to ensure it is normalized.

This also modifies tests/periph_rtc to exercise this case.
2019-09-12 11:32:31 +02:00
Sebastian Meiling
49acf98841 cpu/sam0: adapt timer to return 0 on success
Adapt periph/timer implementation of sam0 based MCUs
to return 0 on success for all functions.
2019-09-11 13:52:28 +02:00
Juan Carrano
f7279c84bb cpu/sam0_common: rtt: correcly clear flags.
The INTFLAGS register is cleared by writing a 1 to the corresponding interrupt
flag bit. From the samr21's manual:

> Writing a zero to this bit has no effect.
> Writing a one to this bit clears the Compare 0 interrupt flag.

This is a common pattern in flag registers.

This RTT driver is using or-equal to clear the flags, which means it can
possibly clear other interrupts. There's a small chance that one event is
missed if it happens very close to another event.

Credits to @benpicco, @dylad for pointing out missing fixes.
2019-09-11 12:55:10 +02:00
Benjamin Valentin
ba8dfc8341 cpu/sam0_common/gpio: don't hard-code number of ports
_exti() always assumes only 2 ports, so it will always fail when using
e.g. port C or port D on same54.

Instead, determine the number of ports from the dimensions of the exti_config
array.
2019-08-29 15:27:42 +02:00
Gaëtan Harter
1be5b7b10b
cpu: do not locally export compilation variables
These are already exported by `makefiles/vars.inc.mk`.
It is a prerequisite to allow handling compilation without global exports.
2019-08-29 10:35:53 +02:00
Marian Buschsieweke
dd56b3bb71
cpu/sam0_common: Updated i2c_release() 2019-08-22 12:03:08 +02:00
Benjamin Valentin
a9b0db3ba4 cpu/sam0_common: add hwrng driver 2019-08-03 14:50:58 +02:00
Kees Bakker
14a836d7a1 cpu/samr30: update vendor files using ASF 3.35.1 2019-07-26 22:03:12 +02:00
Benjamin Valentin
56891fe7f2 cpu/sam0: update doc.txt with new MCU families 2019-07-17 11:37:46 +02:00
Kevin "Bear Puncher" Weiss
a290f2d66c
Merge pull request #11712 from bergzand/pr/sam0_common/uart_modecfg
sam0_common: add uart modecfg support
2019-06-21 13:08:07 +02:00
3241aff71c
sam0_common: add uart modecfg 2019-06-21 10:54:24 +02:00
Benjamin Valentin
7928c74e26 sam0_common: rtc/rtt: don't setup oscilators
leave that to cpu.c
2019-06-18 13:20:04 +02:00
Benjamin Valentin
f375b00ff3 cpu/samd5x: add support for samd5x/same5x MCUs
This adds supoprt for the Atmel SAMD51 & SAME54 SoC.
The SAME5x/SAMD5x is a line of Cortex-M4F MCUs that share peripherals
with the samd2x Cortex-M0+ and saml1x Cortex-M23 parts.
2019-06-06 16:47:11 +02:00
Benjamin Valentin
3cd119a6e6 cpu/sam0_common: import vendor files for samd51
Atmel Software Framework (ASF) provides a set of low-level header files
that give access to different hardware peripherals of Atmel's ICs.

Origin: Atmel SAMD51 Series Device Support (1.1.96)
License: Apache-2.0
URL: http://packs.download.atmel.com/Atmel.SAMD51_DFP.1.1.96.atpack
2019-06-06 16:47:11 +02:00
Benjamin Valentin
cb9624909f cpu/sam0_common: import vendor files for same54
Atmel Software Framework (ASF) provides a set of low-level header
files that give access to different hardware peripherals of Atmel's
ICs.

Origin: Atmel SAME54 Series Device Support (1.0.87)
License: Apache-2.0
URL: http://packs.download.atmel.com/Atmel.SAME54_DFP.1.0.87.atpack
2019-06-06 16:47:11 +02:00
Benjamin Valentin
f36d54f239 sam0/timer: various fixes
This cleans up the sam0 timer driver:

 - remove the check for the unused freq parameter
 - the MCU provides dedicated SET/CLR registers to avoid
   read-modify-write, so don't do read-modify-write on them.
 - workaround a possible hardware bug on SAMD5x:
   loop until the CMD_READSYNC is really set
2019-06-06 15:38:55 +02:00
smlng
2de4b3011b periph_common: add as dependency to periph drivers
Rational: the periph_common module is required by (most) other periph drivers
and also during startup of the CPU/MCU to run periph_init. The latter is only
required if other periph drivers are used, hence periph_common should be a
depency of periph_* modules and *not* of the CPU/MCU. This PR fixes that
by making periph_common a depency of periph_* and removing the explicit
include in the CPU/MCU implementation.
2019-06-03 13:44:10 +02:00
Benjamin Valentin
7415e0590e sam0_common: spi: use sercom_set_gen() instead of re-implementing it
Don't repeat yourself and introduce errors in doing so.
2019-05-25 19:13:53 +02:00
Benjamin Valentin
84233ce5d5 sam0_common: replace sercom_id() calculation with switch statement
As the sercom_id() function grows it gets more unweidly.
Let's replace it with a simple switch statement that is true for all
sam0 parts.
2019-05-25 19:12:55 +02:00
Benjamin Valentin
31f88a2d0e sam0_common: periph/spi: use sercom_clk_en/dis()
Use already existing functions to turn on / off SERCOM clocks instead
of replicating the functionality in the driver.
2019-05-25 19:09:32 +02:00
Dylan Laduranty
f6ba7ee106 sam0: correct number of PM for SAML10 2019-05-22 17:04:27 +02:00
Benjamin Valentin
849dd4cdce sam0_common: make Timer implementation common across all sam0 MCUs
The currently supported SAM0 MCUs (samd21, saml21, saml1x) share the same
Timer peripheral, yet each of them carries it's own copy of the Timer
driver.

This introduces a new timer driver that is common for all sam0 MCUs and
uses structs for configuration instead of defines.
2019-05-21 11:47:59 +02:00
Benjamin Valentin
077056b949 sam0_common: make RTT implementation common across all sam0 MCUs
The currently supported SAM0 MCUs (samd21, saml21, saml1x) share the
same RTC peripheral, yet each of them carries it's own copy of the RTT
driver.

Unify the drivers and move them to sam0_common.
2019-05-09 20:54:00 +02:00
Benjamin Valentin
9aa8c619c1 sam0_common: make RTC implementation common across all sam0 MCUs
The currently supported SAM0 MCUs (samd21, saml21, saml1x) share the
same RTC peripheral, yet each of them carries it's own copy of the RTC
driver.

Unify the drivers and move them to sam0_common.
2019-04-15 22:25:47 +02:00
Hyungsin
d9c17c2154 boards: add initial hamilton board support 2019-04-03 15:00:35 -07:00
Kevin "Bear Puncher" Weiss
15c2a48fdf
Merge pull request #10839 from dylad/pr/sam0/remove_gclk_slow
cpu/sam0_common: remove unneeded GCLK_SLOW setup in i2c driver
2019-03-28 14:31:16 +01:00
Dylan Laduranty
ccf12c57a8
Merge pull request #10884 from fedepell/sam_rwee_support
sam0 flashpage RWWEE flash support
2019-03-28 11:00:25 +01:00
1286b18ca9
sam0_common: Fix syntax mistake in usbdev driver 2019-03-26 16:09:03 +01:00
d7804823db
sam0_common: Add USB peripheral driver 2019-03-26 10:26:11 +01:00
Federico Pellegrin
5faafac092 sam0 flashpage RWWEE flash support 2019-03-21 04:27:41 +01:00
Martine Lenders
7220b66708
Merge pull request #10936 from miri64/sam0_common/fix/check-adc-numof
sam0_common: check ADC_NUMOF on adc_init()
2019-02-04 16:41:41 +01:00
Kees Bakker
458c95a854
Merge pull request #10914 from keestux/describe-saml1x-source
cpu/sam0_common: update README for SAML1x addition
2019-02-04 16:29:15 +01:00
Martine Lenders
39e90502af sam0_common: check ADC_NUMOF on adc_init() 2019-02-04 09:28:13 +01:00
Kees Bakker
e4325ed802 cpu/sam0_common: update README for SAML1x addition
Rewrite the README to reflect the recent addition of SAMR30 and
SAML10/SAML11.
2019-02-01 23:33:31 +01:00
Federico Pellegrin
318f0cf679 sam0 flashpage: make ready check inline, add wait also after PBC 2019-01-30 04:29:23 +01:00
Federico Pellegrin
409d83e087 sam0 flashpage: minor code style fixes 2019-01-29 20:58:46 +01:00
Federico Pellegrin
051be66b76 sam0 flashpage: wait for READY bit in INTFLAG after write command 2019-01-27 07:39:10 +01:00
Dylan Laduranty
5dd51f2ec5 cpu/sam0_common: remove unneeded GCLK_SLOW setup in i2c driver 2019-01-22 09:29:42 +01:00
Dylan Laduranty
9450fa7dc3 cpu/sam0_common: add support for saml10/saml11
Add SAML10/SAML11 support through SAM0 because hardware IP are the same so reuse to avoid duplication
2019-01-21 17:06:58 +01:00
Federico Pellegrin
b8b8ffd163 sam0 flashpage_write: correct assert for last byte of flash + style 2018-12-21 13:11:38 +01:00
Federico Pellegrin
a0054654ee sam0 flashpage_write: fix writes translation from RIOT to CPU pages 2018-12-19 04:54:44 +01:00
c87f02149e cpu/sam0_common: provide gpio/gpio_irq feature at cpu level 2018-12-17 20:52:48 +01:00
Martine Lenders
95819c660b sam0_common: mark closing #endif for MODULE_PERIPH_GPIO_IRQ 2018-10-09 15:11:00 +02:00
13654a950b cpu/samr30: add support for samr30g18a
Co-authored-by: biboc <bapclenet@gmail.com>
2018-10-01 10:15:08 +02:00
Hauke Petersen
6afd0efdd8 cpu/sam0_common/gpio: use gpio_irq feature 2018-09-21 08:19:31 +02:00
dylad
4e6d3d1f92 sam0/spi: fix SPI mode assignment
Signed-off-by: dylad <dylan.laduranty@mesotic.com>
2018-09-04 13:58:51 +02:00
Dylan Laduranty
8871e5aaa6
Merge pull request #9876 from fedepell/sercomid-9875
sam0_common: fix sercom_id return value for SERCOM5 (#9875)
2018-09-04 09:10:06 +02:00
Federico Pellegrin
d3cd2b71c0 sam0_common: fix sercom_id return value for SERCOM5 (#9875) 2018-09-03 18:57:18 +02:00
Federico Pellegrin
bfdafe877e sam0_common: correct sercom_set_gen for sercom5. it assumes SERCOM5 GEN clock is in sequence, but is not, need to put a specific if test 2018-09-02 13:39:08 +02:00
smlng
e39ebb1623 cpu/sam0: add doxygen group around i2c_speed_t 2018-07-25 12:01:40 +02:00
smlng
90f66a1952 cpu/sam0_common/i2c: fix ambiguous reg assignment
The value assigned to the register was unclear due to usage
    of bit-comparison and ternary operator, added parentheses to
    make it explicit.
2018-07-25 12:01:40 +02:00
dylad
e6bd6bfe3b sam0/i2c: update driver to new API 2018-07-25 12:01:34 +02:00
Joakim Nohlgård
28361592ae sam0_common: Adjust ldscript memory segment attributes 2018-05-09 06:49:02 +02:00
Vincent Dupont
a1f482cbf7 cpu/sam0: use const pointer in flashpage 2018-03-14 16:28:33 +01:00
c1e20f8231
Merge pull request #7709 from smlng/cpu/sam0_common/enh_uart
cpu, sam0 common: adapt periph-uart to use read-only bit-fields
2017-12-15 12:45:10 +01:00
smlng
150f3fb231 cpu/sam0_common: fix assert in periph/flashpage 2017-12-10 16:21:52 +01:00
43e972fc61
Merge pull request #7970 from kYc0o/add_flashpage_write_raw
periph/flashpage: add flashpage_write_raw interface
2017-12-04 13:13:52 +01:00
kYc0o
cb0d021811 cpu/sam0_common/Makefile.features: add periph_flash_raw 2017-11-30 17:25:35 +01:00
kYc0o
adc08d6578 cpu/sam0_common: add alignment and minimum size write block constants 2017-11-30 17:25:35 +01:00
fcb3fd9e70 cpu/sam0_common: add flashpage_write_raw() 2017-11-30 15:14:39 +01:00