Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This repository contains the Arduino BSP for Adafruit Bluefruit nRF52 series:
Following boards are also included but are not officially supported:

- [Nordic nRF52840DK PCA10056](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK)
- [Particle Xenon](https://store.particle.io/products/xenon)

## BSP Installation

Expand Down
52 changes: 51 additions & 1 deletion boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,57 @@ pca10056.menu.debug.l3=Level 3 (Segger SystemView)
pca10056.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3

# ----------------------------------
# Particle Xenon
# ----------------------------------
particle_xenon.name=Particle Xenon

# VID/PID for bootloader with/without UF2, Arduino + Circuitpython App
particle_xenon.vid.0=0x239A
particle_xenon.pid.0=0x8029
particle_xenon.vid.1=0x239A
particle_xenon.pid.1=0x0029
particle_xenon.vid.2=0x239A
particle_xenon.pid.2=0x002A
particle_xenon.vid.3=0x239A
particle_xenon.pid.3=0x802A

# Upload
particle_xenon.bootloader.tool=bootburn
particle_xenon.upload.tool=nrfutil
particle_xenon.upload.protocol=nrfutil
particle_xenon.upload.use_1200bps_touch=true
particle_xenon.upload.wait_for_upload_port=true
particle_xenon.upload.maximum_size=815104
particle_xenon.upload.maximum_data_size=248832

# Build
particle_xenon.build.mcu=cortex-m4
particle_xenon.build.f_cpu=64000000
particle_xenon.build.board=PARTICLE_XENON
particle_xenon.build.core=nRF5
particle_xenon.build.variant=particle_xenon
particle_xenon.build.usb_manufacturer="Particle Industries"
particle_xenon.build.usb_product="Particle Xenon"
particle_xenon.build.extra_flags=-DNRF52840_XXAA {build.flags.usb}
particle_xenon.build.ldscript=nrf52840_s140_v6.ld
particle_xenon.build.vid=0x239A
particle_xenon.build.pid=0x8029

# SofDevice Menu
particle_xenon.menu.softdevice.s140v6=0.2.11 SoftDevice s140 6.1.1
particle_xenon.menu.softdevice.s140v6.build.sd_name=s140
particle_xenon.menu.softdevice.s140v6.build.sd_version=6.1.1
particle_xenon.menu.softdevice.s140v6.build.sd_fwid=0x00B6

# Debug Menu
particle_xenon.menu.debug.l0=Level 0 (Release)
particle_xenon.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0
particle_xenon.menu.debug.l1=Level 1 (Error Message)
particle_xenon.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1
particle_xenon.menu.debug.l2=Level 2 (Full Debug)
particle_xenon.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2
particle_xenon.menu.debug.l3=Level 3 (Segger SystemView)
particle_xenon.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
# Raytac MDBT50Q – RX
# ----------------------------------
mdbt50qrx.name=Raytac MDBT50Q-RX Dongle
Expand Down Expand Up @@ -475,4 +526,3 @@ mdbt50qrx.menu.debug.l2=Level 2 (Full Debug)
mdbt50qrx.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2
mdbt50qrx.menu.debug.l3=Level 3 (Segger SystemView)
mdbt50qrx.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3

82 changes: 46 additions & 36 deletions variants/particle_xenon/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,44 +27,54 @@
const uint32_t g_ADigitalPinMap[] =
{
// D0 .. D8
26, // P0.26 (SDA)
27, // P0.27 (SCL)
33, // P1.01 (SDA1) (UART1_RTS) (SPI1_SCK) (PWM3)
34, // P1.02 (SCL1) (UART1_CTS) (SPI1_MOSI) (PWM3)
40, // P1.08 (UART2_TX) (SPI1_MISO) (PWM1)
42, // P1.10 (UART2_RX) (PWM1)
43, // P1.11 (UART2_CTS) (PWM1)
44, // P1.12 (PWM0)
35, // P1.03 (UART2_RTS)
_PINNUM(0, 26), // P0.26 (SDA)
_PINNUM(0, 27), // P0.27 (SCL)
_PINNUM(1, 1), // P1.01 (SDA1) (UART1_RTS) (SPI1_SCK) (PWM3)
_PINNUM(1, 2), // P1.02 (SCL1) (UART1_CTS) (SPI1_MOSI) (PWM3)
_PINNUM(1, 8), // P1.08 (UART2_TX) (SPI1_MISO) (PWM1)
_PINNUM(1, 10), // P1.10 (UART2_RX) (PWM1)
_PINNUM(1, 11), // P1.11 (UART2_CTS) (PWM1)
_PINNUM(1, 12), // P1.12 (PWM0)
_PINNUM(1, 03), // P1.03 (UART2_RTS)

// D9 .. D20
6, // P0.06 (UART1_TX)
8, // P0.27 (UART1_RX)
46, // P1.14 (SPI_MISO)
45, // P1.13 (SPI_MOSI)
47, // P1.15 (SPI_SCK)
31, // P0.31 (PWM3) (SPI_SS) (ADC5)
30, // P0.30 (PWM3) (ADC4)
29, // P0.29 (PWM2) (ADC3)
28, // P0.28 (PWM2) (ADC2)
4, // P0.04 (PWM2) (ADC1)
3, // P0.03 (PWM2) (ADC0)
11, // P0.11 (MODE)
18, // P0.18 (RESET)
};
// D9 .. D21
_PINNUM(0, 6), // P0.06 (UART1_TX)
_PINNUM(0, 8), // P0.08 (UART1_RX)
_PINNUM(1, 14), // P1.14 (SPI_MISO)
_PINNUM(1, 13), // P1.13 (SPI_MOSI)
_PINNUM(1, 15), // P1.15 (SPI_SCK)
_PINNUM(0, 31), // P0.31 (PWM3) (SPI_SS) (ADC5)
_PINNUM(0, 30), // P0.30 (PWM3) (ADC4)
_PINNUM(0, 29), // P0.29 (PWM2) (ADC3)
_PINNUM(0, 28), // P0.28 (PWM2) (ADC2)
_PINNUM(0, 4), // P0.04 (PWM2) (ADC1)
_PINNUM(0, 3), // P0.03 (PWM2) (ADC0)
_PINNUM(0, 11), // P0.11 (MODE)
_PINNUM(0, 18), // P0.18 (RESET)

// LEDS
_PINNUM(1, 12), // P1.12 (PRIMARY_LED)
_PINNUM(0, 13), // P0.13 (RGB_RED)
_PINNUM(0, 14), // P0.14 (RGB_GREEN)
_PINNUM(0, 15), // P0.15 (RGB_BLUE)

// Antenna
_PINNUM(0, 24), // P0.24 (ANTENNA_SWITCH_1 - PCB ANTENNA)
_PINNUM(0, 25), // P0.25 (ANTENNA_SWITCH_2 - EXTERNAL u.FL)

static void switch_antenna(bool useExternal) {
if (useExternal) {
digitalWrite(ANTENNA_SWITCH_1, LOW);
digitalWrite(ANTENNA_SWITCH_2, HIGH);
}
else {
digitalWrite(ANTENNA_SWITCH_1, HIGH);
digitalWrite(ANTENNA_SWITCH_2, LOW);
}
}
// NFC
_PINNUM(0, 9), // P0.09 (u.FL FOR NFC ANTENNA)
_PINNUM(0, 10), // P0.10 (u.FL FOR NFC ANTENNA)

// Analog Pins A0 .. A5
_PINNUM(0, 3), // P0.03 (A0)
_PINNUM(0, 4), // P0.04 (A1)
_PINNUM(0, 28), // P0.04 (A2)
_PINNUM(0, 29), // P0.04 (A3)
_PINNUM(0, 30), // P0.04 (A4)
_PINNUM(0, 31), // P0.04 (A5)
};

