Skip to content

Add SparkFun XRP Controller (Beta) #2823

New issue

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

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

Already on GitHub? # 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
239 changes: 239 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 @@ -305,6 +305,9 @@
{
"name": "SparkFun IoT Node LoRaWAN"
},
{
"name": "SparkFun XRP Controller (Beta)"
},
{
"name": "Seeed INDICATOR RP2040"
},
Expand Down
55 changes: 55 additions & 0 deletions tools/json/sparkfun_xrp_controller_beta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"build": {
"arduino": {
"earlephilhower": {
"boot2_source": "boot2_w25q080_2_padded_checksum.S",
"usb_vid": "0x1B4F",
"usb_pid": "0x0045"
}
},
"core": "earlephilhower",
"cpu": "cortex-m0plus",
"extra_flags": "-DARDUINO_SPARKFUN_XRP_CONTROLLER_BETA -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 -DPICO_CYW43_SUPPORTED=1 -DCYW43_PIN_WL_DYNAMIC=1",
"f_cpu": "133000000L",
"hwids": [
[
"0x2E8A",
"0x00C0"
],
[
"0x1B4F",
"0x0045"
]
],
"mcu": "rp2040",
"variant": "sparkfun_xrp_controller_beta"
},
"debug": {
"jlink_device": "RP2040_M0_0",
"openocd_target": "rp2040.cfg",
"svd_path": "rp2040.svd"
},
"frameworks": [
"arduino"
],
"name": "XRP Controller (Beta)",
"upload": {
"maximum_ram_size": 262144,
"maximum_size": 2097152,
"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"
]
},
"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 @@ -652,6 +652,7 @@ def MakeBoardJSON(name, chip, vendor_name, product_name, vid, pid, pwr, boarddef
MakeBoard("sparkfun_thingplusrp2040", "rp2040", "SparkFun", "Thing Plus RP2040", "0x1b4f", "0x0026", 250, "SPARKFUN_THINGPLUS_RP2040", 16, 0, "boot2_w25q080_2_padded_checksum")
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"])

# 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_beta/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);
}
25 changes: 25 additions & 0 deletions variants/sparkfun_xrp_controller_beta/init.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
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() {
init_cyw43_wifi();
}
103 changes: 103 additions & 0 deletions variants/sparkfun_xrp_controller_beta/pins_arduino.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#pragma once

#include <cyw43_wrappers.h>

// XRP default pin names
#define MOTOR_L_IN_1 (6u)
#define MOTOR_L_IN_2 (7u)
#define MOTOR_R_IN_1 (14u)
#define MOTOR_R_IN_2 (15u)
#define MOTOR_3_IN_1 (2u)
#define MOTOR_3_IN_2 (3u)
#define MOTOR_4_IN_1 (10u)
#define MOTOR_4_IN_2 (11u)
#define MOTOR_L_ENCODER_A (4u)
#define MOTOR_L_ENCODER_B (5u)
#define MOTOR_R_ENCODER_A (12u)
#define MOTOR_R_ENCODER_B (13u)
#define MOTOR_3_ENCODER_A (0u)
#define MOTOR_3_ENCODER_B (1u)
#define MOTOR_4_ENCODER_A (8u)
#define MOTOR_4_ENCODER_B (9u)
#define SERVO_1 (16u)
#define SERVO_2 (17u)
#define I2C_SDA_1 (18u)
#define I2C_SCL_1 (19u)
#define DISTANCE_TRIGGER (20u)
#define DISTANCE_ECHO (21u)
#define LINE_L (26u)
#define LINE_R (27u)
#define BOARD_VIN_MEASURE (28u)
#define BOARD_USER_BUTTON (22u)
#define BOARD_LED (PIN_LED)

// XRP alternate pin names
#define ML_IN_1 (6u)
#define ML_IN_2 (7u)
#define MR_IN_1 (14u)
#define MR_IN_2 (15u)
#define M3_IN_1 (2u)
#define M3_IN_2 (3u)
#define M4_IN_1 (10u)
#define M4_IN_2 (11u)
#define ML_ENC_A (4u)
#define ML_ENC_B (5u)
#define MR_ENC_A (12u)
#define MR_ENC_B (13u)
#define M3_ENC_A (0u)
#define M3_ENC_B (1u)
#define M4_ENC_A (8u)
#define M4_ENC_B (9u)
#define S1 (16u)
#define S2 (17u)
#define SDA_1 (18u)
#define SCL_1 (19u)
#define RANGE_TRIGGER (20u)
#define RANGE_ECHO (21u)
#define REFLECTANCE_L (26u)
#define REFLECTANCE_R (27u)
#define BRD_VIN (28u)
#define BRD_USR_BTN (22u)
#define BRD_LED (PIN_LED)

// LEDs
#define PIN_LED (64u)

// Serial
#define PIN_SERIAL1_TX (31u)
#define PIN_SERIAL1_RX (31u)

#define PIN_SERIAL2_TX (31u)
#define PIN_SERIAL2_RX (31u)

// SPI
#define PIN_SPI0_MISO (31u)
#define PIN_SPI0_MOSI (31u)
#define PIN_SPI0_SCK (31u)
#define PIN_SPI0_SS (31u)

#define PIN_SPI1_MISO (31u)
#define PIN_SPI1_MOSI (31u)
#define PIN_SPI1_SCK (31u)
#define PIN_SPI1_SS (31u)

// Wire
#define PIN_WIRE0_SDA (18u)
#define PIN_WIRE0_SCL (19u)

#define PIN_WIRE1_SDA (31u)
#define PIN_WIRE1_SCL (31u)

// XRP Beta Controller uses I2C1 for Qwiic connector, make that the default
#ifndef __WIRE0_DEVICE
#define __WIRE0_DEVICE i2c1
#endif
#ifndef __WIRE1_DEVICE
#define __WIRE1_DEVICE i2c0
#endif

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

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