Skip to content

Commit 88c717d

Browse files
authored
Merge pull request #10 from adafruit/rp2350_adalogger
adding rp2350 adalogger
2 parents cc96a13 + 407bdc9 commit 88c717d

File tree

46 files changed

+472
-45
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+472
-45
lines changed

boards.txt

+267-2
Large diffs are not rendered by default.

cores/rp2040/Arduino.h

+13
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,23 @@
2727
#include "RP2040Version.h"
2828
#include "api/ArduinoAPI.h"
2929
#include "api/itoa.h" // ARM toolchain doesn't provide itoa etc, provide them
30+
#include <pico.h>
31+
#undef PICO_RP2350A // Set in the RP2350 SDK boards file, overridden in the variant pins_arduino.h
3032
#include <pins_arduino.h>
3133
#include <hardware/gpio.h> // Required for the port*Register macros
3234
#include "debug_internal.h"
3335

36+
// Chip sanity checking. SDK uses interesting way of separating 2350A from 2350B, see https://github.com/raspberrypi/pico-sdk/issues/2364
37+
#if (!defined(PICO_RP2040) && !defined(PICO_RP2350)) || defined(PICO_RP2040) && defined(PICO_RP2350)
38+
#error Invalid core definition. Either PICO_RP2040 or PICO_RP2350 must be defined.
39+
#endif
40+
#if defined(PICO_RP2350) && !defined(PICO_RP2350A)
41+
#error Invalid RP2350 definition. Need to set PICO_RP2350A=0/1 for A/B variant
42+
#endif
43+
#if defined(PICO_RP2350B)
44+
#error Do not define PICO_RP2350B. Use PICO_RP2350A=0 to indicate RP2350B. See the SDK for more details
45+
#endif
46+
3447
// Try and make the best of the old Arduino abs() macro. When in C++, use
3548
// the sane std::abs() call, but for C code use their macro since stdlib abs()
3649
// is int but their macro "works" for everything (with potential side effects)

cores/rp2040/IPAddress.h

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
#include "api/IPAddress.h"
2+
using arduino::IPAddress;

cores/rp2040/SerialUART.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ extern void serialEvent1() __attribute__((weak));
3232
extern void serialEvent2() __attribute__((weak));
3333