void initVariant()
{
switch_antenna(false);
}
}
130 changes: 64 additions & 66 deletions variants/particle_xenon/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#define _VARIANT_PARTICLE_XENON_

#define _PINNUM(port, pin) ((port)*32 + (pin))
#define NRF52

/** Master clock frequency */
#define VARIANT_MCK (64000000ul)
Expand Down Expand Up @@ -69,98 +70,91 @@ extern "C"
#define PIN_D19 _PINNUM(0, 3)
#define PIN_D20 _PINNUM(0, 11)

static const uint8_t D0 = PIN_D0;
static const uint8_t D1 = PIN_D1;
static const uint8_t D2 = PIN_D2;
static const uint8_t D3 = PIN_D4;
static const uint8_t D5 = PIN_D5;
static const uint8_t D6 = PIN_D0;
static const uint8_t D7 = PIN_D1;
static const uint8_t D8 = PIN_D2;
static const uint8_t D9 = PIN_D4;
static const uint8_t D10 = PIN_D5;
static const uint8_t D11 = PIN_D0;
static const uint8_t D12 = PIN_D1;
static const uint8_t D13 = PIN_D2;
static const uint8_t D14 = PIN_D4;
static const uint8_t D15 = PIN_D5;
static const uint8_t D16 = PIN_D0;
static const uint8_t D17 = PIN_D1;
static const uint8_t D18 = PIN_D2;
static const uint8_t D19 = PIN_D4;
static const uint8_t D20 = PIN_D5;
static const uint8_t D0 = (0);
static const uint8_t D1 = (1);
static const uint8_t D2 = (2);
static const uint8_t D3 = (3);
static const uint8_t D4 = (4);
static const uint8_t D5 = (5);
static const uint8_t D6 = (6);
static const uint8_t D7 = (7);
static const uint8_t D8 = (8);
static const uint8_t D9 = (9);
static const uint8_t D10 = (10);
static const uint8_t D11 = (11);
static const uint8_t D12 = (12);
static const uint8_t D13 = (13);
static const uint8_t D14 = (14);
static const uint8_t D15 = (15);
static const uint8_t D16 = (16);
static const uint8_t D17 = (17);
static const uint8_t D18 = (18);
static const uint8_t D19 = (19);
static const uint8_t D20 = (20);

