Commit Graph

47 Commits

Author SHA1 Message Date
Scott Shawcroft 6839fff313 Move to ASF4 and introduce SAMD51 support. (#258)
* atmel-samd: Remove ASF3. This will break builds.

* atmel-samd: Add ASF4 for the SAMD21 and SAMD51.

* Introduce the supervisor concept to facilitate porting.

The supervisor is the code which runs individual MicroPython VMs. By
splitting it out we make it more consistent and easier to find.

This also adds very basic SAMD21 and SAMD51 support using the
supervisor. Only the REPL currently works.

This begins the work for #178.
2017-09-22 21:05:51 -04:00
Dan Halbert c679c80c71 Modernize module and class static dicts; update freetouch 2017-08-27 15:02:50 -04:00
Scott Shawcroft 266be30777 atmel-samd: Introduce a nvm module for non-volatile byte-level memory access. (#203)
* atmel-samd: Introduce a nvm module for non-volatile byte-level memory access.

This allows for persisting small configuration values even when the file system
is read-only from CircuitPython.

Fixes #160

* Review feedback:
* Add tests.
* Fix non-zero index.
* Fix len()
2017-08-25 16:00:27 -04:00
Scott Shawcroft 3660023046 atmel-samd: Update README and add pinout tables that map MCU names
to names in the board module and explain pin capabilities.

Fixes #149
2017-07-13 16:05:24 -07:00
Scott Shawcroft 1e04e8ea1c atmel-samd: Reboot to bootloader when a 1200 baud serial connection is
closed. This is how Arduino triggers the bootloader.
2017-07-12 11:58:22 -07:00
Scott Shawcroft a715bf6bac atmel-samd: Introduce board reset mechanic used on CircuitPlayground
Express to ensure the Neopixels are off after reloads.
2017-06-16 15:40:15 -07:00
Scott Shawcroft 3e23464b1e atmel-samd: Add user initiated safe mode and rework board.c for
board specific functionality.

Fixes #155
2017-06-16 14:55:53 -07:00
Scott Shawcroft 7672bf7736 atmel-samd: Rename auto-reset to auto-reload to reduce confusion with physical reset buttons. 2017-05-12 16:45:38 -07:00
Scott Shawcroft 8d0d5defc7 atmel-samd: Use LTO for all builds to get 5000 bytes back on express boards. 2017-04-18 09:44:04 -07:00
Scott Shawcroft d598c2a919 atmel-samd: Add USB HID mouse and keyboard support. 2017-02-27 15:43:58 +01:00
Scott Shawcroft 062fac1d43 atmel-samd: Use link time optimization to reduce code size of builds which
share space with the file system.

"Express" builds with SPI flash crash the compiler for some reason so its
currently disabled for them.
2017-02-26 01:00:33 +01:00
Scott Shawcroft 8584f5fece atmel-samd: Remove support for UART REPL from Arduino Zero. 2017-02-19 17:23:31 +01:00
Scott Shawcroft ae715a827b atmel-samd: Rework the clock configs to only be crystalless when needed by the hardware. 2017-02-10 05:09:17 -08:00
Scott Shawcroft f6cf8ae208 atmel-samd: Split UART pin names into two so that all names start
with a letter and are therefore valid Python.

Fixes #73.
2017-01-12 13:53:47 -08:00
Scott Shawcroft 0ae344841f atmel-samd & esp8266: Make sure pins are not already in use.
This prevents corrupting previous functional objects by stealing their pins
out from under them. It prevents this by ensuring that pins are in default
state before claiming them. It also verifies pins are released correctly and
reset on soft reset.

Fixes #4, instantiating a second class will fail.
Fixes #29, pins are now reset too.
2016-12-07 15:21:14 -08:00
Scott Shawcroft f4a1da4be9 atmel-samd: Only include bitbangio on boards with flash. 2016-12-01 13:46:44 -08:00
Scott Shawcroft ddfa7595b0 Slim down Arduino Zero build by turning off mass storage LEDs. 2016-11-29 14:32:04 -08:00
Scott Shawcroft 2d9a0c76c5 atmel-samd: Switch to MICROPY_PORT_ROOT_POINTERS for the flash cache. 2016-11-29 14:29:33 -08:00
Scott Shawcroft cc412a80ad atmel-samd: Support Trinket and Gemma M0 prototypes. 2016-11-22 12:03:42 -08:00
Scott Shawcroft ccbb5e84f9 This introduces an alternative hardware API called nativeio structured around different functions that are typically accelerated by native hardware. Its not meant to reflect the structure of the hardware.
Docs are here: http://tannewt-micropython.readthedocs.io/en/microcontroller/

It differs from upstream's machine in the following ways:

* Python API is identical across ports due to code structure. (Lives in shared-bindings)
* Focuses on abstracting common functionality (AnalogIn) and not representing structure (ADC).
* Documentation lives with code making it easy to ensure they match.
* Pin is split into references (board.D13 and microcontroller.pin.PA17) and functionality (DigitalInOut).
* All nativeio classes claim underlying hardware resources when inited on construction, support Context Managers (aka with statements) and have deinit methods which release the claimed hardware.
* All constructors take pin references rather than peripheral ids. Its up to the implementation to find hardware or throw and exception.
2016-11-21 14:11:52 -08:00
Scott Shawcroft f42b41e1e9 atmel-samd: Increase autoreset delay to reduce duplicate resets. 2016-10-31 11:31:33 -07:00
Scott Shawcroft 5b3a143ffe atmel-samd: Rework tick timer to use TC5 and support neopixel status LED.
The tick timer needed to be reworked because the ASF delay functions also
use the SysTick timer. Now, it uses TC5 and calls out to the autoreset
logic every tick. Fixes #43.

Added neopixel status colors and corrected the latch time from ms to us.
Fixes #42.
2016-10-28 20:16:39 -07:00
Scott Shawcroft fc78f6950f atmel-samd: Add D13 as flash write indicator on Arduino Zero. 2016-10-27 17:49:52 -07:00
Scott Shawcroft 3a9cb1ac49 atmel-samd: Fix Arduino SPI pin. Datasheet net name is wrong. :-( 2016-10-26 20:16:53 -07:00
Scott Shawcroft 85e4d3572d atmel-samd: Add named pins for Arduino Zero SPI. Fixes #11. 2016-10-26 18:02:34 -07:00
Scott Shawcroft 2098515f6a atmel-samd: Rework pin definitions to share most of the data structures and included based on ASF defines. 2016-10-26 17:57:47 -07:00
Scott Shawcroft d189a3f3cf atmel-samd: Support auto-reset based on USB write activity.
It will soft-reboot micropython after a burst of writes to the
file system. This means that after you save files on your computer
they will be automatically rerun.

This can be disabled in the build by unsetting AUTORESET_TIMER in
mpconfigboard.h.

Using the REPL will also prevent the soft resets until you reset
with CTRL-D manually.
2016-10-25 18:36:37 -07:00
Scott Shawcroft 614c1fdba2 atmel-samd: Only output to USB after DTR and don't send anything larger than the room left in the USB TX buffer. 2016-10-25 18:29:04 -07:00
Scott Shawcroft fff96a0ce6 atmel-samd: Fix include guard. 2016-10-25 15:03:22 -07:00
Scott Shawcroft 306c921ed1 atmel-samd: Rework mass storage interaction with underlying block
storage to use micropython's VFS interface.

This makes mass storage work with any VFS implementation rather
than a single one.
2016-10-21 15:36:59 -07:00
Scott Shawcroft 343ff4faed atmel-samd: Make the Arduino Zero build use a bootloader. 2016-10-14 13:10:16 -07:00
Scott Shawcroft 011056af15 atmel-samd: Add support for SPI.
Also separate out the ASF config headers that are shared across all boards.
2016-10-11 15:48:43 -07:00
Scott Shawcroft 284d3414e1 atmel-samd: Make UART REPL Arduino Zero specific. Most will use USB REPL. 2016-10-07 15:06:07 -07:00
Scott Shawcroft 67372b369e atmel-samd: Fix A1 and A2 analog inputs.
Fixes #3.
2016-10-07 15:01:26 -07:00
Scott Shawcroft 90bf13efd5 atmel-samd: Correct USB PIDs.
Arduino and Adafruit convention is for user programs to have PIDs
starting with 8 and bootloaders starting with 0.
2016-10-05 12:55:48 -07:00
Scott Shawcroft 7e08347d5c atmel-samd: Support composite CDC and mass storage USB device.
Be careful to not use the flash file system while using mass storage
because both pieces of code attempting to change the fs can corrupt it.
2016-10-05 11:07:29 -07:00
Scott Shawcroft 7fd84e93f4 atmel-samd: Support raw repl and soft reset to support ampy.
Closes #1. Also adds TX and RX led support on the Arduino Zero.
2016-09-15 17:01:19 -07:00
Scott Shawcroft 7d8929c470 atmel-samd: Add I2C support.
This commit also introduces a new shared-bindings directory which is used to store the common Python -> C binding code. By having a shared directory we can ensure that the Python API across ports is the same. Each port will have a corresponding common-hal directory which provides definitions for the C api used in the shared-bindings code. That way the compiler can enforce the C api.

To migrate to this new shared API create a common-hal directory within your port and change the Makefile to compile both the shared-bindings and common-hal files. See atmel-samd/Makefile SRC_BINDINGS for an example.
2016-09-13 11:46:22 -07:00
Scott Shawcroft eff137a5f5 atmel/samd: Support CTRL-C on USB. This won't escape native code but it will cause Python code to stop. 2016-08-31 00:11:56 -07:00
Scott Shawcroft ccb309bd5c atmel/samd: Add basic PWM support which only allows for changing the duty. 2016-08-30 13:10:52 -07:00
Scott Shawcroft b883a15d82 atmel-samd: Rename module classes so they don't conflict with names from ASF. 2016-08-28 00:02:05 -07:00
Scott Shawcroft 259ae8a39d atmel-samd: Initial ADC support. 2016-08-26 17:01:38 -07:00
Scott Shawcroft 3cb4938c63 atmel-samd: Support Digital IO pins.
Also bumps up the heap size.
2016-08-24 17:38:08 -07:00
Scott Shawcroft 0c4f9b878a Enable REPL over USB.
All of the code was there except the linker was failing to clear the bss section because I added too many .zeros. The should have only been the exported globals that start with _ like _szero = .. Fixing that and turn on the usb transmit fixed everything.
2016-08-24 00:14:11 -07:00
Scott Shawcroft 386ab580cd Change the board information used in the header to be board specific. 2016-08-23 17:36:29 -07:00
Scott Shawcroft 9485634d41 Add support for REPL on Arduino Zero through EDBG via UART. 2016-08-23 16:47:53 -07:00
Scott Shawcroft 8f26d181c3 Blinking the LED works. Clocks should be set up correctly.
Everything works fine without USB being plugged in but faults (I think) when USB is plugged in. This is switched away from the USB code from the bootloader onto the USB code thats generated by Atmel Studio using the high level classes from ASF.
2016-08-22 23:53:11 -07:00