Skip to content

Commit d9d556b

Browse files
authored
Add SparkFun XRP Controller (#2847)
1 parent 5bd1a3a commit d9d556b

File tree

7 files changed

+595
-0
lines changed

7 files changed

+595
-0
lines changed

boards.txt

Lines changed: 346 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
@@ -317,6 +317,9 @@
317317
{
318318
"name": "SparkFun XRP Controller (Beta)"
319319
},
320+
{
321+
"name": "SparkFun XRP Controller"
322+
},
320323
{
321324
"name": "Seeed INDICATOR RP2040"
322325
},
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"build": {
3+
"arduino": {
4+
"earlephilhower": {
5+
"boot2_source": "none.S",
6+
"usb_vid": "0x1B4F",
7+
"usb_pid": "0x0046"
8+
}
9+
},
10+
"core": "earlephilhower",
11+
"cpu": "cortex-m33",
12+
"extra_flags": "-DARDUINO_SPARKFUN_XRP_CONTROLLER -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 -DPICO_CYW43_SUPPORTED=1 -DCYW43_PIN_WL_DYNAMIC=1",
13+
"f_cpu": "150000000L",
14+
"hwids": [
15+
[
16+
"0x2E8A",
17+
"0x00C0"
18+
],
19+
[
20+
"0x1B4F",
21+
"0x0046"
22+
]
23+
],
24+
"mcu": "rp2350",
25+
"variant": "sparkfun_xrp_controller"
26+
},
27+
"debug": {
28+
"jlink_device": "RP2350_0",
29+
"openocd_target": "rp2350.cfg",
30+
"svd_path": "rp2350.svd"
31+
},
32+
"frameworks": [
33+
"arduino"
34+
],
35+
"name": "XRP Controller",
36+
"upload": {
37+
"maximum_ram_size": 524288,
38+
"maximum_size": 16777216,
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+
"psram_length": 8388608
53+
},
54+
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
55+
"vendor": "SparkFun"
56+
}

