Commit Graph

10611 Commits

Author SHA1 Message Date
Scott Shawcroft 383bf9a59e Wait for the DFLL to be stable. 2018-06-08 12:56:32 -07:00
Scott Shawcroft 07a8899c72 Support M4 2018-06-08 12:56:32 -07:00
Scott Shawcroft 2fbab8067a Prevent freezing USB during high frequency PulseIn.
We now track the last time the background task ran and bail on the
PulseIn if it starves the background work. In practice, this
happens after the numbers from pulsein are no longer accurate.

This also adjusts interrupt priorities so most are the lowest level
except for the tick and USB interrupts.

Fixes #516 and #876
2018-06-08 12:56:32 -07:00
Dan Halbert c01ce175bb
Merge pull request #914 from SConaway/patch-1
Update README.rst
2018-06-07 20:44:19 -04:00
Dan Halbert 0ecfd2923f
Merge pull request #913 from kattni/itsybitsy-name-fix
Itsybitsy name fixes
2018-06-07 18:12:51 -04:00
Steven Conaway f36fa308e7
Update README.rst 2018-06-07 12:15:15 -07:00
Kattni Rembor ba7e0e2f86 Add Adafruit to other M4 board name strings 2018-06-07 13:39:04 -04:00
Kattni Rembor 7b2875d54a Add Adafruit to board name string 2018-06-07 13:33:13 -04:00
Kattni Rembor 0ab2a60dcd Update ItsyBitsy board name to one word 2018-06-07 13:12:44 -04:00
Dan Halbert 44721cba3d
Merge pull request #910 from kattni/rotaryio-doc-fix
Fixed documentation formatting for RTD
2018-06-06 20:06:33 -04:00
Kattni Rembor 3a38172627 Fixed documentation formatting for RTD 2018-06-06 18:28:01 -04:00
Kattni ca24cad60a
Merge pull request #902 from dhalbert/feather_m0x_crickit
Feather M0 Express build with frozen Crickit libraries
2018-06-06 14:41:13 -04:00
Dan Halbert 1079f94fc5
Merge pull request #905 from jepler/main-stack-usage
main: move code pertaining to boot.py out of line
2018-06-06 09:24:51 -04:00
Jeff Epler 654591e11f main: move code pertaining to boot.py out of line
.. this reduces stack usage in main() substantially, because
the 512 byte stack allocation will only exist during the new run_boot_py
function's duration.

Closes: #904
2018-06-06 08:01:17 -05:00
Scott Shawcroft aa636841a2
Merge pull request #903 from jepler/stack-overflow-crash
main: Explicitly set the stack top based on _estack
2018-06-05 22:05:13 -07:00
Jeff Epler a4e06bd998 main: Explicitly set the stack top based on _estack
.. setting it based on the ad-hoc stack pointer calculation of
mp_stack_ctrl_init() meant that the stack used above main() counts
against the 1KiB safety factor that the mp_stack_set_limit call tries
to establish.  It turns out, at least on M4, that over half of the
safety factor is used up by stack-above-main()!

In the case of the basics/gen_stack_overflow.py test,
which blows the stack on purpose, it turns out that gc would be called
while handling the "maximum recursion depth exceeded" error, and this
needed more stack than was left.

