8000 Initial Arduino Nano RP2040 Connect support (#212) · Robotonics/arduino-pico@6afcf58 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6afcf58

Browse files
Initial Arduino Nano RP2040 Connect support (earlephilhower#212)
Thanks to @Claupio for the bringup! Reference earlephilhower#208
1 parent 30704a7 commit 6afcf58

File tree

7 files changed

+609
-0
lines changed

7 files changed

+609
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ See https://arduino-pico.readthedocs.io/en/latest/ along with the examples for m
1717
* Adafruit QTPy RP2040
1818
* Adafruit STEMMA Friend RP2040
1919
* Adafruit Trinkey RP2040 QT
20+
* Arduino Nano RP2040 Connect (preliminary)
2021
* SparkFun ProMicro RP2040
2122
* Generic (configurable flash, I/O pins)
2223

boards.txt

Lines changed: 388 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
@@ -38,6 +38,9 @@
3838
{
3939
"name": "Adafruit Trinkey RP2040 QT"
4040
},
41+
{
42+
"name": "Arduino Nano RP2040 Connect"
43+
},
4144
{
4245
"name": "SparkFun ProMicro RP2040"
4346
},

tools/makeboards.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ def MakeBoard(name, vendor_name, product_name, vid, pid, boarddefine, flashsizem
126126
MakeBoard("adafruit_stemmafriend", "Adafruit", "STEMMA Friend RP2040", "0x239a", "0x80e3", "ADAFRUIT_STEMMAFRIEND_RP2040", 8, "boot2_w25q080_2_padded_checksum")
127127
MakeBoard("adafruit_trinkeyrp2040qt", "Adafruit", "Trinkey RP2040 QT", "0x239a", "0x8109", "ADAFRUIT_TRINKEYQT_RP2040", 8, "boot2_w25q080_2_padded_checksum")
128128
MakeBoard("adafruit_macropad2040", "Adafruit", "MacroPad RP2040", "0x239a", "0x8107", "ADAFRUIT_MACROPAD_RP2040", 8, "boot2_w25q080_2_padded_checksum")
129+
MakeBoard("arduino_nano_connect", "Arduino", "Nano RP2040 Connect", "0x2341", "0x0058", "ARDUINO_NANO_RP2040_CONNECT", 16, "boot2_w25q080_2_padded_checksum")
129130
MakeBoard("sparkfun_promicrorp2040", "SparkFun", "ProMicro RP2040", "0x1b4f", "0x0026", "SPARKFUN_PROMICRO_RP2040", 16, "boot2_generic_03h_4_padded_checksum")
130131
MakeBoard("generic", "Generic", "RP2040", "0x2e8a", "0xf00a", "GENERIC_RP2040", 16, "boot2_generic_03h_4_padded_checksum")
131132

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/* Taken from https://github.com/arduino/ArduinoCore-mbed/tree/master/variants/NANO_RP2040_CONNECT */
2+
3+
AnalogPinDescription g_AAnalogPinDescription[] = {
4+
{ p26, NULL }, // A0
5+
{ p27, NULL }, // A1
6+
{ p28, NULL }, // A2
7+
{ p29, NULL }, // A3
8+
};
9+
10+
PinDescription g_APinDescription[] = {
11+
// D0 - D7
12+
{ p1, NULL, NULL, NULL }, // D0
13+
{ p0, NULL, NULL, NULL }, // D1
14+
{ p25, NULL, NULL, NULL }, // D2
15+
{ p15, NULL, NULL, NULL }, // D3
16+
{ p16, NULL, NULL, NULL }, // D4
17+
{ p17, NULL, NULL, NULL }, // D5
18+
{ p18, NULL, NULL, NULL }, // D6
19+
{ p19, NULL, NULL, NULL }, // D7
20+
21+
// D8 - D13
22+
{ p20, NULL, NULL, NULL }, // D8
23+
{ p21, NULL, NULL, NULL }, // D9
24+
{ p5, NULL, NULL, NULL }, // D10
25+
{ p7, NULL, NULL, NULL }, // D11 / SPITX
26+
{ p4, NULL, NULL, NULL }, // D12 / SPIRX
27+
{ p6, NULL, NULL, NULL }, // D13 / SPICLK / LEDB
28+
29+
// Analog as digital
30+
// A4 to A7 are controlled by Nina module and exposed via different APIs
31+
{ p26, NULL, NULL, NULL }, // A0 -> D14
32+
{ p27, NULL, NULL, NULL }, // A1 -> D15
33+
{ p28, NULL, NULL, NULL }, // A2 -> D16
34+
{ p29, NULL, NULL, NULL }, // A3 -> D17
35+
36+
// I2C
37+
{ p12, NULL, NULL, NULL }, // A4 / SDA -> D18
38+
{ p13, NULL, NULL, NULL }, // A5 / SCL -> D19
39+
40+
// Internal pins - D20 - D23
41+
{ p2, NULL, NULL, NULL }, // GPIO0
42+
{ p24, NULL, NULL, NULL }, // IMU IRQ
43+
{ p22, NULL, NULL, NULL }, // PDM DATA IN
44+
{ p23, NULL, NULL, NULL }, // PDM CLOCK
45+
46+
// Internal pins Nina - D24 - D29
47+
{ p3, NULL, NULL, NULL }, // RESET_NINA
48+
{ p8, NULL, NULL, NULL }, // SPI1_CIPO / UART1_TX
49+
{ p9, NULL, NULL, NULL }, // SPI1_CS / UART1_RX
50+
{ p10, NULL, NULL, NULL }, // SPI1_ACK / UART1_CTS
51+
{ p11, NULL, NULL, NULL }, // SPI1_COPI / UART1_RTS
52+
{ p14, NULL, NULL, NULL }, // SPI1_SCK
53+
};
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/* Taken from https://github.com/arduino/ArduinoCore-mbed/tree/master/variants/NANO_RP2040_CONNECT */
2+
3+
#ifndef _NINA_PINS_
4+
#define _NINA_PINS_
5+
6+
/******************************************************************************
7+
* INCLUDE
8+
******************************************************************************/
9+
10+
#include "Arduino.h"
11+
//#include "WiFiNINA.h"
12+
/******************************************************************************
13+
* PREPROCESSOR-MAGIC
14+
******************************************************************************/
15+
16+
#if __has_include("WiFiNINA.h")
17+
# define NINA_ATTRIBUTE
18+
#else
19+
# define NINA_ATTRIBUTE __attribute__ ((error("Please include WiFiNINA.h to use this pin")))
20+
#endif
21+
22+
/******************************************************************************
23+
* TYPEDEF
24+
******************************************************************************/
25+
26+
enum NinaPin {
27+
LEDR = 27,
28+
LEDG = 25,
29+
LEDB = 26//,
30+
//A4 = 34,
31+
//A5 = 39,
32+
//A6 = 36,
33+
//A7 = 35
34+
};
35+
36+
/******************************************************************************
37+
* FUNCTION DECLARATION
38+
******************************************************************************/
39+
40+
void NINA_ATTRIBUTE pinMode (NinaPin pin, PinMode mode);
41+
PinStatus NINA_ATTRIBUTE digitalRead (NinaPin pin);
42+
void NINA_ATTRIBUTE digitalWrite(NinaPin pin, PinStatus value);
43+
int NINA_ATTRIBUTE analogRead (NinaPin pin);
44+
void NINA_ATTRIBUTE analogWrite (NinaPin pin, int value);
45+
46+
#undef NINA_ATTRIBUTE
47+
48+
#endif /* _NINA_PINS_ */
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
/* Taken from https://github.com/arduino/ArduinoCore-mbed/tree/master/variants/NANO_RP2040_CONNECT */
2+
3+
#pragma once
4+
5+
// Pin definitions taken from:
6+
// https://datasheets.raspberrypi.org/pico/pico-datasheet.pdf
7+
static const uint8_t D0 = (1u);
8+
static const uint8_t D1 = (0u);
9+
static const uint8_t D2 = (25u);
10+
static const uint8_t D3 = (15u);
11+
static const uint8_t D4 = (16u);
12+
static const uint8_t D5 = (17u);
13+
static const uint8_t D6 = (18u);
14+
static const uint8_t D7 = (19u);
15+
static const uint8_t D8 = (20u);
16+
static const uint8_t D9 = (21u);
17+
static const uint8_t D10 = (5u);
18+
static const uint8_t D11 = (7u);
19+
static const uint8_t D12 = (4u);
20+
static const uint8_t D13 = (6u);
21+
static const uint8_t D14 = (26u);
22+
static const uint8_t D15 = (27u);
23+
static const uint8_t D16 = (28u);
24+
static const uint8_t D17 = (29u);
25+
static const uint8_t D18 = (12u);
26+
static const uint8_t D19 = (13u);
27+
static const uint8_t D20 = (2u);
28+
static const uint8_t D21 = (24u);
29+
static const uint8_t D22 = (22u);
30+
static const uint8_t D23 = (23u);
31+
static const uint8_t D24 = (3u);
32+
static const uint8_t D25 = (8u);
33+
static const uint8_t D26 = (9u);
34+
static const uint8_t D27 = (10u);
35+
static const uint8_t D28 = (11u);
36+
static const uint8_t D29 = (14u);
37+
38+
static const uint8_t A0 = (26u);
39+
static const uint8_t A1 = (27u);
40+
static const uint8_t A2 = (28u);
41+
static const uint8_t A3 = (29u);
42+
static const uint8_t A4 = (12u);
43+
static const uint8_t A5 = (13u);
44+
45+
// LEDs
46+
#define PIN_LED (D13)
47+
48+
// Serial
49+
#define PIN_SERIAL1_TX (D1)
50+
#define PIN_SERIAL1_RX (D0)
51+
52+
#define PIN_SERIAL2_TX (D25)
53+
#define PIN_SERIAL2_RX (D26)
54+
55+
// SPI
56+
#define PIN_SPI0_MISO (D12)
57+
#define PIN_SPI0_MOSI (D11)
58+
#define PIN_SPI0_SCK (D13)
59+
#define PIN_SPI0_SS (13u)//(D10)
60+
61+
#define PIN_SPI1_MISO (D25)
62+
#define PIN_SPI1_MOSI (D28)
63+
#define PIN_SPI1_SCK (D29)
64+
#define PIN_SPI1_SS (13u)
65+
66+
// Wire
67+
#define PIN_WIRE0_SDA (D18)
68+
#define PIN_WIRE0_SCL (D19)
69+
70+
#define PIN_WIRE1_SDA (26u) //Non c'è
71+
#define PIN_WIRE1_SCL (27u) //Non c'è
72+
73+
#define SERIAL_HOWMANY (3u)
74+
#define SPI_HOWMANY (2u)
75+
#define WIRE_HOWMANY (1u)
76+
77+
#define PINS_COUNT (30u)
78+
#define NUM_DIGITAL_PINS (30u)
79+
#define NUM_ANALOG_INPUTS (4u)
80+
#define NUM_ANALOG_OUTPUTS (0u)
81+
#define ADC_RESOLUTION (12u)
82+
83+
#define LED_BUILTIN PIN_LED
84+
#define DigitalPinToPinName(p) (p)
85+
86+
static const uint8_t SS = PIN_SPI0_SS;
87+
static const uint8_t MOSI = PIN_SPI0_MOSI;
88+
static const uint8_t MISO = PIN_SPI0_MISO;
89+
static const uint8_t SCK = PIN_SPI0_SCK;
90+
91+
//Nina support
92+
93+
#define NINA_RESETN (D24)
94+
#define SerialNina Serial3
95+
#define SerialHCI Serial2
96+
97+
//#define NINA_GPIOIRQ (21u) // LEDG pin (GPIO26 on NINA)
98+
#define NINA_GPIO0 (20u) // real GPIO0 on NINA
99+
100+
#define SPIWIFI_SS (D26)
101+
#define SPIWIFI_ACK (D27)
102+
#define SPIWIFI_RESET (NINA_RESETN)
103+
#define SPIWIFI (SPI1)
104+
105+
//Cose copiate a caso
106+
107+
#define SERIAL_PORT_USBVIRTUAL SerialUSB
108+
#define SERIAL_PORT_MONITOR SerialUSB
109+
#define SERIAL_PORT_HARDWARE Serial1
110+
#define SERIAL_PORT_HARDWARE_OPEN Serial2
111+
112+
#define CRYPTO_WIRE Wire
113+
114+
#define USB_MAX_POWER (500)
115+
#include "nina_pins.h"

0 commit comments

Comments
 (0)
0