tools/makeboards.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,7 @@ def MakeBoardJSON(name, chip, vendor_name, product_name, vid, pid, pwr, boarddef
658658
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"])
659659
MakeBoard("sparkfun_iotnode_lorawanrp2350", "rp2350", "SparkFun", "IoT Node LoRaWAN", "0x1b4f", "0x0044", 250, "SPARKFUN_IOTNODE_LORAWAN_RP2350", 16, 8, "none")
660660
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"])
661+
MakeBoard("sparkfun_xrp_controller", "rp2350", "SparkFun", "XRP Controller", "0x1b4f", "0x0046", 250, "SPARKFUN_XRP_CONTROLLER", 16, 8, "none", ["PICO_CYW43_SUPPORTED=1", "CYW43_PIN_WL_DYNAMIC=1"])
661662

662663
# Seeed
663664
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: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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+
static uint cyw43_pin_array[CYW43_PIN_INDEX_WL_COUNT] = {
25+
26, // CYW43_PIN_INDEX_WL_REG_ON
26+
29, // CYW43_PIN_INDEX_WL_DATA_OUT
27+
29, // CYW43_PIN_INDEX_WL_DATA_IN
28+
29, // CYW43_PIN_INDEX_WL_HOST_WAKE
29+
28, // CYW43_PIN_INDEX_WL_CLOCK
30+
27 // CYW43_PIN_INDEX_WL_CS
31+
};
32+
cyw43_set_pins_wl(cyw43_pin_array);
33+
init_cyw43_wifi();
34+
}
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
#pragma once
2+
3+
#define PICO_RP2350A 0
4+
5+
#include <cyw43_wrappers.h>
6+
7+
// XRP default pin names
8+
#define MOTOR_L_IN_1 (34u)
9+
#define MOTOR_L_IN_2 (35u)
10+
#define MOTOR_R_IN_1 (32u)
11+
#define MOTOR_R_IN_2 (33u)
12+
#define MOTOR_3_IN_1 (20u)
13+
#define MOTOR_3_IN_2 (21u)
14+
#define MOTOR_4_IN_1 (10u)
15+
#define MOTOR_4_IN_2 (11u)
16+
#define MOTOR_L_ENCODER_A (30u)
17+
#define MOTOR_L_ENCODER_B (31u)
18+
#define MOTOR_R_ENCODER_A (24u)
19+
#define MOTOR_R_ENCODER_B (25u)
20+
#define MOTOR_3_ENCODER_A (22u)
21+
#define MOTOR_3_ENCODER_B (23u)
22+
#define MOTOR_4_ENCODER_A (2u)
23+
#define MOTOR_4_ENCODER_B (3u)
24+
#define MOTOR_L_CURRENT (40u)
25+
#define MOTOR_R_CURRENT (43u)
26+
#define MOTOR_3_CURRENT (41u)
27+
#define MOTOR_4_CURRENT (42u)
28+
#define SERVO_1 (6u)
29+
#define SERVO_2 (9u)
30+
#define SERVO_3 (7u)
31+
#define SERVO_4 (8u)
32+
#define I2C_SDA_0 (4u)
33+
#define I2C_SCL_0 (5u)
34+
#define I2C_SDA_1 (38u)
35+
#define I2C_SCL_1 (39u)
36+
#define DISTANCE_TRIGGER (0u)
37+
#define DISTANCE_ECHO (1u)
38+
#define LINE_L (44u)
39+
#define LINE_R (45u)
40+
#define BOARD_VIN_MEASURE (46u)
41+
#define BOARD_USER_BUTTON (36u)
42+
#define BOARD_NEOPIXEL (37u)
43+
#define BOARD_LED (PIN_LED)
44+
45+
// XRP alternate pin names
46+
#define ML_IN_1 (34u)
47+
#define ML_IN_2 (35u)
48+
#define MR_IN_1 (32u)
49+
#define MR_IN_2 (33u)
50+
#define M3_IN_1 (20u)
51+
#define M3_IN_2 (21u)
52+
#define M4_IN_1 (10u)
53+
#define M4_IN_2 (11u)
54+
#define ML_ENC_A (30u)
55+
#define ML_ENC_B (31u)
56+
#define MR_ENC_A (24u)
57+
#define MR_ENC_B (25u)
58+
#define M3_ENC_A (22u)
59+
#define M3_ENC_B (23u)
60+
#define M4_ENC_A (2u)
61+
#define M4_ENC_B (3u)
62+
#define ML_CUR (40u)
63+
#define MR_CUR (43u)
64+
#define M3_CUR (41u)
65+
#define M4_CUR (42u)
66+
#define S1 (6u)
67+
#define S2 (9u)
68+
#define S3 (7u)
69+
#define S4 (8u)
70+
#define SDA_0 (4u)
71+
#define SCL_0 (5u)
72+
#define SDA_1 (38u)
73+
#define SCL_1 (39u)
74+
#define RANGE_TRIGGER (0u)
75+
#define RANGE_ECHO (1u)
76+
#define REFLECTANCE_L (44u)
77+
#define REFLECTANCE_R (45u)
78+
#define BRD_VIN (46u)
79+
#define BRD_USR_BTN (36u)
80+
#define BRD_RGB_LED (37u)
81+
#define BRD_LED (PIN_LED)
82+
83+
// LEDs
84+
#define PIN_LED (64u)
85+
86+
#define PIN_NEOPIXEL (37)
87+
#define NUM_NEOPIXEL (1)
88+
89+
// Serial
90+
#define PIN_SERIAL1_TX (12u)
91+
#define PIN_SERIAL1_RX (13u)
92+
93+
#define PIN_SERIAL2_TX (8u)
94+
#define PIN_SERIAL2_RX (9u)
95+
96+
// SPI
97+
#define PIN_SPI0_MISO (16u)
98+
#define PIN_SPI0_MOSI (19u)
99+
#define PIN_SPI0_SCK (18u)
100+
#define PIN_SPI0_SS (17u)
101+
102+
#define PIN_SPI1_MISO (12u)
103+
#define PIN_SPI1_MOSI (15u)
104+
#define PIN_SPI1_SCK (14u)
105+
#define PIN_SPI1_SS (13u)
106+
107+
// Wire
108+
#define PIN_WIRE0_SDA (4u)
109+
#define PIN_WIRE0_SCL (5u)
110+
111+
#define PIN_WIRE1_SDA (38u)
112+
#define PIN_WIRE1_SCL (39u)
113+
114+
#define SERIAL_HOWMANY (3u)
115+
#define SPI_HOWMANY (2u)
116+
#define WIRE_HOWMANY (2u)
117+
118+
// PSRAM
119+
#define RP2350_PSRAM_CS (47u)
120+
#define RP2350_PSRAM_MAX_SCK_HZ (109*1000*1000)
121+
122+
#include "../generic/common.h"

0 commit comments

Comments
 (0)