diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml new file mode 100644 index 00000000..9efea657 --- /dev/null +++ b/.github/workflows/compile.yml @@ -0,0 +1,77 @@ +name: Build + +on: + push: + branches: '*' + pull_request: + branches: '*' + +jobs: + compile: + strategy: + fail-fast: false + matrix: + variant: + - nRF52DK + - BluzDK + - RedBearLab_nRF51822:version=1_0 + - BBCmicrobit + - BBCmicrobitV2 + - CalliopeMini + - CalliopeminiV3 + - Generic_nRF51822:chip=xxac + - Generic_nRF52832 + - Generic_nRF52833 + - OSHChip + - STCT_nRF52_minidev + - PCA1000X:board_variant=pca10000 + - PCA1000X:board_variant=pca10001 + - PCA1000X:board_variant=nrf6310 + - nRF51Dongle:version=1_1_0 + - Blend2 + - BLENano + - BLENano2 + - TinyBLE + - bluey + - hackaBLE + - hackaBLE_v2 + - Sinobit + - DWM1001-DEV + - SeeedArchLink + - Beacon_PCA20006 + - Waveshare_BLE400 + - ng_beacon + runs-on: ubuntu-latest + name: Compile ${{ matrix.variant }} + steps: + - uses: actions/checkout@v3 + - name: Create blinky sketch to compile + run: | + mkdir blinky + cat > blinky/blinky.ino << EOF + void setup() { + pinMode(LED_BUILTIN, OUTPUT); + } + + void loop() { + digitalWrite(LED_BUILTIN, HIGH); + delay(1000); + digitalWrite(LED_BUILTIN, LOW); + delay(1000); + } + EOF + - uses: arduino/compile-sketches@v1 + with: + cli-version: latest + verbose: true + enable-deltas-report: true + platforms: | + # First we have to install this core so that the tooling is installed + - name: "sandeepmistry:nRF5" + source-url: "https://sandeepmistry.github.io/arduino-nRF5/package_nRF5_boards_index.json" + version: latest + # Now, this will overwrite the core source to use the local version + - name: "sandeepmistry:nRF5" + source-path: . + fqbn: "sandeepmistry:nRF5:${{ matrix.variant }}" + sketch-paths: blinky diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c576ed57..00000000 --- a/.travis.yml +++ /dev/null @@ -1,45 +0,0 @@ -language: generic -addons: - apt: - packages: - - libc6:i386 - - libstdc++6:i386 -env: - global: - - IDE_VERSION=1.8.5 -before_install: - - wget http://downloads.arduino.cc/arduino-$IDE_VERSION-linux64.tar.xz - - tar xf arduino-$IDE_VERSION-linux64.tar.xz - - mv arduino-$IDE_VERSION $HOME/arduino-ide - - export PATH=$PATH:$HOME/arduino-ide - - arduino --pref "boardsmanager.additional.urls=https://sandeepmistry.github.io/arduino-nRF5/package_nRF5_boards_index.json" --install-boards sandeepmistry:nRF5 > /dev/null - - buildExampleSketch() { arduino --verbose-build --verify --board $1 $HOME/arduino-ide/examples/$2/$3/$3.ino; } -install: - - mkdir -p $HOME/Arduino/hardware/sandeepmistry - - ln -s $PWD $HOME/Arduino/hardware/sandeepmistry/nRF5 -script: - - buildExampleSketch sandeepmistry:nRF5:nRF52DK 01.Basics Blink - - buildExampleSketch sandeepmistry:nRF5:BluzDK 01.Basics Blink - - buildExampleSketch sandeepmistry:nRF5:BLENano:version=1_0 01.Basics Blink - - buildExampleSketch sandeepmistry:nRF5:RedBearLab_nRF51822:version=1_0 01.Basics Blink - - buildExampleSketch sandeepmistry:nRF5:BBCmicrobit 01.Basics Blink - - buildExampleSketch sandeepmistry:nRF5:CalliopeMini 01.Basics Blink - - buildExampleSketch sandeepmistry:nRF5:Generic_nRF51822:chip=xxac 01.Basics Blink - - buildExampleSketch sandeepmistry:nRF5:Generic_nRF52832 01.Basics Blink - - buildExampleSketch sandeepmistry:nRF5:OSHChip 01.Basics Blink - - buildExampleSketch sandeepmistry:nRF5:STCT_nRF52_minidev 01.Basics Blink - - buildExampleSketch sandeepmistry:nRF5:PCA1000X:board_variant=pca10000 01.Basics Blink - - buildExampleSketch sandeepmistry:nRF5:PCA1000X:board_variant=pca10001 01.Basics Blink - - buildExampleSketch sandeepmistry:nRF5:PCA1000X:board_variant=nrf6310 01.Basics Blink - - buildExampleSketch sandeepmistry:nRF5:nRF51Dongle:version=1_1_0 01.Basics Blink - - buildExampleSketch sandeepmistry:nRF5:Blend2 01.Basics Blink - - buildExampleSketch sandeepmistry:nRF5:BLENano2 01.Basics Blink - - buildExampleSketch sandeepmistry:nRF5:TinyBLE 01.Basics Blink - - buildExampleSketch sandeepmistry:nRF5:bluey 01.Basics Blink - - buildExampleSketch sandeepmistry:nRF5:hackaBLE 01.Basics Blink - - buildExampleSketch sandeepmistry:nRF5:hackaBLE_v2 01.Basics Blink - - buildExampleSketch sandeepmistry:nRF5:Sinobit 01.Basics BareMinimum - - buildExampleSketch sandeepmistry:nRF5:DWM1001-DEV 01.Basics Blink - - buildExampleSketch sandeepmistry:nRF5:SeeedArchLink 01.Basics Blink - - buildExampleSketch sandeepmistry:nRF5:Generic_nRF52833 01.Basics Blink - - buildExampleSketch sandeepmistry:nRF5:BBCmicrobitV2 01.Basics Blink diff --git a/README.md b/README.md index 3fa15bd6..0595d25f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Arduino Core for Nordic Semiconductor nRF5 based boards -[![Build Status](https://travis-ci.org/sandeepmistry/arduino-nRF5.svg?branch=master)](https://travis-ci.org/sandeepmistry/arduino-nRF5) [![OpenCollective](https://opencollective.com/arduino-nRF5/backers/badge.svg)](#backers) +[![Build Status](https://github.com/sandeepmistry/arduino-nRF5/actions/workflows/compile.yml/badge.svg)](https://github.com/sandeepmistry/arduino-nRF5/actions/workflows/compile.yml) [![OpenCollective](https://opencollective.com/arduino-nRF5/backers/badge.svg)](#backers) [![OpenCollective](https://opencollective.com/arduino-nRF5/sponsors/badge.svg)](#sponsors) @@ -82,6 +82,7 @@ Become a sponsor and get your logo on our README on Github with a link to your s ### nRF52833 * [BBC micro:bit v2](https://microbit.org/new-microbit/) + * [Calliope mini V3](https://calliope.cc/calliope-mini-3) ### nRF52 * [Plain nRF52 MCU](https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF52832) @@ -170,7 +171,7 @@ The SD consumes ~5k of Ram + some extra based on actual BLE configuration. * SoftDevice S130 v2.0.1 supports Revision 3 of nRF51 in peripheral and central role. It is 108k in size. * SoftDevice S132 v2.0.1 supports nRF52 in peripheral and central role. It is 112k in size. -### Flashing a SoftDevice +### Flashing a SoftDevice (IDE 1.8.x only) 1. ```cd ```, where `````` is your Arduino Sketch folder: * OS X: ```~/Documents/Arduino``` diff --git a/boards.txt b/boards.txt index a050d27e..dbd04419 100644 --- a/boards.txt +++ b/boards.txt @@ -534,6 +534,38 @@ CalliopeMini.menu.softdevice.s130.upload.maximum_size=151552 CalliopeMini.menu.softdevice.s130.build.extra_flags=-DNRF51 -DS130 -DNRF51_S130 CalliopeMini.menu.softdevice.s130.build.ldscript=armgcc_s130_nrf51822_xxaa.ld +CalliopeminiV3.name=Calliope mini V3 + +CalliopeminiV3.vid.0=0x0d28 +CalliopeminiV3.pid.0=0x0204 + +CalliopeminiV3.upload.tool=sandeepmistry:openocd +CalliopeminiV3.upload.protocol=cmsis-dap +CalliopeminiV3.upload.target=nrf52 +CalliopeminiV3.upload.maximum_size=524288 +CalliopeminiV3.upload.setup_command=transport select swd; +CalliopeminiV3.upload.use_1200bps_touch=false +CalliopeminiV3.upload.wait_for_upload_port=false +CalliopeminiV3.upload.native_usb=false + +CalliopeminiV3.bootloader.tool=sandeepmistry:openocd + +CalliopeminiV3.build.mcu=cortex-m4 +CalliopeminiV3.build.f_cpu=64000000 +CalliopeminiV3.build.board=CALLIOPE_MINI_V3 +CalliopeminiV3.build.core=nRF5 +CalliopeminiV3.build.variant=CalliopeminiV3 +CalliopeminiV3.build.variant_system_lib= +CalliopeminiV3.build.extra_flags=-DNRF52833_XXAA +CalliopeminiV3.build.float_flags=-mfloat-abi=hard -mfpu=fpv4-sp-d16 +CalliopeminiV3.build.ldscript=nrf52833_xxaa.ld + +CalliopeminiV3.build.lfclk_flags=-DUSE_LFSYNT + +CalliopeminiV3.menu.softdevice.none=None +CalliopeminiV3.menu.softdevice.none.softdevice=none +CalliopeminiV3.menu.softdevice.none.softdeviceversion= + BluzDK.name=Bluz DK BluzDK.upload.tool=sandeepmistry:openocd diff --git a/cores/nRF5/Arduino.h b/cores/nRF5/Arduino.h index 154a2ea4..87bbcdac 100644 --- a/cores/nRF5/Arduino.h +++ b/cores/nRF5/Arduino.h @@ -109,9 +109,9 @@ void loop( void ) ; #error "Unsupported GPIO_COUNT" #endif -#define portOutputRegister(port) ( &(port->OUTSET) ) +#define portOutputRegister(port) ( &(port->OUT) ) #define portInputRegister(port) ( &(port->IN) ) -#define portModeRegister(port) ( &(port->DIRSET) ) +#define portModeRegister(port) ( &(port->DIR) ) #define digitalPinHasPWM(P) ( true ) /* diff --git a/docs/package_nRF5_boards_index.json b/docs/package_nRF5_boards_index.json index 7b5898ee..dc400b62 100644 --- a/docs/package_nRF5_boards_index.json +++ b/docs/package_nRF5_boards_index.json @@ -352,6 +352,60 @@ "version": "0.10.0-dev.nrf5" } ] + }, + { + "name": "Nordic Semiconductor nRF5 Boards", + "architecture": "nRF5", + "version": "0.8.0", + "category": "Contributed", + "help": { + "online": "https://github.com/sandeepmistry/arduino-nRF5/issues" + }, + "url": "https://github.com/sandeepmistry/arduino-nRF5/archive/0.8.0.tar.gz", + "archiveFileName": "arduino-nRF52-0.8.0.tar.gz", + "checksum": "MD5:84da4097f5518bcaa0752ff31927504f", + "size": "1488561", + "boards": [ + {"name": "BBC micro:bit"}, + {"name": "BBC micro:bit v2"}, + {"name": "Bluz DK"}, + {"name": "Calliope mini"}, + {"name": "Calliope mini V3"}, + {"name": "decaWave DWM1001 Module Development Board"}, + {"name": "Electronut labs bluey"}, + {"name": "Electronut labs hackaBLE"}, + {"name": "Electronut labs hackaBLE v2"}, + {"name": "Generic nRF51822"}, + {"name": "Generic nRF52823"}, + {"name": "Generic nRF52833"}, + {"name": "OSHChip"}, + {"name": "ng-beacon"}, + {"name": "nRF51 Dongle"}, + {"name": "nRF51822 Development Kit"}, + {"name": "nRF52 DK"}, + {"name": "Nordic Beacon Kit"}, + {"name": "RedBear BLE Nano 2"}, + {"name": "RedBear Blend 2"}, + {"name": "RedBearLab BLE Nano"}, + {"name": "RedBearLab nRF51822"}, + {"name": "Seeed Arch Link"}, + {"name": "Sino:bit"}, + {"name": "Taida Century nRF52 mini board"}, + {"name": "TinyBLE"}, + {"name": "Waveshare BLE400"} + ], + "toolsDependencies": [ + { + "packager": "sandeepmistry", + "name": "gcc-arm-none-eabi", + "version": "5_2-2015q4" + }, + { + "packager": "sandeepmistry", + "name": "openocd", + "version": "0.10.0-dev.nrf5" + } + ] } ], "tools":[ diff --git a/platform.txt b/platform.txt index be9cb6a4..bf767bf5 100644 --- a/platform.txt +++ b/platform.txt @@ -16,7 +16,7 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA name=Nordic Semiconductor nRF5 Boards -version=0.7.0 +version=0.8.0 # Compile variables # ----------------- diff --git a/variants/CalliopeminiV3/pins_arduino.h b/variants/CalliopeminiV3/pins_arduino.h new file mode 100644 index 00000000..3ef4d4a9 --- /dev/null +++ b/variants/CalliopeminiV3/pins_arduino.h @@ -0,0 +1,17 @@ +/* + 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 +*/ + +// API compatibility +#include "variant.h" diff --git a/variants/CalliopeminiV3/variant.cpp b/variants/CalliopeminiV3/variant.cpp new file mode 100644 index 00000000..99b01b89 --- /dev/null +++ b/variants/CalliopeminiV3/variant.cpp @@ -0,0 +1,69 @@ +/* Pins for Calliope mini V3 +This file connects the hardware pin numbers on the left to the array position. +In Arduino IDE this array position is usually used when calling a pin by number, +e.g. pinMode(5, INPUT) sets BTN A to input mode */ + +#include "variant.h" + +const uint32_t g_ADigitalPinMap[] = { + // 0 - 4 + 2, // A0, PAD 0 + 3, // A1, PAD 1 + 4, // A2, PAD 2 + 35, // Pad 3, not analog (Calliope exclusive pin) + 28, // A4, COL1 + + // 5 - 9 + 14, // BTN A + 37, // COL4, P1.05 + 11, // COL2 + 10, // NFC2 + 9, // NFC1 + + // 10-16 + 30, // A5, COL5 + 23, // BTN B + 12, + 17, // SCK + 1, // MISO + 13, // MOSI + 29, // A7, C16_A1RX (Calliope change) + + // 17 + 18 + 34, // P1.02 C17 (Calliope exclusive pin) + 31, // A3, COL3 (Calliope changed pin number) + + // 19 + 20 + 26, // SCL + 32, // SDA, P1.00 + + // 21 - 25 + 21, // ROW1 + 22, // ROW2 + 15, // ROW3 + 24, // ROW4 + 19, // ROW5 + + // 26 - 29 + 36, // LOGO (touch sensor) + 0, // SPEAKER (Note: Must use synthesized LF clock to make this pin available) + 20, // RUN_MIC + 5, // A6, MIC_IN + + // 30 - 31 + 16, // I2C_INT_SDA + 8, // I2C_INT_SCL + + // 32 - 34 + 25, // COMBINED_SENSOR_INT + 40, // RX, P1.08 + 6, // TX + + // 35 - 40 internal Calliope mini pins + 7, // RGB + 38, // MOTOR_MODE + 33, // M0_DIR + 27, // M0_SPEED + 39, // M1_DIR + 41, // M1_SPEED +}; diff --git a/variants/CalliopeminiV3/variant.h b/variants/CalliopeminiV3/variant.h new file mode 100644 index 00000000..2e9db313 --- /dev/null +++ b/variants/CalliopeminiV3/variant.h @@ -0,0 +1,88 @@ +#ifndef _CALLIOPE_MINI_V3_ +#define _CALLIOPE_MINI_V3_ + +// Master clock frequency + +#define VARIANT_MCK (64000000ul) + +#include "WVariant.h" + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +// Number of pins defined in PinDescription array + +#define PINS_COUNT (41) +#define NUM_DIGITAL_PINS (41) +#define NUM_ANALOG_INPUTS (7) +#define NUM_ANALOG_OUTPUTS (0) + +// LEDs + +#define PIN_LED (13) // This goes to Calliope mini header C12 (not a built in LED) +#define LED_BUILTIN PIN_LED + +// Buttons + +#define PIN_BUTTON_A (5) +#define PIN_BUTTON_B (11) + +// Analog pins + +#define PIN_A0 (0) +#define PIN_A1 (1) +#define PIN_A2 (2) +#define PIN_A3 (18) +#define PIN_A4 (4) +#define PIN_A5 (10) +#define PIN_A6 (29) +#define PIN_A7 (16) + +#define ADC_RESOLUTION 10 +static const uint8_t A0 = PIN_A0; +static const uint8_t A1 = PIN_A1; +static const uint8_t A2 = PIN_A2; +static const uint8_t A3 = PIN_A3; +static const uint8_t A4 = PIN_A4; +static const uint8_t A5 = PIN_A5; +static const uint8_t A6 = PIN_A6; +static const uint8_t A7 = PIN_A7; + +// Serial + +#define PIN_SERIAL_RX (33) +#define PIN_SERIAL_TX (34) + +// SPI + +#define SPI_INTERFACES_COUNT 1 + +#define PIN_SPI_MISO (14) +#define PIN_SPI_MOSI (15) +#define PIN_SPI_SCK (13) + +// Wire Interfaces (external and internal) + +#define WIRE_INTERFACES_COUNT 2 + +#define PIN_WIRE_SDA (20) +#define PIN_WIRE_SCL (19) + +#define PIN_WIRE1_SDA (30) +#define PIN_WIRE1_SCL (31) + +#ifdef __cplusplus + +// Calliope internal pins +#define PIN_RGB (35) +#define PIN_M_MODE (36) +#define PIN_M0_DIR (37) +#define PIN_M0_SPEED (38) +#define PIN_M1_DIR (39) +#define PIN_M1_SPEED (40) +} +#endif // __cplusplus + +#endif