3434
bool SerialUART::setRX(pin_size_t pin) {
35-
#if defined(PICO_RP2350B)
35+
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
3636
constexpr uint64_t valid[2] = { __bitset({1, 3, 13, 15, 17, 19, 29, 31, 33, 35, 45, 47}) /* UART0 */,
3737
__bitset({5, 7, 9, 11, 21, 23, 25, 27, 37, 39, 41, 43}) /* UART1 */
3838
};
@@ -64,7 +64,7 @@ bool SerialUART::setRX(pin_size_t pin) {
6464
}
6565

6666
bool SerialUART::setTX(pin_size_t pin) {
67-
#if defined(PICO_RP2350B)
67+
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
6868
constexpr uint64_t valid[2] = { __bitset({0, 2, 12, 14, 16, 18, 28, 30, 32, 34, 44, 46}) /* UART0 */,
6969
__bitset({4, 6, 8, 10, 20, 22, 24, 26, 36, 38, 40, 42}) /* UART1 */
7070
};
@@ -95,7 +95,7 @@ bool SerialUART::setTX(pin_size_t pin) {
9595
}
9696

9797
bool SerialUART::setRTS(pin_size_t pin) {
98-
#ifdef PICO_RP2350B
98+
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
9999
constexpr uint64_t valid[2] = { __bitset({3, 15, 19, 31, 35, 47}) /* UART0 */,
100100
__bitset({7, 11, 23, 27, 39, 43}) /* UART1 */
101101
};
@@ -122,7 +122,7 @@ bool SerialUART::setRTS(pin_size_t pin) {
122122
}
123123

124124
bool SerialUART::setCTS(pin_size_t pin) {
125-
#ifdef PICO_RP2350B
125+
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
126126
constexpr uint64_t valid[2] = { __bitset({2, 14, 18, 30, 34, 46}) /* UART0 */,
127127
__bitset({6, 10, 22, 26, 38, 42}) /* UART1 */
128128
};
@@ -182,7 +182,7 @@ static void _uart1IRQ();
182182
// Does the selected TX/RX need UART_AUX function (rp2350)
183183
static gpio_function_t __gpioFunction(int pin) {
184184
switch (pin) {
185-
#if defined(PICO_RP2350) || defined(PICO_RP2350B)
185+
#if defined(PICO_RP2350) && !PICO_RP2350A
186186
case 2:
187187
case 3:
188188
case 6:

docs/adc.rst

+7-6
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ need to be periodically sampled to be read by applications, easily, such as:
1212
* Light dependent resistors (LDR), etc.
1313

1414

15-
Up to 4 analog samples can be recorded by the hardware (``A0`` ... ``A3``), and all
16-
recording is done at 16-bit levels (but be aware that the ADC in the Pico will only
17-
ever return values between 0...4095).
15+
Up to 4 (or 8 in the case of the RP2350B) analog samples can be recorded by the
16+
hardware (``A0`` ... ``A3``), and all recording is done at 16-bit levels (but be
17+
aware that the ADC in the Pico will only ever return values between 0...4095).
1818

1919
The interface for the ``ADCInput`` device is very similar to the ``I2S`` input
2020
device, and most code can be ported simply by instantiating a ``ADCInput``
@@ -26,11 +26,12 @@ allowed while in use.
2626
ADC Input API
2727
-------------
2828

29-
ADCInput(pin0 [, pin1, pin2, pin3])
29+
ADCInput(pin0 [, pin1, pin2, pin3[, pin4, pin5, pin6, pin7])
3030
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3131
Creates an ADC input object which will record the pins specified in the code.
32-
Only pins ``A0`` ... ``A3`` can be used, and they must be specified in increasing
33-
order (i.e. ``ADCInput(A0, A1);`` is valid, but ``ADCInput(A1, A0)`` is not.
32+
Only pins ``A0`` ... ``A3`` (``A7`` on RP2350B) can be used, and they must be
33+
specified in increasing order (i.e. ``ADCInput(A0, A1);`` is valid,
34+
but ``ADCInput(A1, A0)`` is not.
3435

3536
bool setBuffers(size_t buffers, size_t bufferWords)
3637
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

docs/contrib.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ For only RP2350A variants (using the compile options, not the onboard ID registe
112112

113113
.. code:: cpp
114114
115-
#if defined(PICO_RP2350) && !defined(PICO_RP2350B)
115+
#if defined(PICO_RP2350A) && PICO_RP2350A
116116
...RP2350A only code...
117117
#endif
118118
@@ -121,7 +121,7 @@ and not the chip ID register):
121121

122122
.. code:: cpp
123123
124-
#if defined(PICO_RP2350B)
124+
#if defined(PICO_RP2350A) && !PICO_RP2350A
125125
...48-GPIO version code here
126126
#endif
127127

libraries/ADCInput/src/ADCInput.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ bool ADCInput::setBuffers(size_t buffers, size_t bufferWords) {
4949

5050
int ADCInput::_mask(pin_size_t p) {
5151
switch (p) {
52-
#if !defined(PICO_RP2350B)
52+
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
5353
case 26: return 1;
5454
case 27: return 2;
5555
case 28: return 4;
@@ -106,7 +106,7 @@ bool ADCInput::begin() {
106106
// Set up the GPIOs to go to ADC
107107
adc_init();
108108
int cnt = 0;
109-
#if !defined(PICO_RP2350B)
109+
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
110110
int startpin = 26;
111111
int maxpin = 29;
112112
#else

libraries/SPI/src/SPI.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ void SPIClassRP2040::abortAsync() {
263263

264264

265265
bool SPIClassRP2040::setRX(pin_size_t pin) {
266-
#ifdef PICO_RP2350B
266+
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
267267
constexpr uint64_t valid[2] = { __bitset({0, 4, 16, 20, 32, 26}) /* SPI0 */,
268268
__bitset({8, 12, 24, 28, 40, 44}) /* SPI1 */
269269
};
@@ -290,7 +290,7 @@ bool SPIClassRP2040::setRX(pin_size_t pin) {
290290
}
291291

292292
bool SPIClassRP2040::setCS(pin_size_t pin) {
293-
#ifdef PICO_RP2350B
293+
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
294294
constexpr uint64_t valid[2] = { __bitset({1, 5, 17, 21, 33, 37}) /* SPI0 */,
295295
__bitset({9, 13, 25, 29, 41, 45}) /* SPI1 */
296296
};
@@ -317,7 +317,7 @@ bool SPIClassRP2040::setCS(pin_size_t pin) {
317317
}
318318

319319
bool SPIClassRP2040::setSCK(pin_size_t pin) {
320-
#ifdef PICO_RP2350B
320+
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
321321
constexpr uint64_t valid[2] = { __bitset({2, 6, 18, 22, 34, 38}) /* SPI0 */,
322322
__bitset({10, 14, 26, 30, 42, 46}) /* SPI1 */
323323
};
@@ -344,7 +344,7 @@ bool SPIClassRP2040::setSCK(pin_size_t pin) {
344344
}
345345

346346
bool SPIClassRP2040::setTX(pin_size_t pin) {
347-
#ifdef PICO_RP2350B
347+
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
348348
constexpr uint64_t valid[2] = { __bitset({3, 7, 19, 23, 35, 39}) /* SPI0 */,
349349
__bitset({11, 15, 27, 31, 43, 47}) /* SPI1 */
350350
};

libraries/SPI/src/SPIHelper.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class SPIHelper {
9898
return (reverseByte(w & 0xff) << 8) | (reverseByte(w >> 8));
9999
}
100100

101-
#ifdef PICO_RP2350B
101+
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
102102
static constexpr int GPIOIRQREGS = 6;
103103
#else
104104
static constexpr int GPIOIRQREGS = 4;

libraries/SPISlave/src/SPISlave.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ inline spi_cpha_t SPISlaveClass::cpha(SPISettings _spis) {
7979
}
8080

8181
bool SPISlaveClass::setRX(pin_size_t pin) {
82-
#ifdef PICO_RP2350B
82+
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
8383
constexpr uint64_t valid[2] = { __bitset({0, 4, 16, 20, 32, 26}) /* SPI0 */,
8484
__bitset({8, 12, 24, 28, 40, 44}) /* SPI1 */
8585
};
@@ -106,7 +106,7 @@ bool SPISlaveClass::setRX(pin_size_t pin) {
106106
}
107107

108108
bool SPISlaveClass::setCS(pin_size_t pin) {
109-
#ifdef PICO_RP2350B
109+
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
110110
constexpr uint64_t valid[2] = { __bitset({1, 5, 17, 21, 33, 37}) /* SPI0 */,
111111
__bitset({9, 13, 25, 29, 41, 45}) /* SPI1 */
112112
};
@@ -133,7 +133,7 @@ bool SPISlaveClass::setCS(pin_size_t pin) {
133133
}
134134

135135
bool SPISlaveClass::setSCK(pin_size_t pin) {
136-
#ifdef PICO_RP2350B
136+
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
137137
constexpr uint64_t valid[2] = { __bitset({2, 6, 18, 22, 34, 38}) /* SPI0 */,
138138
__bitset({10, 14, 26, 30, 42, 46}) /* SPI1 */
139139
};
@@ -160,7 +160,7 @@ bool SPISlaveClass::setSCK(pin_size_t pin) {
160160
}
161161

162162
bool SPISlaveClass::setTX(pin_size_t pin) {
163-
#ifdef PICO_RP2350B
163+
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
164164
constexpr uint64_t valid[2] = { __bitset({3, 7, 19, 23, 35, 39}) /* SPI0 */,
165165
__bitset({11, 15, 27, 31, 43, 47}) /* SPI1 */
166166
};

libraries/Wire/src/Wire.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ TwoWire::TwoWire(i2c_inst_t *i2c, pin_size_t sda, pin_size_t scl) {
4949
}
5050

5151
bool TwoWire::setSDA(pin_size_t pin) {
52-
#ifdef PICO_RP2350B
52+
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
5353
constexpr uint64_t valid[2] = { __bitset({0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44}) /* I2C0 */,
5454
__bitset({2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46}) /* I2C1 */
5555
};
@@ -76,7 +76,7 @@ bool TwoWire::setSDA(pin_size_t pin) {
7676
}
7777

7878
bool TwoWire::setSCL(pin_size_t pin) {
79-
#ifdef PICO_RP2350B
79+
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
8080
constexpr uint64_t valid[2] = { __bitset({1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45}) /* I2C0 */,
8181
__bitset({3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47}) /* I2C1 */
8282
};

libraries/lwIP_Ethernet/src/LwipEthernet.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ void __removeEthernetPacketHandler(int id) {
7575
}
7676

7777
#define GPIOSTACKSIZE 8
78-
#ifdef PICO_RP2350B
78+
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
7979
#define GPIOIRQREGS 6
8080
#define GPIOIRQREGSINIT 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff
8181
#else

package/package_pico_index.template.json

+3
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@
8080
{
8181
"name": "Adafruit KB2040"
8282
},
83+
{
84+
"name": "Adafruit Feather RP2350 Adalogger"
85+
},
8386
{
8487
"name": "Adafruit Feather RP2350 HSTX"
8588
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"build": {
3+
"arduino": {
4+
"earlephilhower": {
5+
"boot2_source": "none.S",
6+
"usb_vid": "0x239A",
7+
"usb_pid": "0x816D"
8+
}
9+
},
10+
"core": "earlephilhower",
11+
"cpu": "cortex-m33",
12+
"extra_flags": "-DARDUINO_ADAFRUIT_FEATHER_RP2350_ADALOGGER -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 ",
13+
"f_cpu": "150000000L",
14+
"hwids": [
15+
[
16+
"0x2E8A",
17+
"0x00C0"
18+
],
19+
[
20+
"0x239A",
21+
"0x816D"
22+
]
23+
],
24+
"mcu": "rp2350",
25+
"variant": "adafruit_feather_rp2350_adalogger"
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": "Feather RP2350 Adalogger",
36+
"upload": {
37+
"maximum_ram_size": 524288,
38+
"maximum_size": 8388608,
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": "Adafruit"
55+
}

tools/makeboards.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def BuildPSRAMFreq(name):
8585
print("%s.menu.psramfreq.freq%d.build.psram_freq=-DRP2350_PSRAM_MAX_SCK_HZ=%d" % (name, s, s * 1000000))
8686

8787
def BuildRP2350Variant(name):
88-
for l in [ ("RP2350A", "-DPICO_RP2350A=1"), ("RP2530B", "-DPICO_RP2350B=1") ]:
88+
for l in [ ("RP2350A", "-D__PICO_RP2350A=1"), ("RP2530B", "-D__PICO_RP2350A=0") ]:
8989
print("%s.menu.variantchip.%s=%s" % (name, l[0], l[0]))
9090
print("%s.menu.variantchip.%s.build.variantdefines=%s" % (name, l[0], l[1]))
9191

@@ -519,6 +519,7 @@ def MakeBoardJSON(name, chip, vendor_name, product_name, vid, pid, pwr, boarddef
519519
MakeBoard("adafruit_trinkeyrp2040qt", "rp2040", "Adafruit", "Trinkey RP2040 QT", "0x239a", "0x8109", 250, "ADAFRUIT_TRINKEYQT_RP2040", 8, 0, "boot2_w25q080_2_padded_checksum")
520520
MakeBoard("adafruit_macropad2040", "rp2040", "Adafruit", "MacroPad RP2040", "0x239a", "0x8107", 250, "ADAFRUIT_MACROPAD_RP2040", 8, 0, "boot2_w25q080_2_padded_checksum")
521521
MakeBoard("adafruit_kb2040", "rp2040", "Adafruit", "KB2040", "0x239a", "0x8105", 250, "ADAFRUIT_KB2040_RP2040", 8, 0, "boot2_w25q080_2_padded_checksum")
522+
MakeBoard("adafruit_feather_rp2350_adalogger", "rp2350", "Adafruit", "Feather RP2350 Adalogger", "0x239a", "0x816D", 250, "ADAFRUIT_FEATHER_RP2350_ADALOGGER", 8, 0, "none")
522523
MakeBoard("adafruit_feather_rp2350_hstx", "rp2350", "Adafruit", "Feather RP2350 HSTX", "0x239a", "0x814f", 250, "ADAFRUIT_FEATHER_RP2350_HSTX", 8, 0, "none")
523524
MakeBoard("adafruit_floppsy", "rp2040", "Adafruit", "Floppsy", "0x239a", "0x8151", 250, "ADAFRUIT_FLOPPSY_RP2040", 16, 0, "boot2_w25q080_2_padded_checksum")
524525
MakeBoard("adafruit_metro_rp2350", "rp2350", "Adafruit", "Metro RP2350", "0x239a", "0x814d", 250, "ADAFRUIT_METRO_RP2350", 16, 0, "none")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#pragma once
2+
3+
#define PICO_RP2350A 1
4+
5+
// LEDs
6+
#define PIN_LED (7u)
7+
8+
#define PIN_NEOPIXEL (21u)
9+
#define NUM_NEOPIXEL (1)
10+
11+
// SD Card connector
12+
#define PIN_CARD_DETECT (13u)
13+
#define PIN_SD_CLK (14u)
14+
#define PIN_SD_CMD_MOSI (15u)
15+
#define PIN_SD_DAT0_MISO (16u)
16+
#define PIN_SD_DAT1 (17u)
17+
#define PIN_SD_DAT2 (18u)
18+
#define PIN_SD_DAT3_CS (19u)
19+
20+
// UARTs
21+
#define PIN_SERIAL1_TX (0u)
22+
#define PIN_SERIAL1_RX (1u)
23+
#define PIN_SERIAL2_TX (99u) // not pinned out
24+
#define PIN_SERIAL2_RX (99u)
25+
26+
// SPI
27+
#define PIN_SPI0_MISO (20u)
28+
#define PIN_SPI0_MOSI (23u)
29+
#define PIN_SPI0_SCK (22u)
30+
#define PIN_SPI0_SS (13u)
31+
#define __SPI0_DEVICE spi0
32+
33+
// SPI1 for SD card
34+
#define PIN_SPI1_MISO PIN_SD_DAT0_MISO
35+
#define PIN_SPI1_MOSI PIN_SD_CMD_MOSI
36+
#define PIN_SPI1_SCK PIN_SD_CLK
37+
#define PIN_SPI1_SS PIN_SD_DAT3_CS
38+
#define __SPI1_DEVICE spi1
39+
40+
// Wire
41+
#define __WIRE0_DEVICE i2c0
42+
#define PIN_WIRE0_SDA (2u)
43+
#define PIN_WIRE0_SCL (3u)
44+
45+
#define __WIRE1_DEVICE i2c1
46+
#define PIN_WIRE1_SDA (31u) // not pinned out
47+
#define PIN_WIRE1_SCL (31u)
48+
49+
#define SERIAL_HOWMANY (1u)
50+
#define SPI_HOWMANY (2u)
51+
#define WIRE_HOWMANY (1u)
52+
53+
// PSRAM
54+
#define RP2350_PSRAM_CS (8u)
55+
#define RP2350_PSRAM_MAX_SCK_HZ (109*1000*1000)
56+
57+
#include "../generic/common.h"

variants/adafruit_feather_rp2350_hstx/pins_arduino.h

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#pragma once
22

3+
#define PICO_RP2350A 1
4+
35
// LEDs
46
#define PIN_LED (7u)
57

0 commit comments

Comments
 (0)