github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/machine/board_arduino_nano33.go (about) 1 //go:build arduino_nano33 2 3 // This contains the pin mappings for the Arduino Nano33 IoT board. 4 // 5 // For more information, see: https://store.arduino.cc/nano-33-iot 6 package machine 7 8 // used to reset into bootloader 9 const resetMagicValue = 0x07738135 10 11 // GPIO Pins 12 const ( 13 RX0 Pin = PB23 // UART2 RX 14 TX1 Pin = PB22 // UART2 TX 15 16 D2 Pin = PB10 // PWM available 17 D3 Pin = PB11 // PWM available 18 D4 Pin = PA07 19 D5 Pin = PA05 // PWM available 20 D6 Pin = PA04 // PWM available 21 D7 Pin = PA06 22 23 D8 Pin = PA18 24 D9 Pin = PA20 // PWM available 25 D10 Pin = PA21 // PWM available 26 D11 Pin = PA16 // PWM available 27 D12 Pin = PA19 // PWM available 28 29 D13 Pin = PA17 30 ) 31 32 // Analog pins 33 const ( 34 A0 Pin = PA02 // ADC/AIN[0] 35 A1 Pin = PB02 // ADC/AIN[10] 36 A2 Pin = PA11 // ADC/AIN[19] 37 A3 Pin = PA10 // ADC/AIN[18], 38 A4 Pin = PB08 // ADC/AIN[2], SCL: SERCOM2/PAD[1] 39 A5 Pin = PB09 // ADC/AIN[3], SDA: SERCOM2/PAD[1] 40 A6 Pin = PA09 // ADC/AIN[17] 41 A7 Pin = PB03 // ADC/AIN[11] 42 ) 43 44 const ( 45 LED = D13 46 ) 47 48 // USBCDC pins 49 const ( 50 USBCDC_DM_PIN Pin = PA24 51 USBCDC_DP_PIN Pin = PA25 52 ) 53 54 // UART1 pins 55 const ( 56 UART_TX_PIN Pin = PA22 57 UART_RX_PIN Pin = PA23 58 ) 59 60 // UART1 on the Arduino Nano 33 connects to the onboard NINA-W102 WiFi chip. 61 var UART1 = &sercomUSART3 62 63 // UART2 on the Arduino Nano 33 connects to the normal TX/RX pins. 64 var UART2 = &sercomUSART5 65 66 // UART_NINA on the Arduino Nano 33 connects to the NINA HCI. 67 var UART_NINA = &sercomUSART2 68 69 // I2C pins 70 const ( 71 SDA_PIN Pin = A4 // SDA: SERCOM4/PAD[1] 72 SCL_PIN Pin = A5 // SCL: SERCOM4/PAD[1] 73 ) 74 75 // I2C on the Arduino Nano 33. 76 var ( 77 I2C0 = sercomI2CM4 78 ) 79 80 // SPI pins 81 const ( 82 SPI0_SCK_PIN Pin = D13 // SCK: SERCOM1/PAD[1] 83 SPI0_SDO_PIN Pin = D11 // SDO: SERCOM1/PAD[0] 84 SPI0_SDI_PIN Pin = D12 // SDI: SERCOM1/PAD[3] 85 ) 86 87 // SPI on the Arduino Nano 33. 88 var SPI0 = sercomSPIM1 89 90 // SPI1 is connected to the NINA-W102 chip on the Arduino Nano 33. 91 var ( 92 SPI1 = sercomSPIM2 93 NINA_SPI = SPI1 94 ) 95 96 // NINA-W102 Pins 97 const ( 98 NINA_SDO Pin = PA12 99 NINA_SDI Pin = PA13 100 NINA_CS Pin = PA14 101 NINA_SCK Pin = PA15 102 NINA_GPIO0 Pin = PA27 103 NINA_RESETN Pin = PA08 104 NINA_ACK Pin = PA28 105 NINA_TX Pin = PA12 106 NINA_RX Pin = PA13 107 NINA_RTS Pin = PA14 108 NINA_CTS Pin = PA15 109 ) 110 111 // NINA-W102 settings 112 const ( 113 NINA_BAUDRATE = 912600 114 NINA_RESET_INVERTED = true 115 NINA_SOFT_FLOWCONTROL = false 116 ) 117 118 // I2S pins 119 const ( 120 I2S_SCK_PIN Pin = PA10 121 I2S_SD_PIN Pin = PA08 122 I2S_WS_PIN = NoPin // TODO: figure out what this is on Arduino Nano 33. 123 ) 124 125 // USB CDC identifiers 126 const ( 127 usb_STRING_PRODUCT = "Arduino NANO 33 IoT" 128 usb_STRING_MANUFACTURER = "Arduino" 129 ) 130 131 var ( 132 usb_VID uint16 = 0x2341 133 usb_PID uint16 = 0x8057 134 )