atmel-samd: Add SAM E54 Xplained board

Few peripherals are actually tested.  However, USB, I2C and GPIO seem to work.

Most pins are silkscreened with the "PX00" style, so the board module
only includes the small number that are screened differently.

The default SPI, I2C, and UART are the ones on the EXT2 header.  This is
arbitrary, but the I2C on this connector is shared with the on-board I2C
devices and the PCC header, making it the most versatile.
This commit is contained in:
Jeff Epler 2020-06-18 14:16:57 -05:00 committed by Jeff Epler
parent da733c01da
commit d5074220a8
6 changed files with 204 additions and 0 deletions

View File

@ -238,6 +238,7 @@ jobs:
- "pyruler"
- "robohatmm1_m4"
- "sam32"
- "same54_xplained"
- "seeeduino_xiao"
- "serpente"
- "shirtty"

View File

@ -0,0 +1,39 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2018 Scott Shawcroft for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "boards/board.h"
#include "mpconfigboard.h"
#include "hal/include/hal_gpio.h"
void board_init(void) {
}
bool board_requests_safe_mode(void) {
return false;
}
void reset_board(void) {
}

View File

@ -0,0 +1,33 @@
#define MICROPY_HW_BOARD_NAME "SAM E54 Xplained Pro"
#define MICROPY_HW_MCU_NAME "same54p20"
#define CIRCUITPY_MCU_FAMILY samd51
// This is for Rev B which is green and has the SD card slot at the edge of the board.
#define MICROPY_HW_LED_STATUS (&pin_PC18)
// These are pins not to reset.
// QSPI Data pins
#define MICROPY_PORT_A ( PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11 )
// QSPI CS, and QSPI SCK
#define MICROPY_PORT_B ( PORT_PB10 | PORT_PB11 )
#define MICROPY_PORT_C (0)
#define MICROPY_PORT_D (0)
#define BOARD_HAS_CRYSTAL 1
#define DEFAULT_I2C_BUS_SCL (&pin_PD09)
#define DEFAULT_I2C_BUS_SDA (&pin_PD08)
#define DEFAULT_SPI_BUS_SCK (&pin_PC05)
#define DEFAULT_SPI_BUS_MOSI (&pin_PC04)
#define DEFAULT_SPI_BUS_MISO (&pin_PC07)
#define DEFAULT_UART_BUS_RX (&pin_PB17)
#define DEFAULT_UART_BUS_TX (&pin_PB16)
// USB is always used internally so skip the pin objects for it.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1
#define IGNORE_PIN_PC19 1

View File

@ -0,0 +1,13 @@
USB_VID = 0x239A
USB_PID = 0x80B6
USB_PRODUCT = "SAM E54 Xplained Pro"
USB_MANUFACTURER = "Microchip"
CHIP_VARIANT = SAME54P20A
CHIP_FAMILY = same54
QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 2
EXTERNAL_FLASH_DEVICES = "N25Q256A"
LONGINT_IMPL = MPZ
LONGINT_IMPL = MPZ

View File

