– March 26, 2018
We are developing a product using the SAMD51. Simple reason: low cost, lots of memory. The SAMD5x family is a 120MHz ARM Cortex M4 processor with single precision FPU (Floating Point Unit). For more information on this family, go to Microchip.
The closest development board that Microchip offers is the SAM E54 Xplained Pro. (ATSAME54-XPRO). Adafruit and others have recently introduced their own D51 development boards. If you just want to play with it the circuitpython is a cute little app and works surprisingly well.
Development environment is ASF4 (Atmel Software Foundation). There is no general download of this package like there is for ASF3, rather you "customize" the package you wish to download using start.atmel.com. You use the website to go through and assign pins, clocks, events, touch pads, and components, then download a file with .atzip (really it just a zip file). This can be read into Atmel Studio or you change the .atzip to .zip and unpack it. What they don't really allow you to do is make changes to your configuration in start.atmel.com and just update the changes. This makes it clunky, hard to maintain and develop from. Some of the code is generated by the customization and some of it is changes in the config files. The code itself has HAL layers, more layers and hri layer.
There are useful parts of ASF4: The includes directory and subfolder with register pointer alias is useful. A cleaned up the hri directory may be useful. In the gcc folder are the startup_samd51.c and linker scripts which are fine to use.
The processor has a fairly sophisticated array of peripherals and clocking. This does make initialization complex. It probably is the reason for start.atmel.com. as most of the effort is customizing the initialization phase. You could go through and hard code each of the pieces to initialize but its difficult for flexibility during development.
So I came up with two hacks to avoid using ASF4. The first was to clean up the hri directory. I am partial to the static inlines and feel it can make the code more readable. The second was to use a configuration file format to customize initialization and translate that into a SystemInit() function. The result was a lot of bash/gawk scripts. I decided to make these publicly available and so it is on github.
awk has been around since 1970 when Aho, Weinberger and Kernighan wrote it. This is the first time I did anything this serious with awk. My goal was to avoid rathole code and figured that bash and gawk were fairly common and should be stable after 48 years.
Rathole code from first glance is simple and useful code but you find yourself spending the better part of the day hunting down dependencies to make it work. It usually doesn't in the end and it's best abandoned.
Yes, with the right awk, this works even on a Raspberry Pi Zero where the connectors cost more than the computer.
You can get the initmaker code and samd5x includes from github at alkgrove/initmaker. I have include the register definition includes, startup and linker script files with bug fixes. There is an example for blinky light on any of the adafruit D51 boards.
Not all peripherals are supported by the initialization but there are hooks to add these. Most high end peripherals that I'm not using such as CAN, I2S, and USB I have no intention of supporting myself. Rewriting from ASF4 is incredibly tedious. If someone does a better job (ala LUFA for USB), I'll look at putting the right hooks in. I do plan to eventually support PDEC, PCC, ADC, AC, DAC and QSPI.
For development, third party software that will work with this in your build directory will also need the CMSIS, CHaN FatFS and FreeRTOS.
For the longest time, there was no development board available, and we made our own and have had it working. We worked with Segger on getting JLink to talk to it smoothly and it is very reliable. We'll be sharing other stuff that we have come across, maybe it will be useful.