Skip to content

Commit 3c495f7

Browse files
authored
Merge pull request #9 from Seeed-Studio/xiao_nrf52840_plus
add xiao nrf52840 plus and xiao nrf52840 sense plus
2 parents f69e168 + f58d345 commit 3c495f7

File tree

8 files changed

+631
-2
lines changed

8 files changed

+631
-2
lines changed

.github/workflows/githubci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
- 'xiaonRF52840'
1313
- 'xiaonRF52840Sense'
1414
- 'wio_tracker_1110'
15+
- 'xiaonRF52840Plus'
1516

1617
runs-on: ubuntu-latest
1718

boards.txt

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,111 @@ wio_tracker_1110.menu.lbm_custom.standard=No
179179
wio_tracker_1110.menu.lbm_custom.standard.build.flags.lbm_custom=-DLBM_CUSTOM=0
180180
wio_tracker_1110.menu.lbm_custom.sensecap=SenseCAP
181181
wio_tracker_1110.menu.lbm_custom.sensecap.build.flags.lbm_custom=-DLBM_CUSTOM=1
182+
183+
# ----------------------------------
184+
# Seeed XIAO nRF52840 Plus
185+
# ----------------------------------
186+
xiaonRF52840Plus.name=Seeed XIAO nRF52840 Plus
187+
188+
# VID/PID for bootloader
189+
xiaonRF52840Plus.vid.0=0x2886
190+
xiaonRF52840Plus.pid.0=0x8064
191+
xiaonRF52840Plus.vid.1=0x2886
192+
xiaonRF52840Plus.pid.1=0x0064
193+
xiaonRF52840Plus.vid.2=0x2886
194+
xiaonRF52840Plus.pid.2=0x0064
195+
xiaonRF52840Plus.vid.3=0x2886
196+
xiaonRF52840Plus.pid.3=0x8064
197+
198+
# Upload
199+
xiaonRF52840Plus.bootloader.tool=bootburn
200+
xiaonRF52840Plus.upload.tool=nrfutil
201+
xiaonRF52840Plus.upload.protocol=nrfutil
202+
xiaonRF52840Plus.upload.use_1200bps_touch=true
203+
xiaonRF52840Plus.upload.wait_for_upload_port=true
204+
xiaonRF52840Plus.upload.maximum_size=811008
205+
xiaonRF52840Plus.upload.maximum_data_size=237568
206+
207+
# Build
208+
xiaonRF52840Plus.build.mcu=cortex-m4
209+
xiaonRF52840Plus.build.f_cpu=64000000
210+
xiaonRF52840Plus.build.board=Seeed_XIAO_nRF52840_Plus
211+
xiaonRF52840Plus.build.core=nRF5
212+
xiaonRF52840Plus.build.variant=Seeed_XIAO_nRF52840_Plus
213+
xiaonRF52840Plus.build.usb_manufacturer="Seeed"
214+
xiaonRF52840Plus.build.usb_product="XIAO nRF52840 Plus"
215+
xiaonRF52840Plus.build.extra_flags=-DNRF52840_XXAA {build.flags.usb}
216+
xiaonRF52840Plus.build.ldscript=nrf52840_s140_v7.ld
217+
xiaonRF52840Plus.build.vid=0x2886
218+
xiaonRF52840Plus.build.pid=0x8044
219+
220+
# SofDevice Menu
221+
xiaonRF52840Plus.menu.softdevice.s140v6=S140 7.3.0
222+
xiaonRF52840Plus.menu.softdevice.s140v6.build.sd_name=s140
223+
xiaonRF52840Plus.menu.softdevice.s140v6.build.sd_version=7.3.0
224+
xiaonRF52840Plus.menu.softdevice.s140v6.build.sd_fwid=0x0123
225+
226+
# Debug Menu
227+
xiaonRF52840Plus.menu.debug.l0=Level 0 (Release)
228+
xiaonRF52840Plus.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0
229+
xiaonRF52840Plus.menu.debug.l1=Level 1 (Error Message)
230+
xiaonRF52840Plus.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1
231+
xiaonRF52840Plus.menu.debug.l2=Level 2 (Full Debug)
232+
xiaonRF52840Plus.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2
233+
xiaonRF52840Plus.menu.debug.l3=Level 3 (Segger SystemView)
234+
xiaonRF52840Plus.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
235+
xiaonRF52840Plus.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1
236+
237+
# ----------------------------------
238+
# Seeed XIAO nRF52840 Sense Plus
239+
# ----------------------------------
240+
xiaonRF52840SensePlus.name=Seeed XIAO nRF52840 Sense Plus
241+
242+
# VID/PID for bootloader
243+
xiaonRF52840SensePlus.vid.0=0x2886
244+
xiaonRF52840SensePlus.pid.0=0x8065
245+
xiaonRF52840SensePlus.vid.1=0x2886
246+
xiaonRF52840SensePlus.pid.1=0x0065
247+
xiaonRF52840SensePlus.vid.2=0x2886
248+
xiaonRF52840SensePlus.pid.2=0x0065
249+
xiaonRF52840SensePlus.vid.3=0x2886
250+
xiaonRF52840SensePlus.pid.3=0x8065
251+
252+
# Upload
253+
xiaonRF52840SensePlus.bootloader.tool=bootburn
254+
xiaonRF52840SensePlus.upload.tool=nrfutil
255+
xiaonRF52840SensePlus.upload.protocol=nrfutil
256+
xiaonRF52840SensePlus.upload.use_1200bps_touch=true
257+
xiaonRF52840SensePlus.upload.wait_for_upload_port=true
258+
xiaonRF52840SensePlus.upload.maximum_size=811008
259+
xiaonRF52840SensePlus.upload.maximum_data_size=237568
260+
261+
# Build
262+
xiaonRF52840SensePlus.build.mcu=cortex-m4
263+
xiaonRF52840SensePlus.build.f_cpu=64000000
264+
xiaonRF52840SensePlus.build.board=Seeed_XIAO_nRF52840_Sense_Plus
265+
xiaonRF52840SensePlus.build.core=nRF5
266+
xiaonRF52840SensePlus.build.variant=Seeed_XIAO_nRF52840_Sense_Plus
267+
xiaonRF52840SensePlus.build.usb_manufacturer="Seeed"
268+
xiaonRF52840SensePlus.build.usb_product="XIAO nRF52840 Sense Plus"
269+
xiaonRF52840SensePlus.build.extra_flags=-DNRF52840_XXAA {build.flags.usb}
270+
xiaonRF52840SensePlus.build.ldscript=nrf52840_s140_v7.ld
271+
xiaonRF52840SensePlus.build.vid=0x2886
272+
xiaonRF52840SensePlus.build.pid=0x8044
273+
274+
# SofDevice Menu
275+
xiaonRF52840SensePlus.menu.softdevice.s140v6=S140 7.3.0
276+
xiaonRF52840SensePlus.menu.softdevice.s140v6.build.sd_name=s140
277+
xiaonRF52840SensePlus.menu.softdevice.s140v6.build.sd_version=7.3.0
278+
xiaonRF52840SensePlus.menu.softdevice.s140v6.build.sd_fwid=0x0123
279+
280+
# Debug Menu
281+
xiaonRF52840SensePlus.menu.debug.l0=Level 0 (Release)
282+
xiaonRF52840SensePlus.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0
283+
xiaonRF52840SensePlus.menu.debug.l1=Level 1 (Error Message)
284+
xiaonRF52840SensePlus.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1
285+
xiaonRF52840SensePlus.menu.debug.l2=Level 2 (Full Debug)
286+
xiaonRF52840SensePlus.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2
287+
xiaonRF52840SensePlus.menu.debug.l3=Level 3 (Segger SystemView)
288+
xiaonRF52840SensePlus.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
289+
xiaonRF52840SensePlus.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1

cores/nRF5/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ static void loop_task(void* arg)
5252
TinyUSB_Device_Init(0);
5353
#endif
5454

55-
#if defined(ARDUINO_Seeed_XIAO_nRF52840) || defined(ARDUINO_Seeed_XIAO_nRF52840_Sense)
55+
#if defined(ARDUINO_Seeed_XIAO_nRF52840) || defined(ARDUINO_Seeed_XIAO_nRF52840_Sense) || defined(ARDUINO_Seeed_XIAO_nRF52840_Plus)
5656

5757
#if CFG_DEBUG
5858
// If Serial is not begin(), call it to avoid hard fault

libraries/Wire/Wire_nRF52.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ extern "C" {
2929

3030
#include "Wire.h"
3131

32-
#if defined(ARDUINO_Seeed_XIAO_nRF52840) || defined(ARDUINO_Seeed_XIAO_nRF52840_Sense)
32+
#if defined(ARDUINO_Seeed_XIAO_nRF52840) || defined(ARDUINO_Seeed_XIAO_nRF52840_Sense) || defined(ARDUINO_Seeed_XIAO_nRF52840_Plus)
3333
#include <Adafruit_TinyUSB.h> // for Serial
3434
#elif defined(ARDUINO_WIO_TRACKER_1110)
3535
#else
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#include "variant.h"
2+
#include "wiring_constants.h"
3+
#include "wiring_digital.h"
4+
#include "nrf.h"
5+
6+
const uint32_t g_ADigitalPinMap[] =
7+
{
8+
// D0 .. D10
9+
2, // D0 is P0.02 (A0)
10+
3, // D1 is P0.03 (A1)
11+
28, // D2 is P0.28 (A2)
12+
29, // D3 is P0.29 (A3)
13+
4, // D4 is P0.04 (A4,SDA)
14+
5, // D5 is P0.05 (A5,SCL)
15+
43, // D6 is P1.11 (TX)
16+
44, // D7 is P1.12 (RX)
17+
45, // D8 is P1.13 (SCK)
18+
46, // D9 is P1.14 (MISO)
19+
47, // D10 is P1.15 (MOSI)
20+
21+
// LEDs
22+
26, // D20 is P0.26 (LED RED)
23+
6, // D21 is P0.06 (LED BLUE)
24+
30, // D22 is P0.30 (LED GREEN)
25+
14, // D23 is P0.14 (READ_BAT)
26+
27+
// LSM6DS3TR
28+
40, // D24 is P1.08 (6D_PWR)
29+
27, // D25 is P0.27 (6D_I2C_SCL)
30+
7, // D26 is P0.07 (6D_I2C_SDA)
31+
11, // D27 is P0.11 (6D_INT1)
32+
33+
// MIC
34+
42, // D28 is P1.10 (MIC_PWR)
35+
32, // D29 is P1.00 (PDM_CLK)
36+
16, // D30 is P0.16 (PDM_DATA)
37+
38+
// BQ25100
39+
13, // D31 is P0.13 (HICHG)
40+
17, // D32 is P0.17 (~CHG)
41+
42+
//
43+
21, // D33 is P0.21 (QSPI_SCK)
44+
25, // D34 is P0.25 (QSPI_CSN)
45+
20, // D35 is P0.20 (QSPI_SIO_0 DI)
46+
24, // D36 is P0.24 (QSPI_SIO_1 DO)
47+
22, // D37 is P0.22 (QSPI_SIO_2 WP)
48+
23, // D38 is P0.23 (QSPI_SIO_3 HOLD)
49+
50+
// D11 ~ D20
51+
15, // D11 is P0.15 (i2s_sd)
52+
19, // D12 is P0.19 (i2s_sck)
53+
33, // D13 is P1.1 (i2s_ws)
54+
9, // D15 is P0.09 (nfc1)
55+
10, // D16 is P0.10 (nfc2)
56+
31, // D18 is P0.31 (VBAT)
57+
39, // D19 is P1.07 (MOSI1)
58+
37, // D20 is P1.05 (MISO1)
59+
35, // D21 is P1.03 (SCK1)
60+
};
61+
62+
void initVariant()
63+
{
64+
// Disable reading of the BAT voltage.
65+
// https://wiki.seeedstudio.com/XIAO_BLE#q3-what-are-the-considerations-when-using-xiao-nrf52840-sense-for-battery-charging
66+
pinMode(VBAT_ENABLE, OUTPUT);
67+
digitalWrite(VBAT_ENABLE, HIGH);
68+
69+
// Low charging current.
70+
// https://wiki.seeedstudio.com/XIAO_BLE#battery-charging-current
71+
pinMode(PIN_CHARGING_CURRENT, INPUT);
72+
73+
pinMode(PIN_QSPI_CS, OUTPUT);
74+
digitalWrite(PIN_QSPI_CS, HIGH);
75+
76+
pinMode(LED_RED, OUTPUT);
77+
digitalWrite(LED_RED, HIGH);
78+
pinMode(LED_GREEN, OUTPUT);
79+
digitalWrite(LED_GREEN, HIGH);
80+
pinMode(LED_BLUE, OUTPUT);
81+
digitalWrite(LED_BLUE, HIGH);
82+
}
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
#ifndef _SEEED_XIAO_NRF52840_PLUS_H_
2+
#define _SEEED_XIAO_NRF52840_PLUS_H_
3+
4+
/** Master clock frequency */
5+
#define VARIANT_MCK (64000000ul)
6+
7+
#define USE_LFXO // Board uses 32khz crystal for LF
8+
//#define USE_LFRC // Board uses RC for LF
9+
10+
/*----------------------------------------------------------------------------
11+
* Headers
12+
*----------------------------------------------------------------------------*/
13+
14+
#include "WVariant.h"
15+
16+
#ifdef __cplusplus
17+
extern "C"
18+
{
19+
#endif // __cplusplus
20+
21+
#define PINS_COUNT (39)
22+
#define NUM_DIGITAL_PINS (39)
23+
#define NUM_ANALOG_INPUTS (8)
24+
#define NUM_ANALOG_OUTPUTS (0)
25+
26+
// LEDs
27+
#define PIN_LED (LED_RED)
28+
#define LED_PWR (PINS_COUNT)
29+
#define PIN_NEOPIXEL (PINS_COUNT)
30+
#define NEOPIXEL_NUM (0)
31+
32+
#define LED_BUILTIN (PIN_LED)
33+
34+
#define LED_RED (11)
35+
#define LED_GREEN (13)
36+
#define LED_BLUE (12)
37+
38+
#define LED_STATE_ON (1) // State when LED is litted
39+
40+
// Buttons
41+
#define PIN_BUTTON1 (PINS_COUNT)
42+
43+
// Digital PINs
44+
static const uint8_t D0 = 0 ;
45+
static const uint8_t D1 = 1 ;
46+
static const uint8_t D2 = 2 ;
47+
static const uint8_t D3 = 3 ;
48+
static const uint8_t D4 = 4 ;
49+
static const uint8_t D5 = 5 ;
50+
static const uint8_t D6 = 6 ;
51+
static const uint8_t D7 = 7 ;
52+
static const uint8_t D8 = 8 ;
53+
static const uint8_t D9 = 9 ;
54+
static const uint8_t D10 = 10;
55+
56+
static const uint8_t D11 = 30;
57+
static const uint8_t D12 = 31;
58+
static const uint8_t D13 = 32;
59+
static const uint8_t D14 = 33;
60+
static const uint8_t D15 = 34;
61+
static const uint8_t D16 = 35;
62+
static const uint8_t D17 = 36;
63+
static const uint8_t D18 = 37;
64+
static const uint8_t D19 = 38;
65+
66+
#define VBAT_ENABLE (14) // Output LOW to enable reading of the BAT voltage.
67+
// https://wiki.seeedstudio.com/XIAO_BLE#q3-what-are-the-considerations-when-using-xiao-nrf52840-sense-for-battery-charging
68+
69+
#define PIN_CHARGING_CURRENT (22) // Battery Charging current
70+
// https://wiki.seeedstudio.com/XIAO_BLE#battery-charging-current
71+
72+
// Analog pins
73+
#define PIN_A0 (0)
74+
#define PIN_A1 (1)
75+
#define PIN_A2 (2)
76+
#define PIN_A3 (3)
77+
#define PIN_A4 (4)
78+
#define PIN_A5 (5)
79+
#define PIN_VBAT (35) // Read the BAT voltage.
80+
// https://wiki.seeedstudio.com/XIAO_BLE#q3-what-are-the-considerations-when-using-xiao-nrf52840-sense-for-battery-charging
81+
82+
static const uint8_t A0 = PIN_A0;
83+
static const uint8_t A1 = PIN_A1;
84+
static const uint8_t A2 = PIN_A2;
85+
static const uint8_t A3 = PIN_A3;
86+
static const uint8_t A4 = PIN_A4;
87+
static const uint8_t A5 = PIN_A5;
88+
static const uint8_t ADC_BAT = PIN_VBAT;
89+
90+
#define ADC_RESOLUTION (12)
91+
92+
// Other pins
93+
#define PIN_NFC1 (33)
94+
#define PIN_NFC2 (34)
95+
96+
// Serial interfaces
97+
#define PIN_SERIAL1_RX (7)
98+
#define PIN_SERIAL1_TX (6)
99+
100+
static const uint8_t RX = PIN_SERIAL1_RX;
101+
static const uint8_t TX = PIN_SERIAL1_TX;
102+
103+
#define PIN_SERIAL2_RX (33)
104+
#define PIN_SERIAL2_TX (34)
105+
106+
static const uint8_t RX1 = PIN_SERIAL2_RX;
107+
static const uint8_t TX1 = PIN_SERIAL2_TX;
108+
109+
// SPI Interfaces
110+
#define SPI_INTERFACES_COUNT (2)
111+
112+
#define PIN_SPI_MISO (9)
113+
#define PIN_SPI_MOSI (10)
114+
#define PIN_SPI_SCK (8)
115+
116+
static const uint8_t SS = 7;
117+
static const uint8_t MOSI = PIN_SPI_MOSI;
118+
static const uint8_t MISO = PIN_SPI_MISO;
119+
static const uint8_t SCK = PIN_SPI_SCK ;
120+
121+
#define PIN_SPI1_MISO (37)
122+
#define PIN_SPI1_MOSI (36)
123+
#define PIN_SPI1_SCK (38)
124+
125+
static const uint8_t MOSI1 = PIN_SPI1_MOSI;
126+
static const uint8_t MISO1 = PIN_SPI1_MISO;
127+
static const uint8_t SCK1 = PIN_SPI1_SCK ;
128+
129+
// Wire Interfaces
130+
#define WIRE_INTERFACES_COUNT (2)
131+
132+
#define PIN_WIRE_SDA (4)
133+
#define PIN_WIRE_SCL (5)
134+
135+
static const uint8_t SDA = PIN_WIRE_SDA;
136+
static const uint8_t SCL = PIN_WIRE_SCL;
137+
138+
#define PIN_WIRE1_SDA (17)
139+
#define PIN_WIRE1_SCL (16)
140+
#define PIN_LSM6DS3TR_C_POWER (15)
141+
#define PIN_LSM6DS3TR_C_INT1 (18)
142+
143+
// i2s Interfaces
144+
#define PIN_I2S_SCK (31)
145+
#define PIN_I2S_SD (30)
146+
#define PIN_I2S_WS (32)
147+
148+
static const uint8_t I2S_SCK = PIN_I2S_SCK;
149+
static const uint8_t I2S_SD = PIN_I2S_SD ;
150+
static const uint8_t I2S_WS = PIN_I2S_WS ;
151+
152+
// PDM Interfaces
153+
#define PIN_PDM_PWR (19)
154+
#define PIN_PDM_CLK (20)
155+
#define PIN_PDM_DIN (21)
156+
157+
// QSPI Pins
158+
#define PIN_QSPI_SCK (24)
159+
#define PIN_QSPI_CS (25)
160+
#define PIN_QSPI_IO0 (26)
161+
#define PIN_QSPI_IO1 (27)
162+
#define PIN_QSPI_IO2 (28)
163+
#define PIN_QSPI_IO3 (29)
164+
165+
// On-board QSPI Flash
166+
#define EXTERNAL_FLASH_DEVICES (P25Q16H)
167+
#define EXTERNAL_FLASH_USE_QSPI
168+
169+
#ifdef __cplusplus
170+
}
171+
#endif
172+
173+
/*----------------------------------------------------------------------------
174+
* Arduino objects - C++ only
175+
*----------------------------------------------------------------------------*/
176+
177+
#endif

0 commit comments

Comments
 (0)