// LEDs
#define LEDS_NUMBER 1
#define LED_PRIMARY_PIN _PINNUM(1, 12)
#define LED_STATE_ON 1
#define LED_PRIMARY_IDX 0
#define LED_RGB_RED_IDX 1
#define LED_RGB_GREEN_IDX 2
#define LED_RGB_BLUE_IDX 3

#define LED_RGB_RED_PIN _PINNUM(0, 13)
#define LED_RGB_GREEN_PIN _PINNUM(0, 14)
#define LED_RGB_BLUE_PIN _PINNUM(0, 15)

#define BOARD_RGB_BRIGHTNESS 0x202020

static const uint8_t LED_BUILTIN = LED_PRIMARY_PIN;
static const uint8_t LED_RGB_RED = LED_RGB_RED_PIN;
static const uint8_t LED_RGB_GREEN = LED_RGB_GREEN_PIN;
static const uint8_t LED_RGB_BLUE = LED_RGB_BLUE_PIN;
static const uint8_t LED_BUILTIN = (22);
static const uint8_t LED_RGB_RED = (23);
static const uint8_t LED_RGB_GREEN = (24);
static const uint8_t LED_RGB_BLUE = (25);

// Buttons
#define BUTTONS_NUMBER 2
#define BUTTON_DFU _PINNUM(0, 11)
#define BUTTON_FRESET _PINNUM(0, 03) // A0
#define BUTTON_DFU (20)
#define BUTTON_FRESET (21) // A0
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP

static const uint8_t BUTTON_MODE = PIN_D20;
static const uint8_t BUTTON_MODE = (20);

// Antenna
#define ANTENNA_SWITCH_1 _PINNUM(0, 24)
#define ANTENNA_SWITCH_2 _PINNUM(0, 25)
#define ANTENNA_SWITCH_1 (26)
#define ANTENNA_SWITCH_2 (27)

// NFC
#define NFC1 _PINNUM(0, 9)
#define NFC2 _PINNUM(0, 10)
#define NFC1 (28)
#define NFC2 (29)

/*
* Analog pins
*/
#define PIN_A0 _PINNUM(0, 3)
#define PIN_A1 _PINNUM(0, 4)
#define PIN_A2 _PINNUM(0, 28)
#define PIN_A3 _PINNUM(0, 29)
#define PIN_A4 _PINNUM(0, 30)
#define PIN_A5 _PINNUM(0, 31)

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 ;
#define PIN_A0 (30)
#define PIN_A1 (31)
#define PIN_A2 (32)
#define PIN_A3 (33)
#define PIN_A4 (34)
#define PIN_A5 (35)

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;
#define ADC_RESOLUTION 14

/*
* Serial interfaces
*/
#define PIN_SERIAL1_RX PIN_D9
#define PIN_SERIAL1_TX PIN_D10
#define PIN_SERIAL_RX PIN_D9
#define PIN_SERIAL_TX PIN_D10

/*
* SPI Interfaces
*/
#define SPI_INTERFACES_COUNT 2

#define PIN_SPI_SS PIN_A0
#define PIN_SPI_MISO _PINNUM(1, 14)
#define PIN_SPI_MOSI _PINNUM(1, 13)
#define PIN_SPI_SCK _PINNUM(1, 15)
#define PIN_SPI1_MISO _PINNUM(1, 8)
#define PIN_SPI1_MOSI _PINNUM(1, 2)
#define PIN_SPI1_SCK _PINNUM(1, 1)
#define PIN_SPI_SS PIN_A0
#define PIN_SPI_MISO _PINNUM(1, 14)
#define PIN_SPI_MOSI _PINNUM(1, 13)
#define PIN_SPI_SCK _PINNUM(1, 15)
#define PIN_SPI1_MISO _PINNUM(1, 8)
#define PIN_SPI1_MOSI _PINNUM(1, 2)
#define PIN_SPI1_SCK _PINNUM(1, 1)

static const uint8_t SS = PIN_SPI_SS;
static const uint8_t MOSI = PIN_SPI_MOSI;
Expand All @@ -175,13 +169,17 @@ static const uint8_t SCK1 = PIN_SPI1_SCK;
*/
#define WIRE_INTERFACES_COUNT 2

#define PIN_WIRE_SDA _PINNUM(0, 26)
#define PIN_WIRE_SCL _PINNUM(0, 27)
#define PIN_WIRE1_SDA _PINNUM(1, 1)
#define PIN_WIRE1_SCL _PINNUM(1, 2)
#define PIN_WIRE_SDA _PINNUM(0, 26)
#define PIN_WIRE_SCL _PINNUM(0, 27)
#define PIN_WIRE1_SDA _PINNUM(1, 1)
#define PIN_WIRE1_SCL _PINNUM(1, 2)

// On-board QSPI Flash
#define EXTERNAL_FLASH_DEVICES GD25Q16C

#define USB_MSC_BLOCK_SIZE 512
#define USB_MSC_BLOCK_COUNT ((2*1024*1024) / USB_MSC_BLOCK_SIZE)

#define EXTERNAL_FLASH_USE_QSPI

#ifdef __cplusplus
Expand Down