28 #define BOARD_FREQ_SLCK_XTAL (32768U) 29 #define BOARD_FREQ_SLCK_BYPASS (32768U) 30 #define BOARD_FREQ_MAINCK_XTAL (12000000U) 31 #define BOARD_FREQ_MAINCK_BYPASS (12000000U) 32 #define BOARD_FREQ_CPU 3000000 // CPU target frequency 35 #define BOARD_MCK CHIP_FREQ_CPU_MAX 39 #define BOARD_OSC_STARTUP_US 13000 52 #define BOARD_NAME "IS_EVB-2" 74 #define EVB_HDW_DETECT_0_GPIO (PIO_PC0_IDX) 75 #define EVB_HDW_DETECT_1_GPIO (PIO_PC1_IDX) 76 #define EVB_HDW_DETECT_2_GPIO (PIO_PC2_IDX) 78 #define HDW_DETECT_VER_EVB_2_0_0 0 79 #define HDW_DETECT_VER_EVB_2_0_1 1 83 #define UART_INS_SER0_RXD_PIN (PIO_PA5_IDX) 84 #define UART_INS_SER0_RXD_FLAGS (IOPORT_MODE_MUX_C) 85 #define UART_INS_SER0_TXD_PIN (PIO_PA6_IDX) 86 #define UART_INS_SER0_TXD_FLAGS (IOPORT_MODE_MUX_C) 88 #define UART_INS_SER1_RXD_PIN (PIO_PA9_IDX) 89 #define UART_INS_SER1_RXD_FLAGS (IOPORT_MODE_MUX_A) 90 #define UART_INS_SER1_TXD_PIN (PIO_PA10_IDX) 91 #define UART_INS_SER1_TXD_FLAGS (IOPORT_MODE_MUX_A) 93 #define SPI_INS_MISO_PIN (PIO_PD20_IDX) 94 #define SPI_INS_MISO_FLAGS (IOPORT_MODE_MUX_B) 95 #define SPI_INS_MOSI_PIN (PIO_PD21_IDX) 96 #define SPI_INS_MOSI_FLAGS (IOPORT_MODE_MUX_B) 97 #define SPI_INS_SCLK_PIN (PIO_PD22_IDX) 98 #define SPI_INS_SCLK_FLAGS (IOPORT_MODE_MUX_B) 99 #define SPI_INS_CS_PIN (PIO_PD12_IDX) 100 #define SPI_INS_CS_FLAGS (IOPORT_MODE_MUX_C) 101 #define SPI_INS_EN (PIO_PC20_IDX) 104 #define INS_DATA_RDY_PIN_IDX (PIO_PD2_IDX) 105 #define INS_DATA_RDY_PIN_MASK (PIO_PD2) 106 #define INS_DATA_RDY_PIN_ID (ID_PIOD) 107 #define INS_DATA_RDY_PIN_PIO (PIOD) 110 #define INS_RESET_PIN_PIN (PIO_PA2_IDX) 113 #define UART_SP330_RXD_PIN (PIO_PD28_IDX) 114 #define UART_SP330_RXD_FLAGS (IOPORT_MODE_MUX_A) 115 #define UART_SP330_TXD_PIN (PIO_PD30_IDX) 116 #define UART_SP330_TXD_FLAGS (IOPORT_MODE_MUX_A) 117 #define SP330_NSLEW_PIN (PIO_PA18_IDX) // Data rate limit to 250 kbps when low 118 #define SP330_NSHDN_PIN (PIO_PA19_IDX) 119 #define SP330_N485_RXEN_PIN (PIO_PA20_IDX) // RS845 enable receiver when low 120 #define SP330_NFULL_DPLX_PIN (PIO_PC18_IDX) // RS485 full duplex when low 121 #define SP330_485_N232_PIN (PIO_PD4_IDX) // RS232 low / RS485 high 124 #define SD_CLK_PIN (PIO_PA25_IDX) 125 #define SD_CLK_FLAGS (IOPORT_MODE_MUX_D) 126 #define SD_CMD_PIN (PIO_PA28_IDX) 127 #define SD_CMD_FLAGS (IOPORT_MODE_MUX_C) 128 #define SD_D0_PIN (PIO_PA30_IDX) 129 #define SD_D0_FLAGS (IOPORT_MODE_MUX_C) 130 #define SD_D1_PIN (PIO_PA31_IDX) 131 #define SD_D1_FLAGS (IOPORT_MODE_MUX_C) 132 #define SD_D2_PIN (PIO_PA25_IDX) 133 #define SD_D2_FLAGS (IOPORT_MODE_MUX_C) 134 #define SD_D3_PIN (PIO_PA27_IDX) 135 #define SD_D3_FLAGS (IOPORT_MODE_MUX_C) 136 #define SD_DETECT (PIO_PC16_IDX) 139 #define SPI_WIFI_MISO_PIN (PIO_PC26_IDX) 140 #define SPI_WIFI_MISO_FLAGS (IOPORT_MODE_MUX_C) 141 #define SPI_WIFI_MOSI_PIN (PIO_PC27_IDX) 142 #define SPI_WIFI_MOSI_FLAGS (IOPORT_MODE_MUX_C) 143 #define SPI_WIFI_SCLK_PIN (PIO_PC24_IDX) 144 #define SPI_WIFI_SCLK_FLAGS (IOPORT_MODE_MUX_C) 145 #define SPI_WIFI_CS_PIN (PIO_PC25_IDX) 146 #define SPI_WIFI_CS_FLAGS (IOPORT_MODE_MUX_C) 147 #define WIFI_RST_PIN (PIO_PC21_IDX) 148 #define WIFI_CHIPEN_PIN (PIO_PC22_IDX) 149 #define WIFI_IRQN_PIN (PIO_PC23_IDX) 152 #define UART_BTLE_RXD_PIN (PIO_PD15_IDX) 153 #define UART_BTLE_RXD_FLAGS (IOPORT_MODE_MUX_B) 154 #define UART_BTLE_TXD_PIN (PIO_PD16_IDX) 155 #define UART_BTLE_TXD_FLAGS (IOPORT_MODE_MUX_B) 156 #define UART_BTLE_RTS_PIN (PIO_PD18_IDX) 157 #define UART_BTLE_RTS_FLAGS (IOPORT_MODE_MUX_B) 158 #define UART_BTLE_CTS_PIN (PIO_PD19_IDX) 159 #define UART_BTLE_CTS_FLAGS (IOPORT_MODE_MUX_B) 162 #define UART_EXT_RADIO_RXD_PIN (PIO_PD25_IDX) 163 #define UART_EXT_RADIO_RXD_FLAGS (IOPORT_MODE_MUX_C | IOPORT_MODE_PULLUP) 164 #define UART_EXT_RADIO_TXD_PIN (PIO_PD26_IDX) 165 #define UART_EXT_RADIO_TXD_FLAGS (IOPORT_MODE_MUX_C) 166 #define EXT_RADIO_RST (PIO_PD7_IDX) 169 #define UART_XBEE_RXD_PIN (PIO_PB0_IDX) 170 #define UART_XBEE_RXD_FLAGS (IOPORT_MODE_MUX_C) 171 #define UART_XBEE_TXD_PIN (PIO_PB1_IDX) 172 #define UART_XBEE_TXD_FLAGS (IOPORT_MODE_MUX_C) 173 #if 0 // Normal (EVB-2.0.1) 174 #define UART_XBEE_N_CTS_PIN (PIO_PB2_IDX) 175 #define UART_XBEE_N_CTS_FLAGS (IOPORT_MODE_MUX_C) 176 #define UART_XBEE_N_RTS_PIN (PIO_PB3_IDX) 177 #define UART_XBEE_N_RTS_FLAGS (IOPORT_MODE_MUX_C) 178 #else // temporary fix (EVB-2.0.0) 179 #define UART_XBEE_N_CTS_PIN (PIO_PB3_IDX) 180 #define UART_XBEE_N_CTS_FLAGS (IOPORT_MODE_MUX_C) 181 #define UART_XBEE_N_RTS_PIN (PIO_PB2_IDX) 182 #define UART_XBEE_N_RTS_FLAGS (IOPORT_MODE_MUX_C) 184 #define UART_XBEE_N_DTR_PIN (PIO_PD1_IDX) 185 #define UART_XBEE_N_DTR_FLAGS (IOPORT_MODE_MUX_D) 186 #define XBEE_SUPPLY_EN_PIN (PIO_PD17_IDX) 187 #define XBEE_VUSB_DISABLE_PIN (PIO_PC3_IDX) 188 #define XBEE_RST_PIN (PIO_PA29_IDX) 189 #define XBEE_SLEEP_RQ_PIN (PIO_PD1_IDX) 192 #define USB_PORT_NUM EVB2_PORT_USB 195 #define CAN_RXD_PIN (PIO_PC12_IDX) 196 #define CAN_RXD_FLAGS (IOPORT_MODE_MUX_C) 197 #define CAN_TXD_PIN (PIO_PC14_IDX) 198 #define CAN_TXD_FLAGS (IOPORT_MODE_MUX_C) 201 #define I2C_0_SCL_PIN (PIO_PA3_IDX) 202 #define I2C_0_SCL_FLAGS (IOPORT_MODE_MUX_A) 203 #define I2C_0_SDA_PIN (PIO_PA4_IDX) 204 #define I2C_0_SDA_FLAGS (IOPORT_MODE_MUX_A) 207 #define GPS_TP_PIN (PIO_PC9_IDX) 211 #define GPIO_1_PIN (PIO_PA15_IDX) 212 #define GPIO_2_PIN (PIO_PA16_IDX) 213 #define GPIO_3_PIN (PIO_PA23_IDX) 214 #define GPIO_4_PIN (PIO_PA24_IDX) 215 #define GPIO_5_PIN (PIO_PB13_IDX) 216 #define GPIO_6_PIN (PIO_PC30_IDX) 217 #define GPIO_7_PIN (PIO_PE3_IDX) 218 #define GPIO_8_PIN (PIO_PE4_IDX) 219 #define GPIO_9_PIN (PIO_PE0_IDX) 220 #define GPIO_10_PIN (PIO_PE1_IDX) 222 #define GPIO_UART_INV_PIN (PIO_PE2_IDX) 225 #define GPIO_H8_UART_RXD_PIN (PIO_PA21_IDX) 226 #define GPIO_H8_UART_RXD_FLAGS (IOPORT_MODE_MUX_A | IOPORT_MODE_PULLUP) 228 #define GPIO_H8_UART_TXD_PIN (PIO_PB4_IDX) 229 #define GPIO_H8_UART_TXD_FLAGS (IOPORT_MODE_MUX_D) 233 #define M_USB_ID_PIN (PIO_PA17_IDX) 235 #define LED_OFF(led) ioport_set_pin_level(led,IOPORT_PIN_LEVEL_HIGH) 236 #define LED_ON(led) ioport_set_pin_level(led,IOPORT_PIN_LEVEL_LOW) 237 #define LED_TOGGLE(led) ioport_toggle_pin_level(led) 239 #define LED_CFG_RED_PIN (PIO_PD6_IDX) 240 #define LED_CFG_GRN_PIN (PIO_PA13_IDX) 241 #define LED_CFG_BLU_PIN (PIO_PD3_IDX) 242 #define LED_CFG_RED() { LED_ON(LED_CFG_RED_PIN); LED_OFF(LED_CFG_GRN_PIN); LED_OFF(LED_CFG_BLU_PIN); } 243 #define LED_CFG_GREEN() { LED_OFF(LED_CFG_RED_PIN); LED_ON(LED_CFG_GRN_PIN); LED_OFF(LED_CFG_BLU_PIN); } 244 #define LED_CFG_BLUE() { LED_OFF(LED_CFG_RED_PIN); LED_OFF(LED_CFG_GRN_PIN); LED_ON(LED_CFG_BLU_PIN); } 245 #define LED_CFG_CYAN() { LED_OFF(LED_CFG_RED_PIN); LED_ON(LED_CFG_GRN_PIN); LED_ON(LED_CFG_BLU_PIN); } 246 #define LED_CFG_YELLOW() { LED_ON(LED_CFG_RED_PIN); LED_ON(LED_CFG_GRN_PIN); LED_OFF(LED_CFG_BLU_PIN); } 247 #define LED_CFG_PURPLE() { LED_ON(LED_CFG_RED_PIN); LED_OFF(LED_CFG_GRN_PIN); LED_ON(LED_CFG_BLU_PIN); } 248 #define LED_CFG_WHITE() { LED_ON(LED_CFG_RED_PIN); LED_ON(LED_CFG_GRN_PIN); LED_ON(LED_CFG_BLU_PIN); } 249 #define LED_CFG_OFF() { LED_OFF(LED_CFG_RED_PIN); LED_OFF(LED_CFG_GRN_PIN); LED_OFF(LED_CFG_BLU_PIN); } 251 #define LED_COLOR_RED() LED_CFG_RED(); 252 #define LED_COLOR_GREEN() LED_CFG_GREEN(); 253 #define LED_COLOR_BLUE() LED_CFG_BLUE(); 254 #define LED_COLOR_CYAN() LED_CFG_CYAN(); 255 #define LED_COLOR_YELLOW() LED_CFG_YELLOW(); 256 #define LED_COLOR_PURPLE() LED_CFG_PURPLE(); 257 #define LED_COLOR_WHITE() LED_CFG_WHITE(); 260 #define LED_LOG_RED_PIN (PIO_PA11_IDX) 261 #define LED_LOG_GRN_PIN (PIO_PD23_IDX) 262 #define LED_LOG_BLU_PIN (PIO_PA12_IDX) 263 #define LED_LOG_RED() { LED_ON(LED_LOG_RED_PIN); LED_OFF(LED_LOG_GRN_PIN); LED_OFF(LED_LOG_BLU_PIN); } 264 #define LED_LOG_GREEN() { LED_OFF(LED_LOG_RED_PIN); LED_ON(LED_LOG_GRN_PIN); LED_OFF(LED_LOG_BLU_PIN); } 265 #define LED_LOG_BLUE() { LED_OFF(LED_LOG_RED_PIN); LED_OFF(LED_LOG_GRN_PIN); LED_ON(LED_LOG_BLU_PIN); } 266 #define LED_LOG_CYAN() { LED_OFF(LED_LOG_RED_PIN); LED_ON(LED_LOG_GRN_PIN); LED_ON(LED_LOG_BLU_PIN); } 267 #define LED_LOG_YELLOW() { LED_ON(LED_LOG_RED_PIN); LED_ON(LED_LOG_GRN_PIN); LED_OFF(LED_LOG_BLU_PIN); } 268 #define LED_LOG_PURPLE() { LED_ON(LED_LOG_RED_PIN); LED_OFF(LED_LOG_GRN_PIN); LED_ON(LED_LOG_BLU_PIN); } 269 #define LED_LOG_WHITE() { LED_ON(LED_LOG_RED_PIN); LED_ON(LED_LOG_GRN_PIN); LED_ON(LED_LOG_BLU_PIN); } 270 #define LED_LOG_OFF() { LED_OFF(LED_LOG_RED_PIN); LED_OFF(LED_LOG_GRN_PIN); LED_OFF(LED_LOG_BLU_PIN); } 272 #define LEDS_ALL_ON() { LED_ON(LED_LOG_RED_PIN); LED_ON(LED_LOG_GRN_PIN); LED_ON(LED_LOG_BLU_PIN); } 273 #define LEDS_ALL_OFF() { LED_OFF(LED_LOG_RED_PIN); LED_OFF(LED_LOG_GRN_PIN); LED_OFF(LED_LOG_BLU_PIN); } 274 #define LEDS_ALL_TOGGLE() { LED_TOGGLE(LED_LOG_RED_PIN); LED_TOGGLE(LED_LOG_GRN_PIN); LED_TOGGLE(LED_LOG_BLU_PIN); } 279 #define LED_INS_RXD_PIN (PIO_PC8_IDX) // green 280 #define LED_INS_TXD_PIN (PIO_PC28_IDX) // red 282 #define LED_XBEE_RXD_PIN (PIO_PC10_IDX) // green 283 #define LED_XBEE_TXD_PIN (PIO_PC11_IDX) // red 285 #define LED_WIFI_RXD_PIN (PIO_PC17_IDX) // green 286 #define LED_WIFI_TXD_PIN (PIO_PD10_IDX) // red 289 #define BUTTON_CFG_PIN (g_hdw_detect==0?PIO_PC5_IDX:PIO_PC3_IDX) // EVB 2.0.0 = PC5, all others are PC3 290 #define BUTTON_CFG_FLAGS (IOPORT_MODE_PULLUP | IOPORT_MODE_DEBOUNCE) 291 #define BUTTON_CFG_SENSE (IOPORT_SENSE_RISING) 292 #define BUTTON_LOG_PIN (g_hdw_detect==0?PIO_PC6_IDX:PIO_PC7_IDX) // EVB 2.0.0 = PC6, all others are PC7 293 #define BUTTON_LOG_FLAGS (IOPORT_MODE_PULLUP | IOPORT_MODE_DEBOUNCE) 294 #define BUTTON_LOG_SENSE (IOPORT_SENSE_RISING) 296 #define JTAG_TMS_SWDIO_PIN (PIO_PB6_IDX) 297 #define JTAG_TCK_SWCLK_PIN (PIO_PB7_IDX) 298 #define JTAG_TDO_SWO_PIN (PIO_PB5_IDX) 299 #define JTAG_TDI_PIN (PIO_PB4_IDX) 303 #ifndef ioport_set_port_peripheral_mode 304 #define ioport_set_port_peripheral_mode(port, masks, mode) \ 306 ioport_set_port_mode(port, masks, mode);\ 307 ioport_disable_port(port, masks);\ 309 #endif // ioport_set_port_peripheral_mode 311 #ifndef ioport_set_pin_peripheral_mode 312 #define ioport_set_pin_peripheral_mode(pin, mode) \ 314 ioport_set_pin_mode(pin, mode);\ 315 ioport_disable_pin(pin);\ 317 #endif // ioport_set_pin_peripheral_mode 320 #ifndef ioport_set_pin_input_mode 321 #define ioport_set_pin_input_mode(pin, mode, sense) \ 323 ioport_enable_pin(pin);\ 324 ioport_set_pin_dir(pin, IOPORT_DIR_INPUT);\ 325 ioport_set_pin_mode(pin, mode);\ 326 ioport_set_pin_sense_mode(pin, (ioport_sense)sense);\ 328 #endif // ioport_set_pin_input_mode 330 #ifndef ioport_set_pin_output_mode 331 #define ioport_set_pin_output_mode(pin, level) \ 333 ioport_enable_pin(pin);\ 334 ioport_set_pin_level(pin, level);\ 335 ioport_set_pin_dir(pin, IOPORT_DIR_OUTPUT);\ 337 #endif // ioport_set_pin_output_mode 359 #define PIN_USART0_SCK_IDX (PIO_PB13_IDX) 360 #define PIN_USART0_SCK_FLAGS (IOPORT_MODE_MUX_C) 363 #define PIN_USART0_CTS_IDX (PIO_PB2_IDX) 364 #define PIN_USART0_CTS_FLAGS (IOPORT_MODE_MUX_C) 367 #define PIN_USART0_RTS_IDX (PIO_PB3_IDX) 368 #define PIN_USART0_RTS_FLAGS (IOPORT_MODE_MUX_C) 372 #define SD_MMC_HSMCI_MEM_CNT 1 373 #define SD_MMC_HSMCI_SLOT_0_SIZE 4 375 #define PIN_HSMCI_MCCDA_GPIO (PIO_PA28_IDX) 376 #define PIN_HSMCI_MCCDA_FLAGS (IOPORT_MODE_MUX_C) 378 #define PIN_HSMCI_MCCK_GPIO (PIO_PA25_IDX) 379 #define PIN_HSMCI_MCCK_FLAGS (IOPORT_MODE_MUX_D) 381 #define PIN_HSMCI_MCDA0_GPIO (PIO_PA30_IDX) 382 #define PIN_HSMCI_MCDA0_FLAGS (IOPORT_MODE_MUX_C) 384 #define PIN_HSMCI_MCDA1_GPIO (PIO_PA31_IDX) 385 #define PIN_HSMCI_MCDA1_FLAGS (IOPORT_MODE_MUX_C) 387 #define PIN_HSMCI_MCDA2_GPIO (PIO_PA26_IDX) 388 #define PIN_HSMCI_MCDA2_FLAGS (IOPORT_MODE_MUX_C) 390 #define PIN_HSMCI_MCDA3_GPIO (PIO_PA27_IDX) 391 #define PIN_HSMCI_MCDA3_FLAGS (IOPORT_MODE_MUX_C) 394 #define PIN_HSMCI_CD {PIO_PC16, PIOD, ID_PIOD, PIO_INPUT, PIO_PULLUP} 395 #define SD_MMC_0_CD_GPIO (PIO_PC16_IDX) 396 #define SD_MMC_0_CD_PIO_ID ID_PIOD 397 #define SD_MMC_0_CD_FLAGS (IOPORT_MODE_PULLUP) 398 #define SD_MMC_0_CD_DETECT_VALUE 0 909 #endif // USER_BOARD_H Commonly used includes, types and macros.
Standard board header file.