Closes: #900
2018-06-05 22:04:55 -05:00
Dan Halbert 36a7ebe88e add feather_m0_express_crickit to .travis.yml 2018-06-05 18:24:55 -04:00
Dan Halbert 9ba6990228 Feather M0 Express build with Crickit libraries 2018-06-05 18:21:47 -04:00
Dan Halbert 74ced174ce
Merge pull request #898 from dhalbert/feather_m4_d4
add PA14 as D4 to Feather M4 Express
2018-06-05 11:41:31 -04:00
Dan Halbert 7e7e33e460 add PA14 as D4 to Feather M4 Exprses 2018-06-05 08:15:34 -04:00
Scott Shawcroft 52cc3ed76a
Merge pull request #893 from notro/cpboard
tools: Add cpboard.py
2018-06-04 17:31:44 -07:00
Scott Shawcroft 0c7c0821fc
Merge pull request #891 from godlygeek/low_flash_errno_fixes
Human readable OSError messages for low flash devices
2018-06-04 17:22:57 -07:00
Dan Halbert 9a6a5ea2d9
Merge pull request #892 from tannewt/clock_w_crystal
Use the external crystal on SAMD21 again.
2018-06-02 18:43:23 -04:00
Kattni 47b60fd3fa
Merge pull request #896 from dhalbert/update_frozen_lis3dh
Update HID code and seesaw version
2018-06-02 18:09:52 -04:00
Dan Halbert 0ed946c5b8 Merge remote-tracking branch 'adafruit/master' into update_frozen_lis3dh 2018-06-02 17:44:56 -04:00
Dan Halbert 27eba65dc7 update HID, and update seesaw version 2018-06-02 17:43:08 -04:00
Kattni 41865887f7
Merge pull request #895 from dhalbert/update_frozen_lis3dh
Update frozen LIS3DH to 4.2.1 to save space
2018-06-02 17:37:41 -04:00
Dan Halbert 6e6bfc4d57 Update frozen LIS3DH to 4.2.1 to save space 2018-06-02 17:00:23 -04:00
Noralf Trønnes d08cc2ab17 tests: Point pyboard.py to tools/cpboard.py
This makes it possible to run-tests on the board itself.
2018-06-02 19:09:54 +02:00
Noralf Trønnes e37d5622fe tools: Add cpboard.py
This is a variant of pyboard.py aimed at Circuit Python boards.
It can emulate pyboard.py enough so it works with tests/run-tests.
2018-06-02 19:09:44 +02:00
Matt Wozniski d0e6bb269f Use the system errno's on nrf 2018-06-02 12:55:07 -04:00
Scott Shawcroft e580d22f4a Use the external crystal on SAMD21 again.
Also, re-enable calibration storage for CircuitPlayground Express.
Tested with a 500hz PWMOut on Metro M0 with Saleae:
 * with crystal 500hz
 * with usb 500hz +- 0.1hz
 * without either 487hz += 0.1hz

SAMD51 is skipped due to DFLL errata and the fact it defaults to a
factory calibrated 48mhz that works fine for USB.

Fixes #648
2018-06-01 18:01:42 -07:00
Matt Wozniski 22f4438787 Prune atmel-samd errno list
Remove errnos that are only raised by modules that aren't linked into
the atmel-samd port.
2018-06-01 19:04:14 -04:00
Matt Wozniski e798b67ca2 Begin a custom list of errnos for atmel-samd
The uerrno module was written to allow boards to customize the list of
errnos they can raise.  Start by copying the default list.
2018-06-01 19:04:04 -04:00
Matt Wozniski 1c35dbfb5d Provide mp_errno_to_str even without uerrno
We can provide a basic version of mp_errno_to_str even if the uerrno
module won't be provided.  Rather than looking errno names up in the
uerrno module's globals dict, we'll just rely on a simple mapping in the
function itself.
2018-06-01 19:03:51 -04:00
Dan Halbert de61bd0d05
Merge pull request #887 from tannewt/rotaryio
Add rotary encoder support.
2018-06-01 18:50:00 -04:00
Scott Shawcroft 717199018b Adapt for feedback and hack around pIRkey size constraint. 2018-06-01 15:08:52 -07:00
Dan Halbert f386144428 redo state algorithm 2018-06-01 15:08:52 -07:00
Scott Shawcroft 9920f0a5de atmel-samd: Make ticks more atomic.
Always use current_tick when sub millisecond precision is required.
Otherwise getting the ms/us to correspond is tricky.
2018-06-01 15:08:52 -07:00
Scott Shawcroft d0fb6e7a2f atmel-samd: Add rotary encoder support.
Fixes #283
2018-06-01 15:08:48 -07:00
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 317bb6d2ce
Merge pull request #888 from notro/samd51_clock_rework
atmel-samd/samd51: Refactor clock setup + implement samd.clock
2018-06-01 14:10:24 -07: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
Scott Shawcroft 6479cb0806
Merge pull request #868 from pewpew-game/gamepad-longlive
Make the gamepad singleton long-living and add it to root pointers
2018-05-30 17:19:12 -07:00