Skip to content

Commit

Permalink
added samd boards
Browse files Browse the repository at this point in the history
  • Loading branch information
awatterott committed Apr 9, 2017
1 parent 6afe7e2 commit feb21b6
Show file tree
Hide file tree
Showing 22 changed files with 1,159 additions and 5 deletions.
17 changes: 15 additions & 2 deletions software/Arduino/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Add the following URL to the Arduino Boards Manager (*File->Preferences*):
```
https://github.com/watterott/wattuino/raw/master/software/Arduino/package_watterott_index.json
```
and install the **Watterott AVR Boards** via the Boards Manager (*Tools->Boards->Boards Manager*).
and install the **Watterott AVR Boards**, **Watterott SAMD Boards** and **Arduino SAMD Boards** via the Boards Manager (*Tools->Boards->Boards Manager*).

If you want to use the **ATTinyCore** from [Spence Konde](https://github.com/SpenceKonde/ATTinyCore) for the Nanite boards, then also install it via the Arduino Boards Manager.
Here is the URL:
Expand All @@ -27,6 +27,7 @@ If you cannot install the driver on Windows 8 or higher then deactivate the [dri
* [Caterina Driver](https://github.com/watterott/wattuino/raw/master/software/Caterina/driver.zip)
* [Micronucleus Driver](https://github.com/watterott/wattuino/raw/master/software/Micronucleus/driver.zip) (on problems use [Zadig libusb Installer](https://github.com/micronucleus/micronucleus/tree/master/windows_driver_installer))
* [FTDI Driver](http://www.ftdichip.com/Drivers/VCP.htm)
* [SAM-BAR Driver](https://github.com/watterott/SAM-BAR/raw/master/software/arduino/driver.zip)

### Linux
The Modem Manager detects the Serial Ports (e.g. Caterina Bootloader) as a modem and therefore a blacklist rule is needed.
Expand All @@ -40,6 +41,8 @@ and add the following lines to the file:
```
ATTRS{idVendor}=="6666", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTRS{idVendor}=="1D50", ATTRS{idProduct}=="60B0", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTRS{idVendor}=="1D50", ATTRS{idProduct}=="6112", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTRS{idVendor}=="1D50", ATTRS{idProduct}=="6113", ENV{ID_MM_DEVICE_IGNORE}="1"
```

Reload udev rules:
Expand All @@ -52,7 +55,7 @@ Or you can also remove the Modem Manager from your system with
sudo apt-get uninstall modemmanager
```

### Micronucleus
### Micronucleus Bootloader
The Micronucleus bootloader is not started automatically. You have to **press the reset switch to activate the bootloader** after *Uploading...* is shown in the Arduino IDE.

The Micronucleus upload tool needs root rights to run and so the Arduino IDE has to be started with sudo or you can also create a rule to allow non-root users access to the Micronucleus USB device.
Expand All @@ -72,3 +75,13 @@ Reload udev rules:
```
sudo udevadm control --reload-rules
```

## SAM-BAR Bootloader

The bootloader can be activated via the Arduino IDE or by doing two reset in 0.5s (double pressing reset switch).

When the bootloader is active then a new program can be loaded via the Arduino IDE and the serial port or via the mass storage device.
For the mass storage device delete the file ```FLASH.BIN``` and then copy a new binary file ```FLASH.BIN``` to the drive.
After the copy process is finished, do a reset to start the new program.

A binary file can be generated and exported in the Arduino IDE with *Sketch->Export compiled Binary* command.
3 changes: 0 additions & 3 deletions software/Arduino/hardware/watterott/avr/platform.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@

# Watterott AVR Core and Platform
# -------------------------------
#
# For more info:
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification

name=Watterott AVR Boards
version=1.0.0
Expand Down
29 changes: 29 additions & 0 deletions software/Arduino/hardware/watterott/samd/boards.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

# Wattuino RC
rc.name=Wattuino RC
rc.vid.0=0x1D50
rc.pid.0=0x6112
rc.vid.1=0x1D50
rc.pid.1=0x6113
rc.bootloader.tool=openocd
rc.bootloader.file=rc_sambar.bin
rc.bootloader.size=0x4000
rc.bootloader.NVMCTRL_BOOTPROT=0x01
rc.upload.tool=bossac
rc.upload.protocol=sam-ba
rc.upload.maximum_size=262144
rc.upload.use_1200bps_touch=true
rc.upload.wait_for_upload_port=true
rc.upload.native_usb=true
rc.build.mcu=cortex-m0plus
rc.build.f_cpu=48000000L
rc.build.board=SAMD_MKR1000
rc.build.variant=wattuino_rc
rc.build.core=arduino:arduino
rc.build.extra_flags=-D__SAMD21G18A__ {build.usb_flags}
rc.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
rc.build.openocdscript=openocd_scripts/arduino_zero.cfg
rc.build.vid=0x1D50
rc.build.pid=0x6113
rc.build.usb_product="Wattuino RC"
rc.build.usb_manufacturer="Watterott"
Binary file not shown.
Binary file not shown.
80 changes: 80 additions & 0 deletions software/Arduino/hardware/watterott/samd/drivers/sam-bar.inf
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@

[Strings]
DriverPackageDisplayName="USB Serial Port Driver"
ManufacturerName="Watterott"
ServiceName="USB RS-232 Emulation Driver"
robotics.loader="Eitech Robotics Bootloader"
robotics.sketch="Eitech Robotics"
sambar.loader="SAM-BAR Bootloader"
sambar.sketch="SAM-BAR Sketch"

[DefaultInstall]
CopyINF=sam-bar.inf

[Version]
Class=Ports
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
Signature="$Windows NT$"
Provider=%ManufacturerName%
DriverPackageDisplayName=%DriverPackageDisplayName%
CatalogFile=sam-bar.cat
DriverVer=01/01/2017,1.0.0.0

[Manufacturer]
%ManufacturerName%=DeviceList, NTamd64, NTia64

[DestinationDirs]
FakeModemCopyFileSection=12
DefaultDestDir=12

[DeviceList]
%robotics.loader%=DriverInstall, USB\VID_1D50&PID_6110
%robotics.sketch%=DriverInstall, USB\VID_1D50&PID_6111
%robotics.loader%=DriverInstall, USB\VID_1D50&PID_6110&MI_00
%robotics.sketch%=DriverInstall, USB\VID_1D50&PID_6111&MI_00
%sambar.loader%=DriverInstall, USB\VID_1D50&PID_6112
%sambar.sketch%=DriverInstall, USB\VID_1D50&PID_6113
%sambar.loader%=DriverInstall, USB\VID_1D50&PID_6112&MI_00
%sambar.sketch%=DriverInstall, USB\VID_1D50&PID_6113&MI_00

[DeviceList.NTamd64]
%robotics.loader%=DriverInstall, USB\VID_1D50&PID_6110
%robotics.sketch%=DriverInstall, USB\VID_1D50&PID_6111
%robotics.loader%=DriverInstall, USB\VID_1D50&PID_6110&MI_00
%robotics.sketch%=DriverInstall, USB\VID_1D50&PID_6111&MI_00
%sambar.loader%=DriverInstall, USB\VID_1D50&PID_6112
%sambar.sketch%=DriverInstall, USB\VID_1D50&PID_6113
%sambar.loader%=DriverInstall, USB\VID_1D50&PID_6112&MI_00
%sambar.sketch%=DriverInstall, USB\VID_1D50&PID_6113&MI_00

[DeviceList.NTia64]
%robotics.loader%=DriverInstall, USB\VID_1D50&PID_6110
%robotics.sketch%=DriverInstall, USB\VID_1D50&PID_6111
%robotics.loader%=DriverInstall, USB\VID_1D50&PID_6110&MI_00
%robotics.sketch%=DriverInstall, USB\VID_1D50&PID_6111&MI_00
%sambar.loader%=DriverInstall, USB\VID_1D50&PID_6112
%sambar.sketch%=DriverInstall, USB\VID_1D50&PID_6113
%sambar.loader%=DriverInstall, USB\VID_1D50&PID_6112&MI_00
%sambar.sketch%=DriverInstall, USB\VID_1D50&PID_6113&MI_00

[DriverInstall]
include=mdmcpq.inf,usb.inf
CopyFiles=FakeModemCopyFileSection
AddReg=DriverAddReg

[DriverAddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,usbser.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"

[DriverInstall.Services]
include=mdmcpq.inf
AddService=usbser, 0x00000002, DriverService

[DriverService]
DisplayName=%ServiceName%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\usbser.sys
LoadOrderGroup=Base
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Blink Example
*
* Turns on an LED for one second, then off for one second, repeatedly.
*/

// setup function, runs once when you press reset or power the board
void setup()
{
// J1...J7 have LEDs
pinMode(RCJ1, OUTPUT); // initialize pin as an output
}

// loop function, runs over and over again forever
void loop()
{
digitalWrite(RCJ1, HIGH); // turn LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(RCJ1, LOW); // turn LED off by making the voltage LOW
delay(1000); // wait for a second
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Blink Example
*
* Turns on all LEDs for one second, then off for one second, repeatedly.
*/

// setup function, runs once when you press reset or power the board
void setup()
{
// initialize pins as outputs
pinMode(LED_BUILTIN, OUTPUT);
pinMode(RCJ1, OUTPUT);
pinMode(RCJ2, OUTPUT);
pinMode(RCJ3, OUTPUT);
pinMode(RCJ4, OUTPUT);
pinMode(RCJ5, OUTPUT);
pinMode(RCJ6, OUTPUT);
pinMode(RCJ7, OUTPUT);
pinMode(RCS1, OUTPUT);
}

// loop function, runs over and over again forever
void loop()
{
// turn LEDs on (HIGH is the voltage level)
digitalWrite(LED_BUILTIN, HIGH);
digitalWrite(RCJ1, HIGH);
digitalWrite(RCJ2, HIGH);
digitalWrite(RCJ3, HIGH);
digitalWrite(RCJ4, HIGH);
digitalWrite(RCJ5, HIGH);
digitalWrite(RCJ6, HIGH);
digitalWrite(RCJ7, HIGH);
digitalWrite(RCS1, HIGH);

delay(1000); // wait for a second

// turn LEDs off by making the voltage LOW
digitalWrite(LED_BUILTIN, LOW);
digitalWrite(RCJ1, LOW);
digitalWrite(RCJ2, LOW);
digitalWrite(RCJ3, LOW);
digitalWrite(RCJ4, LOW);
digitalWrite(RCJ5, LOW);
digitalWrite(RCJ6, LOW);
digitalWrite(RCJ7, LOW);
digitalWrite(RCS1, LOW);

delay(1000); // wait for a second
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name=Wattuino RC
version=1.0.0
author=Watterott
maintainer=Watterott
sentence=Wattuino RC
paragraph=Wattuino RC
category=Other
url=https://github.com/watterott/wattuino
architectures=*
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//empty file, workaround for libraries containing only examples
40 changes: 40 additions & 0 deletions software/Arduino/hardware/watterott/samd/platform.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

# Watterott SAMD Core and Platform
# --------------------------------

name=Watterott SAMD Boards (ARM Cortex-M0+)
version=1.0.0

# BOSSA

tools.bossac.path={runtime.tools.bossac.path}
tools.bossac.cmd=bossac
tools.bossac.cmd.windows=bossac.exe

tools.bossac.upload.params.verbose=-i -d
tools.bossac.upload.params.quiet=
tools.bossac.upload.pattern="{path}/{cmd}" {upload.verbose} --port={serial.port.file} -U {upload.native_usb} -i -e -w -v "{build.path}/{build.project_name}.bin" -R

tools.bossac_remote.upload.pattern=/usr/bin/run-bossac {upload.verbose} --port=ttyATH0 -U {upload.native_usb} -e -w -v /tmp/sketch.bin -R

# OpenOCD sketch upload

tools.openocd.path={runtime.tools.openocd.path}
tools.openocd.cmd=bin/openocd
tools.openocd.cmd.windows=bin/openocd.exe

tools.openocd.upload.params.verbose=-d2
tools.openocd.upload.params.quiet=-d0
tools.openocd.upload.pattern="{path}/{cmd}" {upload.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; program {{{build.path}/{build.project_name}.bin}} verify reset {bootloader.size}; shutdown"

tools.openocd.program.params.verbose=-d2
tools.openocd.program.params.quiet=-d0
tools.openocd.program.pattern="{path}/{cmd}" {program.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; program {{{build.path}/{build.project_name}.elf}} verify reset; shutdown"

tools.openocd.erase.params.verbose=-d3
tools.openocd.erase.params.quiet=-d0
tools.openocd.erase.pattern=

tools.openocd.bootloader.params.verbose=-d2
tools.openocd.bootloader.params.quiet=-d0
tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; init; halt; at91samd bootloader 0; program {{{runtime.platform.path}/bootloaders/{bootloader.file}}} verify reset; shutdown"
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#
# Arduino Zero OpenOCD script.
#
# Copyright (c) 2014-2015 Arduino LLC. All right reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#

# Define 'reset' command
define reset

info reg

break main

# End of 'reset' command
end

target remote | openocd -c "interface cmsis-dap" -c "set CHIPNAME at91samd21g18" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log"
Loading

0 comments on commit feb21b6

Please sign in to comment.