github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/machine/board_nano-rp2040.go (about)

     1  //go:build nano_rp2040
     2  
     3  // This contains the pin mappings for the Arduino Nano RP2040 Connect board.
     4  //
     5  // Sometimes the board is not detected even when the board is connected to your computer.
     6  // To solve this, place a jumper wire between the REC and GND pins, then connect the board to your computer.
     7  //
     8  // For more information, see: https://store.arduino.cc/nano-rp2040-connect
     9  // Also
    10  // - Datasheets: https://docs.arduino.cc/hardware/nano-rp2040-connect
    11  // - Nano RP2040 Connect technical reference: https://docs.arduino.cc/tutorials/nano-rp2040-connect/rp2040-01-technical-reference
    12  package machine
    13  
    14  // Digital Pins
    15  const (
    16  	D2  Pin = GPIO25
    17  	D3  Pin = GPIO15
    18  	D4  Pin = GPIO16
    19  	D5  Pin = GPIO17
    20  	D6  Pin = GPIO18
    21  	D7  Pin = GPIO19
    22  	D8  Pin = GPIO20
    23  	D9  Pin = GPIO21
    24  	D10 Pin = GPIO5
    25  	D11 Pin = GPIO7
    26  	D12 Pin = GPIO4
    27  	D13 Pin = GPIO6
    28  	D14 Pin = GPIO26
    29  	D15 Pin = GPIO27
    30  	D16 Pin = GPIO28
    31  	D17 Pin = GPIO29
    32  	D18 Pin = GPIO12
    33  	D19 Pin = GPIO13
    34  )
    35  
    36  // Analog pins
    37  const (
    38  	A0 Pin = ADC0
    39  	A1 Pin = ADC1
    40  	A2 Pin = ADC2
    41  	A3 Pin = ADC3
    42  )
    43  
    44  // Onboard LED
    45  const (
    46  	LED = GPIO6
    47  )
    48  
    49  // I2C pins
    50  const (
    51  	I2C0_SDA_PIN Pin = GPIO12
    52  	I2C0_SCL_PIN Pin = GPIO13
    53  
    54  	I2C1_SDA_PIN Pin = GPIO18
    55  	I2C1_SCL_PIN Pin = GPIO19
    56  )
    57  
    58  // SPI pins. SPI1 not available on Nano RP2040 Connect.
    59  const (
    60  	SPI0_SCK_PIN Pin = GPIO6
    61  	SPI0_SDO_PIN Pin = GPIO7
    62  	SPI0_SDI_PIN Pin = GPIO4
    63  
    64  	// GPIO22 does not have SPI functionality so we set it to avoid interfering with NINA.
    65  	SPI1_SCK_PIN Pin = GPIO22
    66  	SPI1_SDO_PIN Pin = GPIO22
    67  	SPI1_SDI_PIN Pin = GPIO22
    68  )
    69  
    70  var (
    71  	NINA_SPI = SPI1
    72  )
    73  
    74  // NINA-W102 Pins
    75  const (
    76  	NINA_SCK Pin = GPIO14
    77  	NINA_SDO Pin = GPIO11
    78  	NINA_SDI Pin = GPIO8
    79  
    80  	NINA_CS     Pin = GPIO9
    81  	NINA_ACK    Pin = GPIO10
    82  	NINA_GPIO0  Pin = GPIO2
    83  	NINA_RESETN Pin = GPIO3
    84  
    85  	NINA_TX  Pin = GPIO8
    86  	NINA_RX  Pin = GPIO9
    87  	NINA_CTS Pin = GPIO10
    88  	NINA_RTS Pin = GPIO11
    89  )
    90  
    91  // NINA-W102 settings
    92  const (
    93  	NINA_BAUDRATE         = 115200
    94  	NINA_RESET_INVERTED   = true
    95  	NINA_SOFT_FLOWCONTROL = false
    96  )
    97  
    98  // Onboard crystal oscillator frequency, in MHz.
    99  const (
   100  	xoscFreq = 12 // MHz
   101  )
   102  
   103  // USB CDC identifiers
   104  // https://github.com/arduino/ArduinoCore-mbed/blob/master/variants/NANO_RP2040_CONNECT/pins_arduino.h
   105  const (
   106  	usb_STRING_PRODUCT      = "Nano RP2040 Connect"
   107  	usb_STRING_MANUFACTURER = "Arduino"
   108  )
   109  
   110  var (
   111  	usb_VID uint16 = 0x2341
   112  	usb_PID uint16 = 0x005e
   113  )
   114  
   115  // UART pins
   116  const (
   117  	UART0_TX_PIN = GPIO0
   118  	UART0_RX_PIN = GPIO1
   119  	UART_TX_PIN  = UART0_TX_PIN
   120  	UART_RX_PIN  = UART0_RX_PIN
   121  )
   122  
   123  // UART_NINA on the Arduino Nano RP2040 connects to the NINA HCI.
   124  var UART_NINA = UART1
   125  
   126  var DefaultUART = UART0