Commit Graph

274 Commits

Author SHA1 Message Date
Scott Shawcroft fd71e56891 atmel-samd: Re-org helper peripheral files into their own subdirectory.
Ideally in the future they won't depend on ASF4 or MicroPython.
2018-06-01 15:07:31 -07:00
Dan Halbert ae31c4ac18
Merge pull request #889 from tannewt/audioio_timers_in_use
Turn off timer on AudioOut deinit.
2018-06-01 18:03:29 -04:00
Dan Halbert ea95eb730a
Merge pull request #890 from tannewt/brownout3
Support brownout to safe mode. Fixes #870
2018-06-01 18:02:13 -04:00
Scott Shawcroft f38ce1060c Support brownout to safe mode. Fixes #870 2018-06-01 13:45:28 -07:00
Scott Shawcroft bf1f0b3d11 Turn off timer on AudioOut deinit.
Thanks to @sommersoft for spotting the error.

Fixes #850
2018-06-01 13:32:45 -07:00
Noralf Trønnes e158702a68 atmel-samd/samd51: Use crystal for RTC
This uses the crystal to clock the RTC on boards which have a crystal.

Disable clock generator 2 which was enabled in commit
8e2080411f ("atmel-samd: Add rtc module support").
samd51 differs from samd21 when it comes to the RTC clock. samd51 doesn't
have an explicit clock peripheral so no need for a clock generator.

The same commit didn't even setup XOSC32K correctly, it missed EN1K and XTALEN.

The RTC uses the 1k clock output, so enable it on the OSCULP32K even if it works without it.
2018-06-01 18:03:23 +02:00
Noralf Trønnes ab7ddfddd5 atmel-samd/samd51: Refactor clock setup
Refactor the convoluted asf4 clock setup into something more readable.

enable_clock_generator() has 2 changes:
- Set 'Output enabled' to match the current clock setup
- Handle divisors above 511

Add an enable_clock_generator_sync() version which makes it possible to setup
clocks without waiting for syncing. The bootup would hang without this.

I have checked these registers:

 NVMCTRL->CTRLA = 0x00000004

 Peripheral clocks (only non-zero shown):
 PCHCTRL[1]=0x00000045
 PCHCTRL[10]=0x00000041

 Generator clocks (only non-zero shown):
 GENCTRL[0] = 0x00010907
 GENCTRL[1] = 0x00010906
-GENCTRL[2] = 0x00041104
+GENCTRL[2] = 0x00200904
 GENCTRL[4] = 0x00010907
 GENCTRL[5] = 0x00180906

 DFLL clock:
 OSCCTRL->DFLLCTRLA = 0x00000082
 OSCCTRL->DFLLCTRLB = 0x00000000
 OSCCTRL->DFLLVAL = 0x00008082
 OSCCTRL->DFLLMUL = 0x00000000

 DPLL clocks:
 OSCCTRL->Dpll[0].DPLLCTRLA=0x00000002
 OSCCTRL->Dpll[0].DPLLCTRLB=0x00000000
 OSCCTRL->Dpll[0].DPLLRATIO=0x0000003b
 OSCCTRL->Dpll[1].DPLLCTRLA=0x00000080
 OSCCTRL->Dpll[1].DPLLCTRLB=0x00000020
 OSCCTRL->Dpll[1].DPLLRATIO=0x00000000

 OSC32KCTRL clock:
 OSC32KCTRL->RTCCTRL = 0x00000000
 OSC32KCTRL->XOSC32K = 0x00002082
 OSC32KCTRL->CFDCTRL = 0x00000000
 OSC32KCTRL->EVCTRL = 0x00000000
 OSC32KCTRL->OSCULP32K = 0x00002300

Only gen2 changed which is due to samd51 having more bits in the simple
division register so DIVSEL wasn't necessary, and it didn't have OE set.
2018-06-01 18:02:35 +02:00
Noralf Trønnes 5c6aea9fd8 atmel-samd/samd51: Implement samd.clock
Fill out the dummy implementation.
2018-06-01 18:01:08 +02:00
Radomir Dopieralski b219ce6d37 Add gamepad_singleton to root pointers 2018-05-30 23:11:22 +02:00
Dan Halbert eab8e43188 rev E feather M4 express; remove named AREF pins 2018-05-29 20:25:28 -04:00
Dan Halbert 754c36bb37
Merge pull request #867 from dhalbert/fix_pirkey_apa102
3.0 pirkey build including appropriate frozen modules
2018-05-24 22:07:14 -04:00
Dan Halbert ee896cdd41 restore I2C and UART. Don't do port.c resets and inits for modules that are not available. 2018-05-24 20:20:18 -04:00
Scott Shawcroft 42bf3a1306 Remove asf3 nvm code. 2018-05-24 13:14:40 -07:00
Dan Halbert b9f36184f5 refine pirkey build 2018-05-24 13:28:03 -04:00
Dan Halbert 083f91363a pirkey APA102 defs were commented out in mpconfigboard.h 2018-05-23 18:21:07 -04:00
Scott Shawcroft aa86a1457f Use merged in FreeTouch 2018-05-23 11:57:35 -07:00
Dan Halbert 6af5fc2796
Merge pull request #861 from tannewt/touchio3
Turn on touchio for M0 boards.
2018-05-23 14:20:15 -04:00
Scott Shawcroft 641caaa6dd Gain space back in non-Express builds by using -finline-limit 2018-05-23 10:36:59 -07:00
Scott Shawcroft 3607d3ba2c Correctly reset the PTC 2018-05-22 14:20:35 -07:00
Scott Shawcroft 31bcd1c45c Fixup gclk init 2018-05-22 13:56:12 -07:00
Scott Shawcroft 99123a8621 Turn on touchio for M0 boards. M4 will come later once its supported
by FreeTouch.

