Unverified Commit 6afcf588 authored by Earle F. Philhower, III's avatar Earle F. Philhower, III Committed by GitHub

Initial Arduino Nano RP2040 Connect support (#212)

Thanks to @Claupio for the bringup!
Reference #208
parent 30704a7c
......@@ -17,6 +17,7 @@ See https://arduino-pico.readthedocs.io/en/latest/ along with the examples for m
* Adafruit QTPy RP2040
* Adafruit STEMMA Friend RP2040
* Adafruit Trinkey RP2040 QT
* Arduino Nano RP2040 Connect (preliminary)
* SparkFun ProMicro RP2040
* Generic (configurable flash, I/O pins)
......
This diff is collapsed.
......@@ -38,6 +38,9 @@
{
"name": "Adafruit Trinkey RP2040 QT"
},
{
"name": "Arduino Nano RP2040 Connect"
},
{
"name": "SparkFun ProMicro RP2040"
},
......
......@@ -126,6 +126,7 @@ MakeBoard("adafruit_qtpy", "Adafruit", "QT Py RP2040", "0x239a", "0x80f7", "ADAF
MakeBoard("adafruit_stemmafriend", "Adafruit", "STEMMA Friend RP2040", "0x239a", "0x80e3", "ADAFRUIT_STEMMAFRIEND_RP2040", 8, "boot2_w25q080_2_padded_checksum")
MakeBoard("adafruit_trinkeyrp2040qt", "Adafruit", "Trinkey RP2040 QT", "0x239a", "0x8109", "ADAFRUIT_TRINKEYQT_RP2040", 8, "boot2_w25q080_2_padded_checksum")
MakeBoard("adafruit_macropad2040", "Adafruit", "MacroPad RP2040", "0x239a", "0x8107", "ADAFRUIT_MACROPAD_RP2040", 8, "boot2_w25q080_2_padded_checksum")
MakeBoard("arduino_nano_connect", "Arduino", "Nano RP2040 Connect", "0x2341", "0x0058", "ARDUINO_NANO_RP2040_CONNECT", 16, "boot2_w25q080_2_padded_checksum")
MakeBoard("sparkfun_promicrorp2040", "SparkFun", "ProMicro RP2040", "0x1b4f", "0x0026", "SPARKFUN_PROMICRO_RP2040", 16, "boot2_generic_03h_4_padded_checksum")
MakeBoard("generic", "Generic", "RP2040", "0x2e8a", "0xf00a", "GENERIC_RP2040", 16, "boot2_generic_03h_4_padded_checksum")
/* Taken from https://github.com/arduino/ArduinoCore-mbed/tree/master/variants/NANO_RP2040_CONNECT */
AnalogPinDescription g_AAnalogPinDescription[] = {
{ p26, NULL }, // A0
{ p27, NULL }, // A1
{ p28, NULL }, // A2
{ p29, NULL }, // A3
};
PinDescription g_APinDescription[] = {
// D0 - D7
{ p1, NULL, NULL, NULL }, // D0
{ p0, NULL, NULL, NULL }, // D1
{ p25, NULL, NULL, NULL }, // D2
{ p15, NULL, NULL, NULL }, // D3
{ p16, NULL, NULL, NULL }, // D4
{ p17, NULL, NULL, NULL }, // D5
{ p18, NULL, NULL, NULL }, // D6
{ p19, NULL, NULL, NULL }, // D7
// D8 - D13
{ p20, NULL, NULL, NULL }, // D8
{ p21, NULL, NULL, NULL }, // D9
{ p5, NULL, NULL, NULL }, // D10
{ p7, NULL, NULL, NULL }, // D11 / SPITX
{ p4, NULL, NULL, NULL }, // D12 / SPIRX
{ p6, NULL, NULL, NULL }, // D13 / SPICLK / LEDB
// Analog as digital
// A4 to A7 are controlled by Nina module and exposed via different APIs
{ p26, NULL, NULL, NULL }, // A0 -> D14
{ p27, NULL, NULL, NULL }, // A1 -> D15
{ p28, NULL, NULL, NULL }, // A2 -> D16
{ p29, NULL, NULL, NULL }, // A3 -> D17
// I2C
{ p12, NULL, NULL, NULL }, // A4 / SDA -> D18
{ p13, NULL, NULL, NULL }, // A5 / SCL -> D19
// Internal pins - D20 - D23
{ p2, NULL, NULL, NULL }, // GPIO0
{ p24, NULL, NULL, NULL }, // IMU IRQ
{ p22, NULL, NULL, NULL }, // PDM DATA IN
{ p23, NULL, NULL, NULL }, // PDM CLOCK
// Internal pins Nina - D24 - D29
{ p3, NULL, NULL, NULL }, // RESET_NINA
{ p8, NULL, NULL, NULL }, // SPI1_CIPO / UART1_TX
{ p9, NULL, NULL, NULL }, // SPI1_CS / UART1_RX
{ p10, NULL, NULL, NULL }, // SPI1_ACK / UART1_CTS
{ p11, NULL, NULL, NULL }, // SPI1_COPI / UART1_RTS
{ p14, NULL, NULL, NULL }, // SPI1_SCK
};
/* Taken from https://github.com/arduino/ArduinoCore-mbed/tree/master/variants/NANO_RP2040_CONNECT */
#ifndef _NINA_PINS_
#define _NINA_PINS_
/******************************************************************************
* INCLUDE
******************************************************************************/
#include "Arduino.h"
//#include "WiFiNINA.h"
/******************************************************************************
* PREPROCESSOR-MAGIC
******************************************************************************/
#if __has_include("WiFiNINA.h")
# define NINA_ATTRIBUTE
#else
# define NINA_ATTRIBUTE __attribute__ ((error("Please include WiFiNINA.h to use this pin")))
#endif
/******************************************************************************
* TYPEDEF
******************************************************************************/
enum NinaPin {
LEDR = 27,
LEDG = 25,
LEDB = 26//,
//A4 = 34,
//A5 = 39,
//A6 = 36,
//A7 = 35
};
/******************************************************************************
* FUNCTION DECLARATION
******************************************************************************/
void NINA_ATTRIBUTE pinMode (NinaPin pin, PinMode mode);
PinStatus NINA_ATTRIBUTE digitalRead (NinaPin pin);
void NINA_ATTRIBUTE digitalWrite(NinaPin pin, PinStatus value);
int NINA_ATTRIBUTE analogRead (NinaPin pin);
void NINA_ATTRIBUTE analogWrite (NinaPin pin, int value);
#undef NINA_ATTRIBUTE
#endif /* _NINA_PINS_ */
/* Taken from https://github.com/arduino/ArduinoCore-mbed/tree/master/variants/NANO_RP2040_CONNECT */
#pragma once
// Pin definitions taken from:
// https://datasheets.raspberrypi.org/pico/pico-datasheet.pdf
static const uint8_t D0 = (1u);
static const uint8_t D1 = (0u);
static const uint8_t D2 = (25u);
static const uint8_t D3 = (15u);
static const uint8_t D4 = (16u);
static const uint8_t D5 = (17u);
static const uint8_t D6 = (18u);
static const uint8_t D7 = (19u);
static const uint8_t D8 = (20u);
static const uint8_t D9 = (21u);
static const uint8_t D10 = (5u);
static const uint8_t D11 = (7u);
static const uint8_t D12 = (4u);
static const uint8_t D13 = (6u);
static const uint8_t D14 = (26u);
static const uint8_t D15 = (27u);
static const uint8_t D16 = (28u);
static const uint8_t D17 = (29u);
static const uint8_t D18 = (12u);
static const uint8_t D19 = (13u);
static const uint8_t D20 = (2u);
static const uint8_t D21 = (24u);
static const uint8_t D22 = (22u);
static const uint8_t D23 = (23u);
static const uint8_t D24 = (3u);
static const uint8_t D25 = (8u);
static const uint8_t D26 = (9u);
static const uint8_t D27 = (10u);
static const uint8_t D28 = (11u);
static const uint8_t D29 = (14u);
static const uint8_t A0 = (26u);
static const uint8_t A1 = (27u);
static const uint8_t A2 = (28u);
static const uint8_t A3 = (29u);
static const uint8_t A4 = (12u);
static const uint8_t A5 = (13u);
// LEDs
#define PIN_LED (D13)
// Serial
#define PIN_SERIAL1_TX (D1)
#define PIN_SERIAL1_RX (D0)
#define PIN_SERIAL2_TX (D25)
#define PIN_SERIAL2_RX (D26)
// SPI
#define PIN_SPI0_MISO (D12)
#define PIN_SPI0_MOSI (D11)
#define PIN_SPI0_SCK (D13)
#define PIN_SPI0_SS (13u)//(D10)
#define PIN_SPI1_MISO (D25)
#define PIN_SPI1_MOSI (D28)
#define PIN_SPI1_SCK (D29)
#define PIN_SPI1_SS (13u)
// Wire
#define PIN_WIRE0_SDA (D18)
#define PIN_WIRE0_SCL (D19)
#define PIN_WIRE1_SDA (26u) //Non c'è
#define PIN_WIRE1_SCL (27u) //Non c'è
#define SERIAL_HOWMANY (3u)
#define SPI_HOWMANY (2u)
#define WIRE_HOWMANY (1u)
#define PINS_COUNT (30u)
#define NUM_DIGITAL_PINS (30u)
#define NUM_ANALOG_INPUTS (4u)
#define NUM_ANALOG_OUTPUTS (0u)
#define ADC_RESOLUTION (12u)
#define LED_BUILTIN PIN_LED
#define DigitalPinToPinName(p) (p)
static const uint8_t SS = PIN_SPI0_SS;
static const uint8_t MOSI = PIN_SPI0_MOSI;
static const uint8_t MISO = PIN_SPI0_MISO;
static const uint8_t SCK = PIN_SPI0_SCK;
//Nina support
#define NINA_RESETN (D24)
#define SerialNina Serial3
#define SerialHCI Serial2
//#define NINA_GPIOIRQ (21u) // LEDG pin (GPIO26 on NINA)
#define NINA_GPIO0 (20u) // real GPIO0 on NINA
#define SPIWIFI_SS (D26)
#define SPIWIFI_ACK (D27)
#define SPIWIFI_RESET (NINA_RESETN)
#define SPIWIFI (SPI1)
//Cose copiate a caso
#define SERIAL_PORT_USBVIRTUAL SerialUSB
#define SERIAL_PORT_MONITOR SerialUSB
#define SERIAL_PORT_HARDWARE Serial1
#define SERIAL_PORT_HARDWARE_OPEN Serial2
#define CRYPTO_WIRE Wire
#define USB_MAX_POWER (500)
#include "nina_pins.h"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment