Skip to content

Commit 91ce323

Browse files
authored
Add SparkFun XRP Controller (Beta) (earlephilhower#2823)
1 parent 2f82bfd commit 91ce323

File tree

7 files changed

+459
-0
lines changed

7 files changed

+459
-0
lines changed

boards.txt

Lines changed: 239 additions & 0 deletions
Large diffs are not rendered by default.

package/package_pico_index.template.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,9 @@
311311
{
312312
"name": "SparkFun IoT Node LoRaWAN"
313313
},
314+
{
315+
"name": "SparkFun XRP Controller (Beta)"
316+
},
314317
{
315318
"name": "Seeed INDICATOR RP2040"
316319
},
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"build": {
3+
"arduino": {
4+
"earlephilhower": {
5+
"boot2_source": "boot2_w25q080_2_padded_checksum.S",
6+
"usb_vid": "0x1B4F",
7+
"usb_pid": "0x0045"
8+
}
9+
},
10+
"core": "earlephilhower",
11+
"cpu": "cortex-m0plus",
12+
"extra_flags": "-DARDUINO_SPARKFUN_XRP_CONTROLLER_BETA -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 -DPICO_CYW43_SUPPORTED=1 -DCYW43_PIN_WL_DYNAMIC=1",
13+
"f_cpu": "133000000L",
14+
"hwids": [
15+
[
16+
"0x2E8A",
17+
"0x00C0"
18+
],
19+
[
20+
"0x1B4F",
21+
"0x0045"
22+
]
23+
],
24+
"mcu": "rp2040",
25+
"variant": "sparkfun_xrp_controller_beta"
26+
},
27+
"debug": {
28+
"jlink_device": "RP2040_M0_0",
29+
"openocd_target": "rp2040.cfg",
30+
"svd_path": "rp2040.svd"
31+
},
32+
"frameworks": [
33+
"arduino"
34+
],
35+
"name": "XRP Controller (Beta)",
36+
"upload": {
37+
"maximum_ram_size": 262144,
38+
"maximum_size": 2097152,
39+
"require_upload_port": true,
40+
"native_usb": true,
41+
"use_1200bps_touch": true,
42+
"wait_for_upload_port": false,
43+
"protocol": "picotool",
44+
"protocols": [
45+
"blackmagic",
46+
"cmsis-dap",
47+
"jlink",
48+
"raspberrypi-swd",
49+
"picotool",
50+
"picoprobe"
51+
]
52+
},
53+
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
54+
"vendor": "SparkFun"
55+
}