Fixes #670
2018-05-22 13:49:08 -07:00
Dan Halbert 22405d6bdb
Merge pull request #860 from dhalbert/3.0-cpx-crickit
turn off longint on cpx crickit; update frozen libs
2018-05-22 16:28:42 -04:00
Scott Shawcroft 165b28438a
Merge pull request #854 from python-ugame/extra-override
Allow overriding EXTRA_BUILTIN_MODULES in mpconfigboard.h
2018-05-22 10:22:35 -07:00
Dan Halbert 0d7db29630 turn off longint on cpx crickit; update frozen libs 2018-05-22 13:03:13 -04:00
Dan Halbert 49a81d5c4b LONGLONG typo 2018-05-22 09:35:29 -04:00
Dan Halbert 45db48bbaa make longint choice mechanism more readable 2018-05-22 08:04:14 -04:00
Dan Halbert 5680933483 refactor longint settings; make crickit cpx build 2018-05-21 23:58:03 -04:00
Radomir Dopieralski 6a6ab2b0ec Allow overriding EXTRA_BUILTIN_MODULES in mpconfigboard.h
Some boards (like the uGame10) may want to have their own set of extra
modules. This change lets them override EXTRA_BUILTIN_MODULES in their
mpconfigboard.h and makes the ugame10 board do that.
2018-05-21 09:23:58 +02:00
Noralf Trønnes cf33ad9a54 atmel-samd/samd21: Enable long int on Express boards
This is necessary for using 1970 epoch in the time module.
2018-05-18 12:35:26 +02:00
Matt Land 06b293af29 pirkey, trinket, ugame 2018-05-17 13:56:10 -04:00
Matt Land a84845c0ae itsbitsy, metro 2018-05-17 13:48:33 -04:00
Matt Land 173a0a5faa arduino, circuitplayground, feather boards 2018-05-17 13:42:08 -04:00
Matt Land fc2b4526d3 worked 2018-05-17 13:33:26 -04:00
Matt Land e1cccd3dac rename to UART 2018-05-17 13:21:15 -04:00
Matt Land 2210fc60b1 Merge branch 'master' of https://github.com/adafruit/circuitpython into feature-default-serial 2018-05-17 13:08:43 -04:00
Matt Land c846f4bdae remove newline 2018-05-17 12:17:06 -04:00
Matt Land 4fd4adf974 not working 2018-05-17 12:14:51 -04:00
Matt Land 30c625ff46 Merge branch 'feature-i2c-gemma' into feature-default-spi-circuit-playground 2018-05-16 17:58:03 -04:00
Matt Land 0511becd55 Merge branch 'master' of https://github.com/adafruit/circuitpython into feature-i2c-gemma 2018-05-16 17:55:43 -04:00
Scott Shawcroft 6a8db03ade
Merge pull request #838 from rhooper/master
add supervisor.reload() to soft reboot from code
2018-05-16 17:52:16 -04:00
Matt Land b9b742cc69 add spi def to all boards pins file 2018-05-16 17:43:14 -04:00
Matt Land c2fa892a02 fix formatting 2018-05-16 17:38:44 -04:00
Matt Land cc52f8efd9 Merge branch 'feature-i2c-gemma' into feature-default-spi-circuit-playground 2018-05-16 17:32:50 -04:00
Matt Land 0a185c4d2d Merge branch 'master' of https://github.com/adafruit/circuitpython into feature-i2c-gemma 2018-05-16 17:07:58 -04:00
Matt Land e8e75c056a For the two boards without SCL and SDA can you still add the board global entry for I2C? That way they'll raise the NotImplementedError with the better message instead of a NameError. 2018-05-16 17:02:41 -04:00
Matt Land de885e81b1 Merge branch 'feature-i2c-gemma' into feature-default-spi-circuit-playground 2018-05-16 16:07:55 -04:00
Matt Land 8a351595ef formatting, trailing newlines 2018-05-16 15:57:25 -04:00
Matt Land 2c067edf54 used pins.c instead of README.rst 2018-05-16 15:54:01 -04:00
Matt Land 3144654854 SPI for all boards 2018-05-16 15:36:36 -04:00
Matt Land 244866c2c3 spi on much 2018-05-16 15:25:24 -04:00