Merge pull request #435 from outlandnish/master

Particle Xenon Support: Updates and fixes
This commit is contained in:
Ha Thach authored and GitHub committed 2020-02-11 18:11:21 +07:00
commit e932935cab
6 files changed
+11717 -124

No files matched your search

+1
View File
@@ -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
+51 -1
View File
@@ -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
@@ -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
File diff suppressed because it is too large. Load diff
+48 -36
View File
@@ -27,44 +27,56 @@
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)
// NFC
_PINNUM(0, 9), // P0.09 (u.FL FOR NFC ANTENNA)
_PINNUM(0, 10), // P0.10 (u.FL FOR NFC ANTENNA)
// Analog Pins A0 .. A7
_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)
_PINNUM(0, 5), // P0.04 (BAT_DET/VBAT)
_PINNUM(0, 2), // P0.02 (AREF)
};
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);
}
}
void initVariant()
{
switch_antenna(false);
}
}
+107 -87
View File
@@ -42,125 +42,141 @@ extern "C"
#define PINS_COUNT (34)
#define NUM_DIGITAL_PINS (20)
#define NUM_ANALOG_INPUTS (6) // A6 is used for battery, A7 is analog reference
#define NUM_ANALOG_OUTPUTS (6)
#define NUM_ANALOG_OUTPUTS (0)
/*
* Digital pins
*/
#define PIN_D0 _PINNUM(0, 26)
#define PIN_D1 _PINNUM(0, 27)
#define PIN_D2 _PINNUM(1, 1)
#define PIN_D3 _PINNUM(1, 2)
#define PIN_D4 _PINNUM(1, 8)
#define PIN_D5 _PINNUM(1, 10)
#define PIN_D6 _PINNUM(1, 11)
#define PIN_D7 _PINNUM(1, 12)
#define PIN_D8 _PINNUM(1, 3)
#define PIN_D9 _PINNUM(0, 6)
#define PIN_D10 _PINNUM(0, 8)
#define PIN_D11 _PINNUM(1, 14)
#define PIN_D12 _PINNUM(1, 13)
#define PIN_D13 _PINNUM(1, 15)
#define PIN_D14 _PINNUM(0, 31)
#define PIN_D15 _PINNUM(0, 30)
#define PIN_D16 _PINNUM(0, 29)
#define PIN_D17 _PINNUM(0, 28)
#define PIN_D18 _PINNUM(0, 24)
#define PIN_D19 _PINNUM(0, 3)
#define PIN_D20 _PINNUM(0, 11)
#define PIN_D0 (0)
#define PIN_D1 (1)
#define PIN_D2 (2)
#define PIN_D3 (3)
#define PIN_D4 (4)
#define PIN_D5 (5)
#define PIN_D6 (6)
#define PIN_D7 (7)
#define PIN_D8 (8)
#define PIN_D9 (9)
#define PIN_D10 (10)
#define PIN_D11 (11)
#define PIN_D12 (12)
#define PIN_D13 (13)
#define PIN_D14 (14)
#define PIN_D15 (15)
#define PIN_D16 (16)
#define PIN_D17 (17)
#define PIN_D18 (18)
#define PIN_D19 (19)
#define PIN_D20 (20)
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 = PIN_D0 ;
static const uint8_t D1 = PIN_D1 ;
static const uint8_t D2 = PIN_D2 ;
static const uint8_t D3 = PIN_D3 ;
static const uint8_t D4 = PIN_D4 ;
static const uint8_t D5 = PIN_D5 ;
static const uint8_t D6 = PIN_D6 ;
static const uint8_t D7 = PIN_D7 ;
static const uint8_t D8 = PIN_D8 ;
static const uint8_t D9 = PIN_D9 ;
static const uint8_t D10 = PIN_D10;
static const uint8_t D11 = PIN_D11;
static const uint8_t D12 = PIN_D12;
static const uint8_t D13 = PIN_D13;
static const uint8_t D14 = PIN_D14;
static const uint8_t D15 = PIN_D15;
static const uint8_t D16 = PIN_D16;
static const uint8_t D17 = PIN_D17;
static const uint8_t D18 = PIN_D18;
static const uint8_t D19 = PIN_D19;
static const uint8_t D20 = PIN_D20;
// 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;
#define PIN_LED1 (22)
#define LED_BUILTIN PIN_LED1
#define LED_CONN PIN_LED1
#define LED_RED PIN_LED1
#define LED_BLUE PIN_LED1
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)
#define PIN_A0 (30)
#define PIN_A1 (31)
#define PIN_A2 (32)
#define PIN_A3 (33)
#define PIN_A4 (34)
#define PIN_A5 (35)
#define PIN_A6 (36)
#define PIN_A7 (37)
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 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;
#define ADC_RESOLUTION 14
// Other pins
#define PIN_AREF PIN_A7
#define PIN_VBAT PIN_A6
static const uint8_t AREF = PIN_AREF;
/*
* Serial interfaces
*/
#define PIN_SERIAL1_RX PIN_D9
#define PIN_SERIAL1_TX PIN_D10
#define PIN_SERIAL1_RX 9
#define PIN_SERIAL1_TX 10
#define PIN_SERIAL1_CTS 4
#define PIN_SERIAL1_RTS 3
#define PIN_SERIAL2_RX 5
#define PIN_SERIAL2_TX 4
#define PIN_SERIAL2_CTS 6
#define PIN_SERIAL2_RTS 8
/*
* 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 14
#define PIN_SPI_MISO 11
#define PIN_SPI_MOSI 12
#define PIN_SPI_SCK 13
#define PIN_SPI1_MISO 4
#define PIN_SPI1_MOSI 3
#define PIN_SPI1_SCK 2
static const uint8_t SS = PIN_SPI_SS;
static const uint8_t MOSI = PIN_SPI_MOSI;
@@ -175,13 +191,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 0
#define PIN_WIRE_SCL 1
#define PIN_WIRE1_SDA 2
#define PIN_WIRE1_SCL 3
// On-board QSPI Flash
#define EXTERNAL_FLASH_DEVICES GD25Q16C
#define EXTERNAL_FLASH_DEVICES MX25L3233F
#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