@ -0,0 +1,99 @@
#include "shared-bindings/board/__init__.h"
// This mapping only includes functional names because pins broken
// out on connectors are labeled with their MCU name available from
// microcontroller.pin.
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PD08) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PD09) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_VSYNC), MP_ROM_PTR(&pin_PA12) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_HSYNC), MP_ROM_PTR(&pin_PA13) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PCLK), MP_ROM_PTR(&pin_PA14) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_XCLK), MP_ROM_PTR(&pin_PA15) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D07), MP_ROM_PTR(&pin_PA23) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D06), MP_ROM_PTR(&pin_PA22) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D05), MP_ROM_PTR(&pin_PA21) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D04), MP_ROM_PTR(&pin_PA20) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D03), MP_ROM_PTR(&pin_PA19) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D02), MP_ROM_PTR(&pin_PA18) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D01), MP_ROM_PTR(&pin_PA17) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D00), MP_ROM_PTR(&pin_PA16) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D09), MP_ROM_PTR(&pin_PB15) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D08), MP_ROM_PTR(&pin_PB14) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_RST), MP_ROM_PTR(&pin_PC12) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PWDN), MP_ROM_PTR(&pin_PC11) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PDEC_A), MP_ROM_PTR(&pin_PC16) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PDEC_B), MP_ROM_PTR(&pin_PC17) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PDEC_C), MP_ROM_PTR(&pin_PC18) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_ADCDAC), MP_ROM_PTR(&pin_PA02) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_SW0), MP_ROM_PTR(&pin_PB31) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PC18) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_QT), MP_ROM_PTR(&pin_PA16) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_CANRX), MP_ROM_PTR(&pin_PB12) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_CANTX), MP_ROM_PTR(&pin_PB13) },
// EXT1 header
{ MP_OBJ_NEW_QSTR(MP_QSTR_PB04), MP_ROM_PTR(&pin_PB04) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PB05), MP_ROM_PTR(&pin_PB05) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PA06), MP_ROM_PTR(&pin_PA06) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PA07), MP_ROM_PTR(&pin_PA07) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PB08), MP_ROM_PTR(&pin_PB08) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PB09), MP_ROM_PTR(&pin_PB09) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PB07), MP_ROM_PTR(&pin_PB07) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PA27), MP_ROM_PTR(&pin_PA27) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PC22), MP_ROM_PTR(&pin_PC22) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PA23), MP_ROM_PTR(&pin_PA23) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PA05), MP_ROM_PTR(&pin_PA05) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PA04), MP_ROM_PTR(&pin_PA04) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PB28), MP_ROM_PTR(&pin_PB28) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PB27), MP_ROM_PTR(&pin_PB27) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PB29), MP_ROM_PTR(&pin_PB29) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PB26), MP_ROM_PTR(&pin_PB26) },
// EXT2 header
{ MP_OBJ_NEW_QSTR(MP_QSTR_PB00), MP_ROM_PTR(&pin_PB00) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PA03), MP_ROM_PTR(&pin_PA03) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PB01), MP_ROM_PTR(&pin_PB01) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PB06), MP_ROM_PTR(&pin_PB06) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PB14), MP_ROM_PTR(&pin_PB14) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PB15), MP_ROM_PTR(&pin_PB15) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PD00), MP_ROM_PTR(&pin_PD00) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PB02), MP_ROM_PTR(&pin_PB02) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PD08), MP_ROM_PTR(&pin_PD08) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PD09), MP_ROM_PTR(&pin_PD09) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PB17), MP_ROM_PTR(&pin_PB17) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PB16), MP_ROM_PTR(&pin_PB16) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PC06), MP_ROM_PTR(&pin_PC06) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PC04), MP_ROM_PTR(&pin_PC04) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PC07), MP_ROM_PTR(&pin_PC07) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PC05), MP_ROM_PTR(&pin_PC05) },
// EXT3 header
{ MP_OBJ_NEW_QSTR(MP_QSTR_PC02), MP_ROM_PTR(&pin_PC02) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PC03), MP_ROM_PTR(&pin_PC03) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PC10), MP_ROM_PTR(&pin_PC10) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PC01), MP_ROM_PTR(&pin_PC01) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PD11), MP_ROM_PTR(&pin_PD11) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PD10), MP_ROM_PTR(&pin_PD10) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PC31), MP_ROM_PTR(&pin_PC31) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PC30), MP_ROM_PTR(&pin_PC30) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PD09), MP_ROM_PTR(&pin_PD09) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PD08), MP_ROM_PTR(&pin_PD08) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PC22), MP_ROM_PTR(&pin_PC22) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PC23), MP_ROM_PTR(&pin_PC23) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PC04), MP_ROM_PTR(&pin_PC04) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PC14), MP_ROM_PTR(&pin_PC14) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PC05), MP_ROM_PTR(&pin_PC05) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PC07), MP_ROM_PTR(&pin_PC07) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

View File

@ -618,4 +618,23 @@ typedef struct {
.write_status_register_split = false, \
.single_status_byte = true, \
}
// Settings for the Micron N25Q256A 256Mb (32MiB) QSPI flash.
// Datasheet: https://www.micron.com/-/media/client/global/documents/products/data-sheet/nor-flash/serial-nor/n25q/n25q_256mb_3v.pdf
#define N25Q256A {\
/* .total_size = (1 << 25), 32 MiB does not work at this time, as assumptions about 3-byte addresses abound */ \
.total_size = (1 << 24), /* 16 MiB */ \
.start_up_time_us = 10000, \
.manufacturer_id = 0x20, \
.memory_type = 0xBA, \
.capacity = 0x19, \
.max_clock_speed_mhz = 108, \
.quad_enable_bit_mask = 0x02, \
.has_sector_protection = false, \
.supports_fast_read = true, \
.supports_qspi = true, \
.supports_qspi_writes = true, \
.write_status_register_split = false, \
.single_status_byte = true, \
}
#endif // MICROPY_INCLUDED_ATMEL_SAMD_EXTERNAL_FLASH_DEVICES_H