tools/makeboards.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,7 @@ def MakeBoardJSON(name, chip, vendor_name, product_name, vid, pid, pwr, boarddef
656656
MakeBoard("sparkfun_thingplusrp2040", "rp2040", "SparkFun", "Thing Plus RP2040", "0x1b4f", "0x0026", 250, "SPARKFUN_THINGPLUS_RP2040", 16, 0, "boot2_w25q080_2_padded_checksum")
657657
MakeBoard("sparkfun_thingplusrp2350", "rp2350", "SparkFun", "Thing Plus RP2350", "0x1b4f", "0x0038", 250, "SPARKFUN_THINGPLUS_RP2350", 16, 8, "none", ["PICO_CYW43_SUPPORTED=1", "CYW43_PIN_WL_DYNAMIC=1"])
658658
MakeBoard("sparkfun_iotnode_lorawanrp2350", "rp2350", "SparkFun", "IoT Node LoRaWAN", "0x1b4f", "0x0044", 250, "SPARKFUN_IOTNODE_LORAWAN_RP2350", 16, 8, "none")
659+
MakeBoard("sparkfun_xrp_controller_beta", "rp2040", "SparkFun", "XRP Controller (Beta)", "0x1b4f", "0x0045", 250, "SPARKFUN_XRP_CONTROLLER_BETA", 2, 0, "boot2_w25q080_2_padded_checksum", ["PICO_CYW43_SUPPORTED=1", "CYW43_PIN_WL_DYNAMIC=1"])
659660

660661
# Seeed
661662
MakeBoard("seeed_indicator_rp2040", "rp2040", "Seeed", "INDICATOR RP2040", "0x2886", "0x0050", 250, "SEEED_INDICATOR_RP2040", 2, 0, "boot2_w25q080_2_padded_checksum")
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
pinMode and digitalRead/Write for the Raspberry Pi Pico W RP2040
3+
Copyright (c) 2022 Earle F. Philhower, III <[email protected]>
4+
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Lesser General Public
7+
License as published by the Free Software Foundation; either
8+
version 2.1 of the License, or (at your option) any later version.
9+
10+
This library is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
Lesser General Public License for more details.
14+
15+
You should have received a copy of the GNU Lesser General Public
16+
License along with this library; if not, write to the Free Software
17+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18+
*/
19+
20+
#include "Arduino.h"
21+
#include <cyw43_wrappers.h>
22+
23+
extern "C" void pinMode(pin_size_t pin, PinMode mode) {
24+
cyw43_pinMode(pin, mode);
25+
}
26+
27+
extern "C" void digitalWrite(pin_size_t pin, PinStatus val) {
28+
cyw43_digitalWrite(pin, val);
29+
}
30+
31+
extern "C" PinStatus digitalRead(pin_size_t pin) {
32+
return cyw43_digitalRead(pin);
33+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
Initialize the Pico W WiFi driver
3+
4+
Copyright (c) 2022 Earle F. Philhower, III <[email protected]>
5+
6+
This library is free software; you can redistribute it and/or
7+
modify it under the terms of the GNU Lesser General Public
8+
License as published by the Free Software Foundation; either
9+
version 2.1 of the License, or (at your option) any later version.
10+
11+
This library is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
Lesser General Public License for more details.
15+
16+
You should have received a copy of the GNU Lesser General Public
17+
License along with this library; if not, write to the Free Software
18+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19+
*/
20+
21+
#include <cyw43_wrappers.h>
22+
23+
extern "C" void initVariant() {
24+
init_cyw43_wifi();
25+
}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#pragma once
2+
3+
#include <cyw43_wrappers.h>
4+
5+
// XRP default pin names
6+
#define MOTOR_L_IN_1 (6u)
7+
#define MOTOR_L_IN_2 (7u)
8+
#define MOTOR_R_IN_1 (14u)
9+
#define MOTOR_R_IN_2 (15u)
10+
#define MOTOR_3_IN_1 (2u)
11+
#define MOTOR_3_IN_2 (3u)
12+
#define MOTOR_4_IN_1 (10u)
13+
#define MOTOR_4_IN_2 (11u)
14+
#define MOTOR_L_ENCODER_A (4u)
15+
#define MOTOR_L_ENCODER_B (5u)
16+
#define MOTOR_R_ENCODER_A (12u)
17+
#define MOTOR_R_ENCODER_B (13u)
18+
#define MOTOR_3_ENCODER_A (0u)
19+
#define MOTOR_3_ENCODER_B (1u)
20+
#define MOTOR_4_ENCODER_A (8u)
21+
#define MOTOR_4_ENCODER_B (9u)
22+
#define SERVO_1 (16u)
23+
#define SERVO_2 (17u)
24+
#define I2C_SDA_1 (18u)
25+
#define I2C_SCL_1 (19u)
26+
#define DISTANCE_TRIGGER (20u)
27+
#define DISTANCE_ECHO (21u)
28+
#define LINE_L (26u)
29+
#define LINE_R (27u)
30+
#define BOARD_VIN_MEASURE (28u)
31+
#define BOARD_USER_BUTTON (22u)
32+
#define BOARD_LED (PIN_LED)
33+
34+
// XRP alternate pin names
35+
#define ML_IN_1 (6u)
36+
#define ML_IN_2 (7u)
37+
#define MR_IN_1 (14u)
38+
#define MR_IN_2 (15u)
39+
#define M3_IN_1 (2u)
40+
#define M3_IN_2 (3u)
41+
#define M4_IN_1 (10u)
42+
#define M4_IN_2 (11u)
43+
#define ML_ENC_A (4u)
44+
#define ML_ENC_B (5u)
45+
#define MR_ENC_A (12u)
46+
#define MR_ENC_B (13u)
47+
#define M3_ENC_A (0u)
48+
#define M3_ENC_B (1u)
49+
#define M4_ENC_A (8u)
50+
#define M4_ENC_B (9u)
51+
#define S1 (16u)
52+
#define S2 (17u)
53+
#define SDA_1 (18u)
54+
#define SCL_1 (19u)
55+
#define RANGE_TRIGGER (20u)
56+
#define RANGE_ECHO (21u)
57+
#define REFLECTANCE_L (26u)
58+
#define REFLECTANCE_R (27u)
59+
#define BRD_VIN (28u)
60+
#define BRD_USR_BTN (22u)
61+
#define BRD_LED (PIN_LED)
62+
63+
// LEDs
64+
#define PIN_LED (64u)
65+
66+
// Serial
67+
#define PIN_SERIAL1_TX (31u)
68+
#define PIN_SERIAL1_RX (31u)
69+
70+
#define PIN_SERIAL2_TX (31u)
71+
#define PIN_SERIAL2_RX (31u)
72+
73+
// SPI
74+
#define PIN_SPI0_MISO (31u)
75+
#define PIN_SPI0_MOSI (31u)
76+
#define PIN_SPI0_SCK (31u)
77+
#define PIN_SPI0_SS (31u)
78+
79+
#define PIN_SPI1_MISO (31u)
80+
#define PIN_SPI1_MOSI (31u)
81+
#define PIN_SPI1_SCK (31u)
82+
#define PIN_SPI1_SS (31u)
83+
84+
// Wire
85+
#define PIN_WIRE0_SDA (18u)
86+
#define PIN_WIRE0_SCL (19u)
87+
88+
#define PIN_WIRE1_SDA (31u)
89+
#define PIN_WIRE1_SCL (31u)
90+
91+
// XRP Beta Controller uses I2C1 for Qwiic connector, make that the default
92+
#ifndef __WIRE0_DEVICE
93+
#define __WIRE0_DEVICE i2c1
94+
#endif
95+
#ifndef __WIRE1_DEVICE
96+
#define __WIRE1_DEVICE i2c0
97+
#endif
98+
99+
#define SERIAL_HOWMANY (3u)
100+
#define SPI_HOWMANY (2u)
101+
#define WIRE_HOWMANY (2u)
102+
103+
#include "../generic/common.h"

0 commit comments

Comments
 (0)