Skip to content

Add SparkFun XRP Controller #2847

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
346 changes: 346 additions & 0 deletions boards.txt

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions package/package_pico_index.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,9 @@
{
"name": "SparkFun XRP Controller (Beta)"
},
{
"name": "SparkFun XRP Controller"
},
{
"name": "Seeed INDICATOR RP2040"
},
Expand Down
56 changes: 56 additions & 0 deletions tools/json/sparkfun_xrp_controller.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"build": {
"arduino": {
"earlephilhower": {
"boot2_source": "none.S",
"usb_vid": "0x1B4F",
"usb_pid": "0x0046"
}
},
"core": "earlephilhower",
"cpu": "cortex-m33",
"extra_flags": "-DARDUINO_SPARKFUN_XRP_CONTROLLER -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 -DPICO_CYW43_SUPPORTED=1 -DCYW43_PIN_WL_DYNAMIC=1",
"f_cpu": "150000000L",
"hwids": [
[
"0x2E8A",
"0x00C0"
],
[
"0x1B4F",
"0x0046"
]
],
"mcu": "rp2350",
"variant": "sparkfun_xrp_controller"
},
"debug": {
"jlink_device": "RP2350_0",
"openocd_target": "rp2350.cfg",
"svd_path": "rp2350.svd"
},
"frameworks": [
"arduino"
],
"name": "XRP Controller",
"upload": {
"maximum_ram_size": 524288,
"maximum_size": 16777216,
"require_upload_port": true,
"native_usb": true,
"use_1200bps_touch": true,
"wait_for_upload_port": false,
"protocol": "picotool",
"protocols": [
"blackmagic",
"cmsis-dap",
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
],
"psram_length": 8388608
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
"vendor": "SparkFun"
}
1 change: 1 addition & 0 deletions tools/makeboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,7 @@ def MakeBoardJSON(name, chip, vendor_name, product_name, vid, pid, pwr, boarddef
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"])
MakeBoard("sparkfun_iotnode_lorawanrp2350", "rp2350", "SparkFun", "IoT Node LoRaWAN", "0x1b4f", "0x0044", 250, "SPARKFUN_IOTNODE_LORAWAN_RP2350", 16, 8, "none")
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"])
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"])

# Seeed
MakeBoard("seeed_indicator_rp2040", "rp2040", "Seeed", "INDICATOR RP2040", "0x2886", "0x0050", 250, "SEEED_INDICATOR_RP2040", 2, 0, "boot2_w25q080_2_padded_checksum")
Expand Down
33 changes: 33 additions & 0 deletions variants/sparkfun_xrp_controller/digital.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
pinMode and digitalRead/Write for the Raspberry Pi Pico W RP2040
Copyright (c) 2022 Earle F. Philhower, III <earlephilhower@yahoo.com>

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include "Arduino.h"
#include <cyw43_wrappers.h>

extern "C" void pinMode(pin_size_t pin, PinMode mode) {
cyw43_pinMode(pin, mode);
}

extern "C" void digitalWrite(pin_size_t pin, PinStatus val) {
cyw43_digitalWrite(pin, val);
}

extern "C" PinStatus digitalRead(pin_size_t pin) {
return cyw43_digitalRead(pin);
}
34 changes: 34 additions & 0 deletions variants/sparkfun_xrp_controller/init.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
Initialize the Pico W WiFi driver

Copyright (c) 2022 Earle F. Philhower, III <earlephilhower@yahoo.com>

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include <cyw43_wrappers.h>

extern "C" void initVariant() {
static uint cyw43_pin_array[CYW43_PIN_INDEX_WL_COUNT] = {
26, // CYW43_PIN_INDEX_WL_REG_ON
29, // CYW43_PIN_INDEX_WL_DATA_OUT
29, // CYW43_PIN_INDEX_WL_DATA_IN
29, // CYW43_PIN_INDEX_WL_HOST_WAKE
28, // CYW43_PIN_INDEX_WL_CLOCK
27 // CYW43_PIN_INDEX_WL_CS
};
cyw43_set_pins_wl(cyw43_pin_array);
init_cyw43_wifi();
}
122 changes: 122 additions & 0 deletions variants/sparkfun_xrp_controller/pins_arduino.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
#pragma once

#define PICO_RP2350A 0

#include <cyw43_wrappers.h>

// XRP default pin names
#define MOTOR_L_IN_1 (34u)
#define MOTOR_L_IN_2 (35u)
#define MOTOR_R_IN_1 (32u)
#define MOTOR_R_IN_2 (33u)
#define MOTOR_3_IN_1 (20u)
#define MOTOR_3_IN_2 (21u)
#define MOTOR_4_IN_1 (10u)
#define MOTOR_4_IN_2 (11u)
#define MOTOR_L_ENCODER_A (30u)
#define MOTOR_L_ENCODER_B (31u)
#define MOTOR_R_ENCODER_A (24u)
#define MOTOR_R_ENCODER_B (25u)
#define MOTOR_3_ENCODER_A (22u)
#define MOTOR_3_ENCODER_B (23u)
#define MOTOR_4_ENCODER_A (2u)
#define MOTOR_4_ENCODER_B (3u)
#define MOTOR_L_CURRENT (40u)
#define MOTOR_R_CURRENT (43u)
#define MOTOR_3_CURRENT (41u)
#define MOTOR_4_CURRENT (42u)
#define SERVO_1 (6u)
#define SERVO_2 (9u)
#define SERVO_3 (7u)
#define SERVO_4 (8u)
#define I2C_SDA_0 (4u)
#define I2C_SCL_0 (5u)
#define I2C_SDA_1 (38u)
#define I2C_SCL_1 (39u)
#define DISTANCE_TRIGGER (0u)
#define DISTANCE_ECHO (1u)
#define LINE_L (44u)
#define LINE_R (45u)
#define BOARD_VIN_MEASURE (46u)
#define BOARD_USER_BUTTON (36u)
#define BOARD_NEOPIXEL (37u)
#define BOARD_LED (PIN_LED)

// XRP alternate pin names
#define ML_IN_1 (34u)
#define ML_IN_2 (35u)
#define MR_IN_1 (32u)
#define MR_IN_2 (33u)
#define M3_IN_1 (20u)
#define M3_IN_2 (21u)
#define M4_IN_1 (10u)
#define M4_IN_2 (11u)
#define ML_ENC_A (30u)
#define ML_ENC_B (31u)
#define MR_ENC_A (24u)
#define MR_ENC_B (25u)
#define M3_ENC_A (22u)
#define M3_ENC_B (23u)
#define M4_ENC_A (2u)
#define M4_ENC_B (3u)
#define ML_CUR (40u)
#define MR_CUR (43u)
#define M3_CUR (41u)
#define M4_CUR (42u)
#define S1 (6u)
#define S2 (9u)
#define S3 (7u)
#define S4 (8u)
#define SDA_0 (4u)
#define SCL_0 (5u)
#define SDA_1 (38u)
#define SCL_1 (39u)
#define RANGE_TRIGGER (0u)
#define RANGE_ECHO (1u)
#define REFLECTANCE_L (44u)
#define REFLECTANCE_R (45u)
#define BRD_VIN (46u)
#define BRD_USR_BTN (36u)
#define BRD_RGB_LED (37u)
#define BRD_LED (PIN_LED)

// LEDs
#define PIN_LED (64u)

#define PIN_NEOPIXEL (37)
#define NUM_NEOPIXEL (1)

// Serial
#define PIN_SERIAL1_TX (12u)
#define PIN_SERIAL1_RX (13u)

#define PIN_SERIAL2_TX (8u)
#define PIN_SERIAL2_RX (9u)

// SPI
#define PIN_SPI0_MISO (16u)
#define PIN_SPI0_MOSI (19u)
#define PIN_SPI0_SCK (18u)
#define PIN_SPI0_SS (17u)

#define PIN_SPI1_MISO (12u)
#define PIN_SPI1_MOSI (15u)
#define PIN_SPI1_SCK (14u)
#define PIN_SPI1_SS (13u)

// Wire
#define PIN_WIRE0_SDA (4u)
#define PIN_WIRE0_SCL (5u)

#define PIN_WIRE1_SDA (38u)
#define PIN_WIRE1_SCL (39u)

#define SERIAL_HOWMANY (3u)
#define SPI_HOWMANY (2u)
#define WIRE_HOWMANY (2u)

// PSRAM
#define RP2350_PSRAM_CS (47u)
#define RP2350_PSRAM_MAX_SCK_HZ (109*1000*1000)

#include "../generic/common.h"