Commit 7662a8c1 authored by Jake Read's avatar Jake Read
Browse files

stash old, continue

parent 813d0702
# ATSAMD51 Documentation
# Yonder D51
`` !warn! violently incomplete ``
The ATSAMD51 is an ARM Cortex-M4F microcontroller manufactured by Microchip (Atmel). As of Oct 13 2019, -> CBA :heart: D51 <-
Herein lies some source code for the ATSAMD51, made arduino-compatible [by the folks at Adafruit](
## Circuits using the D51
Also includes example eagle circuit.
![feather m4 pic](/)
[Adafruit Feather M4](/)
![module pic](/)
[squidworks module](
\ No newline at end of file
![router pic](/)
[squidworks router](
## Toolchains
### Adafruit Bootloader / Platformio (or Arduino Compatible)
Since [Adafruit](ada-feather-m4doc) has adopted the SAMD51, it is well supported by the open source community, and we can borrow their development tools.
**fair warning**
>Use of the arduino bootloader *does* assume that your circuit has a USB port available, as well as a 32.678kHz clock on the RTC Xout / Xin pins. During cycles, the bootloader (assuming it is on a Feather M4) will toggle 'D13' (PA23) as well as send Neopixel Data to (?).
To get started, find the latest build of the [adafruit bootloader] and download that (probably a `.bin` or `.elf` or `.hex` file).
We need to write this file into the micro's memory. I have been using the `Serial Wire Debug` interface, which is enabled by default on the D51 hardware (but JTAG is also available, but requires an enable pin pulled low somewhere *I think*). `SWCLK is on PA30` and `SWDIO is on PA31`.
To speak SWD, I just use the Atmel-Ice programmer, and Atmel Studio 7 (a windows application, sorry). Any programmer that speaks SWD should be capable of doing this. In Atmel Studio, go to `Tools -> Device Programming`, and select the Atmel-Ice Tool, the ATSAMD51xxxx device you'd like to program (the bootloader is written for the ATSAMD51J19A), and the SWD interface. You should be able to read the device signature. If this works, your SWD connection is all super-gucci (as they say). You can navigate to `Memories` - and write that bootloader in. OK. The device should now enumerate over USB as an Adafruit Feather M4 / FeatherBoot (or something similar).
### Platformio
To write code and load it, I use PlatformIO, which is an open source 'IOT' (embedded) programming tool written as a package for either `atom` code-editor, or [something else](link both). See their doc for setting up a new project for the D51 / Feather M4.
### Real Registers in an Arduino World
One of the troubles with Arduino is that people forget that it is just a big C++ library. This means that everything under the sun (that compiles) is legal here. *That* means that we can use Arduino as a crutch, but write really nice Special Function Register code inside of the same executable. Great!
Indeed, in the PlatformIO environment, we even have wonderful autocomplete handles on the D51's core register map. For some examples of this kind of manipulation, check out the [hunks](gitlab ponyo) in the [ponyo](gitlab ponyo) project.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment