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

     1  //go:build atsame54_xpro
     2  
     3  package machine
     4  
     5  import (
     6  	"device/sam"
     7  )
     8  
     9  // Definition for compatibility, but not used
    10  const resetMagicValue = 0x00000000
    11  
    12  const (
    13  	LED    = PC18
    14  	BUTTON = PB31
    15  )
    16  
    17  const (
    18  	// https://ww1.microchip.com/downloads/en/DeviceDoc/70005321A.pdf
    19  
    20  	// Extension Header EXT1
    21  	EXT1_PIN3_ADC_P     = PB04
    22  	EXT1_PIN4_ADC_N     = PB05
    23  	EXT1_PIN5_GPIO1     = PA06
    24  	EXT1_PIN6_GPIO2     = PA07
    25  	EXT1_PIN7_PWM_P     = PB08
    26  	EXT1_PIN8_PWM_N     = PB09
    27  	EXT1_PIN9_IRQ       = PB07
    28  	EXT1_PIN9_GPIO      = PB07
    29  	EXT1_PIN10_SPI_SS_B = PA27
    30  	EXT1_PIN10_GPIO     = PA27
    31  	EXT1_PIN11_TWI_SDA  = PA22
    32  	EXT1_PIN12_TWI_SCL  = PA23
    33  	EXT1_PIN13_UART_RX  = PA05
    34  	EXT1_PIN14_UART_TX  = PA04
    35  	EXT1_PIN15_SPI_SS_A = PB28
    36  	EXT1_PIN16_SPI_SDO  = PB27
    37  	EXT1_PIN17_SPI_SDI  = PB29
    38  	EXT1_PIN18_SPI_SCK  = PB26
    39  
    40  	// Extension Header EXT2
    41  	EXT2_PIN3_ADC_P     = PB00
    42  	EXT2_PIN4_ADC_N     = PA03
    43  	EXT2_PIN5_GPIO1     = PB01
    44  	EXT2_PIN6_GPIO2     = PB06
    45  	EXT2_PIN7_PWM_P     = PB14
    46  	EXT2_PIN8_PWM_N     = PB15
    47  	EXT2_PIN9_IRQ       = PD00
    48  	EXT2_PIN9_GPIO      = PD00
    49  	EXT2_PIN10_SPI_SS_B = PB02
    50  	EXT2_PIN10_GPIO     = PB02
    51  	EXT2_PIN11_TWI_SDA  = PD08
    52  	EXT2_PIN12_TWI_SCL  = PD09
    53  	EXT2_PIN13_UART_RX  = PB17
    54  	EXT2_PIN14_UART_TX  = PB16
    55  	EXT2_PIN15_SPI_SS_A = PC06
    56  	EXT2_PIN16_SPI_SDO  = PC04
    57  	EXT2_PIN17_SPI_SDI  = PC07
    58  	EXT2_PIN18_SPI_SCK  = PC05
    59  
    60  	// Extension Header EXT3
    61  	EXT3_PIN3_ADC_P     = PC02
    62  	EXT3_PIN4_ADC_N     = PC03
    63  	EXT3_PIN5_GPIO1     = PC01
    64  	EXT3_PIN6_GPIO2     = PC10
    65  	EXT3_PIN7_PWM_P     = PD10
    66  	EXT3_PIN8_PWM_N     = PD11
    67  	EXT3_PIN9_IRQ       = PC30
    68  	EXT3_PIN9_GPIO      = PC30
    69  	EXT3_PIN10_SPI_SS_B = PC31
    70  	EXT3_PIN10_GPIO     = PC31
    71  	EXT3_PIN11_TWI_SDA  = PD08
    72  	EXT3_PIN12_TWI_SCL  = PD09
    73  	EXT3_PIN13_UART_RX  = PC23
    74  	EXT3_PIN14_UART_TX  = PC22
    75  	EXT3_PIN15_SPI_SS_A = PC14
    76  	EXT3_PIN16_SPI_SDO  = PC04
    77  	EXT3_PIN17_SPI_SDI  = PC07
    78  	EXT3_PIN18_SPI_SCK  = PC05
    79  
    80  	// SD_CARD
    81  	SD_CARD_MCDA0   = PB18
    82  	SD_CARD_MCDA1   = PB19
    83  	SD_CARD_MCDA2   = PB20
    84  	SD_CARD_MCDA3   = PB21
    85  	SD_CARD_MCCK    = PA21
    86  	SD_CARD_MCCDA   = PA20
    87  	SD_CARD_DETECT  = PD20
    88  	SD_CARD_PROTECT = PD21
    89  
    90  	// I2C
    91  	I2C_SDA = PD08
    92  	I2C_SCL = PD09
    93  
    94  	// CAN
    95  	CAN0_TX = PA22
    96  	CAN0_RX = PA23
    97  
    98  	CAN1_STANDBY = PC13
    99  	CAN1_TX      = PB12
   100  	CAN1_RX      = PB13
   101  
   102  	CAN_STANDBY = CAN1_STANDBY
   103  	CAN_TX      = CAN1_TX
   104  	CAN_RX      = CAN1_RX
   105  
   106  	// PDEC
   107  	PDEC_PHASE_A = PC16
   108  	PDEC_PHASE_B = PC17
   109  	PDEC_INDEX   = PC18
   110  
   111  	// PCC
   112  	PCC_I2C_SDA    = PD08
   113  	PCC_I2C_SCL    = PD09
   114  	PCC_VSYNC_DEN1 = PA12
   115  	PCC_HSYNC_DEN2 = PA13
   116  	PCC_CLK        = PA14
   117  	PCC_XCLK       = PA15
   118  	PCC_DATA00     = PA16
   119  	PCC_DATA01     = PA17
   120  	PCC_DATA02     = PA18
   121  	PCC_DATA03     = PA19
   122  	PCC_DATA04     = PA20
   123  	PCC_DATA05     = PA21
   124  	PCC_DATA06     = PA22
   125  	PCC_DATA07     = PA23
   126  	PCC_DATA08     = PB14
   127  	PCC_DATA09     = PB15
   128  	PCC_RESET      = PC12
   129  	PCC_PWDN       = PC11
   130  
   131  	// Ethernet
   132  	ETHERNET_TXCK  = PA14
   133  	ETHERNET_TXEN  = PA17
   134  	ETHERNET_TX0   = PA18
   135  	ETHERNET_TX1   = PA19
   136  	ETHERNET_RXER  = PA15
   137  	ETHERNET_RX0   = PA13
   138  	ETHERNET_RX1   = PA12
   139  	ETHERNET_RXDV  = PC20
   140  	ETHERNET_MDIO  = PC12
   141  	ETHERNET_MDC   = PC11
   142  	ETHERNET_INT   = PD12
   143  	ETHERNET_RESET = PC21
   144  
   145  	PIN_QT_BUTTON   = PA16
   146  	PIN_BTN0        = PB31
   147  	PIN_ETH_LED     = PC15
   148  	PIN_LED0        = PC18
   149  	PIN_ADC_DAC     = PA02
   150  	PIN_VBUS_DETECT = PC00
   151  	PIN_USB_ID      = PC19
   152  )
   153  
   154  // USBCDC pins
   155  const (
   156  	USBCDC_DM_PIN = PA24
   157  	USBCDC_DP_PIN = PA25
   158  )
   159  
   160  // UART pins
   161  const (
   162  	// Extension Header EXT1
   163  	UART_TX_PIN = PA04 // TX : SERCOM0/PAD[0]
   164  	UART_RX_PIN = PA05 // RX : SERCOM0/PAD[1]
   165  
   166  	// Extension Header EXT2
   167  	UART2_TX_PIN = PB16 // TX : SERCOM5/PAD[0]
   168  	UART2_RX_PIN = PB17 // RX : SERCOM5/PAD[1]
   169  
   170  	// Extension Header EXT3
   171  	UART3_TX_PIN = PC22 // TX : SERCOM1/PAD[0]
   172  	UART3_RX_PIN = PC23 // RX : SERCOM1/PAD[1]
   173  
   174  	// Virtual COM Port
   175  	UART4_TX_PIN = PB25 // TX : SERCOM2/PAD[0]
   176  	UART4_RX_PIN = PB24 // RX : SERCOM2/PAD[1]
   177  )
   178  
   179  // I2C pins
   180  const (
   181  	// Extension Header EXT1
   182  	SDA0_PIN = PA22 // SDA: SERCOM3/PAD[0]
   183  	SCL0_PIN = PA23 // SCL: SERCOM3/PAD[1]
   184  
   185  	// Extension Header EXT2
   186  	SDA1_PIN = PD08 // SDA: SERCOM7/PAD[0]
   187  	SCL1_PIN = PD09 // SCL: SERCOM7/PAD[1]
   188  
   189  	// Extension Header EXT3
   190  	SDA2_PIN = PD08 // SDA: SERCOM7/PAD[0]
   191  	SCL2_PIN = PD09 // SCL: SERCOM7/PAD[1]
   192  
   193  	// Data Gateway Interface
   194  	SDA_DGI_PIN = PD08 // SDA: SERCOM7/PAD[0]
   195  	SCL_DGI_PIN = PD09 // SCL: SERCOM7/PAD[1]
   196  
   197  	SDA_PIN = SDA0_PIN
   198  	SCL_PIN = SCL0_PIN
   199  )
   200  
   201  // SPI pins
   202  const (
   203  	// Extension Header EXT1
   204  	SPI0_SCK_PIN = PB26 // SCK: SERCOM4/PAD[1]
   205  	SPI0_SDO_PIN = PB27 // SDO: SERCOM4/PAD[0]
   206  	SPI0_SDI_PIN = PB29 // SDI: SERCOM4/PAD[3]
   207  	SPI0_SS_PIN  = PB28 // SS : SERCOM4/PAD[2]
   208  
   209  	// Extension Header EXT2
   210  	SPI1_SCK_PIN = PC05 // SCK: SERCOM6/PAD[1]
   211  	SPI1_SDO_PIN = PC04 // SDO: SERCOM6/PAD[0]
   212  	SPI1_SDI_PIN = PC07 // SDI: SERCOM6/PAD[3]
   213  	SPI1_SS_PIN  = PC06 // SS : SERCOM6/PAD[2]
   214  
   215  	// Extension Header EXT3
   216  	SPI2_SCK_PIN = PC05 // SCK: SERCOM6/PAD[1]
   217  	SPI2_SDO_PIN = PC04 // SDO: SERCOM6/PAD[0]
   218  	SPI2_SDI_PIN = PC07 // SDI: SERCOM6/PAD[3]
   219  	SPI2_SS_PIN  = PC14 // SS : GPIO
   220  
   221  	// Data Gateway Interface
   222  	SPI_DGI_SCK_PIN = PC05 // SCK: SERCOM6/PAD[1]
   223  	SPI_DGI_SDO_PIN = PC04 // SDO: SERCOM6/PAD[0]
   224  	SPI_DGI_SDI_PIN = PC07 // SDI: SERCOM6/PAD[3]
   225  	SPI_DGI_SS_PIN  = PD01 // SS : GPIO
   226  )
   227  
   228  // USB CDC identifiers
   229  const (
   230  	usb_STRING_PRODUCT      = "SAM E54 Xplained Pro"
   231  	usb_STRING_MANUFACTURER = "Atmel"
   232  )
   233  
   234  var (
   235  	usb_VID uint16 = 0x03EB
   236  	usb_PID uint16 = 0x2404
   237  )
   238  
   239  // UART on the SAM E54 Xplained Pro
   240  var (
   241  	// Extension Header EXT1
   242  	UART1 = &sercomUSART0
   243  
   244  	// Extension Header EXT2
   245  	UART2 = &sercomUSART5
   246  
   247  	// Extension Header EXT3
   248  	UART3 = &sercomUSART1
   249  
   250  	// EDBG Virtual COM Port
   251  	UART4 = &sercomUSART2
   252  )
   253  
   254  // I2C on the SAM E54 Xplained Pro
   255  var (
   256  	// Extension Header EXT1
   257  	I2C0 = sercomI2CM3
   258  
   259  	// Extension Header EXT2
   260  	I2C1 = sercomI2CM7
   261  
   262  	// Extension Header EXT3
   263  	I2C2 = sercomI2CM7
   264  
   265  	// Data Gateway Interface
   266  	I2C3 = sercomI2CM7
   267  )
   268  
   269  // SPI on the SAM E54 Xplained Pro
   270  var (
   271  	// Extension Header EXT1
   272  	SPI0 = sercomSPIM4
   273  
   274  	// Extension Header EXT2
   275  	SPI1 = sercomSPIM6
   276  
   277  	// Extension Header EXT3
   278  	SPI2 = sercomSPIM6
   279  
   280  	// Data Gateway Interface
   281  	SPI3 = sercomSPIM6
   282  )
   283  
   284  // CAN on the SAM E54 Xplained Pro
   285  var (
   286  	CAN0 = CAN{
   287  		Bus: sam.CAN0,
   288  	}
   289  
   290  	CAN1 = CAN{
   291  		Bus: sam.CAN1,
   292  	}
   293  )