Merge pull request #2605 from maholli/master
New board: PyCubed + updates to SAM32 board
This commit is contained in:
commit
1f148242db
1
.github/workflows/build.yml
vendored
1
.github/workflows/build.yml
vendored
@ -198,6 +198,7 @@ jobs:
|
||||
- "pybadge"
|
||||
- "pybadge_airlift"
|
||||
- "pyboard_v11"
|
||||
- "pycubed"
|
||||
- "pygamer"
|
||||
- "pygamer_advance"
|
||||
- "pyportal"
|
||||
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -111,3 +111,6 @@
|
||||
[submodule "ports/mimxrt10xx/sdk"]
|
||||
path = ports/mimxrt10xx/sdk
|
||||
url = https://github.com/adafruit/MIMXRT10xx_SDK
|
||||
[submodule "frozen/Adafruit_CircuitPython_Register"]
|
||||
path = frozen/Adafruit_CircuitPython_Register
|
||||
url = https://github.com/adafruit/Adafruit_CircuitPython_Register.git
|
||||
|
1
frozen/Adafruit_CircuitPython_Register
Submodule
1
frozen/Adafruit_CircuitPython_Register
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit c525eedeb0d20c9829febfbf621eab707da71f8a
|
61
ports/atmel-samd/boards/pycubed/board.c
Normal file
61
ports/atmel-samd/boards/pycubed/board.c
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2017 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 <string.h>
|
||||
|
||||
#include "boards/board.h"
|
||||
#include "py/mpconfig.h"
|
||||
#include "shared-bindings/nvm/ByteArray.h"
|
||||
#include "common-hal/microcontroller/Pin.h"
|
||||
#include "hal/include/hal_gpio.h"
|
||||
#include "shared-bindings/pulseio/PWMOut.h"
|
||||
|
||||
nvm_bytearray_obj_t bootcnt = {
|
||||
.base = {
|
||||
.type = &nvm_bytearray_type
|
||||
},
|
||||
.len = ( uint32_t) 8192,
|
||||
.start_address = (uint8_t*) (0x00080000 - 8192)
|
||||
};
|
||||
|
||||
|
||||
void board_init(void) {
|
||||
pulseio_pwmout_obj_t pwm;
|
||||
common_hal_pulseio_pwmout_construct(&pwm, &pin_PA23, 4096, 2, false);
|
||||
common_hal_pulseio_pwmout_never_reset(&pwm);
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void reset_board(void) {
|
||||
uint8_t value_out = 0;
|
||||
common_hal_nvm_bytearray_get_bytes(&bootcnt,0,1,&value_out);
|
||||
++value_out;
|
||||
common_hal_nvm_bytearray_set_bytes(&bootcnt,0,&value_out,1);
|
||||
}
|
34
ports/atmel-samd/boards/pycubed/mpconfigboard.h
Normal file
34
ports/atmel-samd/boards/pycubed/mpconfigboard.h
Normal file
@ -0,0 +1,34 @@
|
||||
|
||||
#define MICROPY_HW_BOARD_NAME "PyCubedv04"
|
||||
#define MICROPY_HW_MCU_NAME "samd51j19"
|
||||
#define CIRCUITPY_MCU_FAMILY samd51
|
||||
|
||||
#define MICROPY_HW_NEOPIXEL (&pin_PA21)
|
||||
|
||||
#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11)
|
||||
#define MICROPY_PORT_B ( PORT_PB10 | PORT_PB11)
|
||||
#define MICROPY_PORT_C (0)
|
||||
#define MICROPY_PORT_D (0)
|
||||
|
||||
#define AUTORESET_DELAY_MS 500
|
||||
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 8192
|
||||
|
||||
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE)
|
||||
|
||||
#define EXTERNAL_FLASH_QSPI_DUAL
|
||||
|
||||
#define BOARD_HAS_CRYSTAL 1
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_PB13)
|
||||
#define DEFAULT_I2C_BUS_SDA (&pin_PB12)
|
||||
|
||||
#define DEFAULT_SPI_BUS_SCK (&pin_PA13)
|
||||
#define DEFAULT_SPI_BUS_MOSI (&pin_PA12)
|
||||
#define DEFAULT_SPI_BUS_MISO (&pin_PA14)
|
||||
|
||||
#define DEFAULT_UART_BUS_TX (&pin_PB02)
|
||||
#define DEFAULT_UART_BUS_RX (&pin_PB03)
|
||||
|
||||
#define IGNORE_PIN_PA24 1
|
||||
#define IGNORE_PIN_PA25 1
|
24
ports/atmel-samd/boards/pycubed/mpconfigboard.mk
Normal file
24
ports/atmel-samd/boards/pycubed/mpconfigboard.mk
Normal file
@ -0,0 +1,24 @@
|
||||
LD_FILE = boards/samd51x19-bootloader-external-flash.ld
|
||||
USB_VID = 0x04D8
|
||||
USB_PID = 0xEC44
|
||||
USB_PRODUCT = "PyCubed"
|
||||
USB_MANUFACTURER = "maholli"
|
||||
|
||||
CHIP_VARIANT = SAMD51J19A
|
||||
CHIP_FAMILY = samd51
|
||||
|
||||
QSPI_FLASH_FILESYSTEM = 1
|
||||
EXTERNAL_FLASH_DEVICE_COUNT = 1
|
||||
EXTERNAL_FLASH_DEVICES = W25Q80DV
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
# Not needed.
|
||||
CIRCUITPY_AUDIOBUSIO = 0
|
||||
CIRCUITPY_DISPLAYIO = 0
|
||||
CIRCUITPY_GAMEPAD = 0
|
||||
CIRCUITPY_PS2IO = 0
|
||||
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD
|
55
ports/atmel-samd/boards/pycubed/pins.c
Normal file
55
ports/atmel-samd/boards/pycubed/pins.c
Normal file
@ -0,0 +1,55 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
#include "boards/board.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_xSDCS), MP_ROM_PTR(&pin_PA27) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_RELAY_A), MP_ROM_PTR(&pin_PB15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_BURN1), MP_ROM_PTR(&pin_PB31) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_BURN2), MP_ROM_PTR(&pin_PA15) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_PA06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_L1PROG), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_AIN4), MP_ROM_PTR(&pin_PA04) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_AIN5), MP_ROM_PTR(&pin_PA05) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_CHRG), MP_ROM_PTR(&pin_PB08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_DAC0), MP_ROM_PTR(&pin_PA02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PA17), MP_ROM_PTR(&pin_PA17) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PA18), MP_ROM_PTR(&pin_PA18) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PA19), MP_ROM_PTR(&pin_PA19) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PA20), MP_ROM_PTR(&pin_PA20) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PA22), MP_ROM_PTR(&pin_PA22) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB16), MP_ROM_PTR(&pin_PB16) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB17), MP_ROM_PTR(&pin_PB17) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB22), MP_ROM_PTR(&pin_PB22) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB23), MP_ROM_PTR(&pin_PB23) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_RF1_RST), MP_ROM_PTR(&pin_PB00) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RF1_CS), MP_ROM_PTR(&pin_PB30) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RF1_IO0), MP_ROM_PTR(&pin_PB05) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RF1_IO4), MP_ROM_PTR(&pin_PB04) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_RF2_RST), MP_ROM_PTR(&pin_PB14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RF2_CS), MP_ROM_PTR(&pin_PB09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RF2_IO1), MP_ROM_PTR(&pin_PB06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RF2_BSY), MP_ROM_PTR(&pin_PB07) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_EN_GPS), MP_ROM_PTR(&pin_PB01) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB03) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB13) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_WDT_WDI), MP_ROM_PTR(&pin_PA23) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA21) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
|
||||
{ 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_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
|
@ -1,23 +1,22 @@
|
||||
|
||||
#define MICROPY_HW_BOARD_NAME "SAM32v2a"
|
||||
#define MICROPY_HW_BOARD_NAME "SAM32v26"
|
||||
#define MICROPY_HW_MCU_NAME "samd51j20"
|
||||
#define CIRCUITPY_MCU_FAMILY samd51
|
||||
|
||||
#define MICROPY_HW_LED_STATUS (&pin_PA27)
|
||||
#define MICROPY_HW_NEOPIXEL (&pin_PA15)
|
||||
#define MICROPY_HW_NEOPIXEL (&pin_PA15)
|
||||
|
||||
#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25)
|
||||
#define MICROPY_PORT_B (0)
|
||||
#define MICROPY_PORT_C (0)
|
||||
#define MICROPY_PORT_D (0)
|
||||
#define MICROPY_PORT_D (0)
|
||||
|
||||
// No microcontroller.nvm
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
|
||||
#define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE (128*1024)
|
||||
|
||||
#define BOARD_HAS_CRYSTAL 1
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_PA04)
|
||||
#define DEFAULT_I2C_BUS_SDA (&pin_PA07)
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_PA09)
|
||||
#define DEFAULT_I2C_BUS_SDA (&pin_PA08)
|
||||
|
||||
#define DEFAULT_SPI_BUS_SCK (&pin_PB13)
|
||||
#define DEFAULT_SPI_BUS_MOSI (&pin_PB12)
|
||||
|
@ -8,3 +8,10 @@ CHIP_FAMILY = samd51
|
||||
|
||||
INTERNAL_FLASH_FILESYSTEM = 1
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
# No I2S on SAMD51
|
||||
CIRCUITPY_AUDIOBUSIO = 0
|
||||
CIRCUITPY_USTACK = 1
|
||||
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
|
@ -1,10 +1,8 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PB08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_PB08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_PB09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PB04) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PB05) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_PB06) },
|
||||
@ -13,15 +11,14 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PB13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PB14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_xSDCS),MP_ROM_PTR(&pin_PB15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_xSDCS),MP_ROM_PTR(&pin_PA04) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_DAC0), MP_ROM_PTR(&pin_PA02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_DAC1), MP_ROM_PTR(&pin_PA05) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_PA10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D20), MP_ROM_PTR(&pin_PA11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D29), MP_ROM_PTR(&pin_PA12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D30), MP_ROM_PTR(&pin_PA13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D31), MP_ROM_PTR(&pin_PA14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_PA16) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_PA17) },
|
||||
@ -35,12 +32,24 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_D50), MP_ROM_PTR(&pin_PB23) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D59), MP_ROM_PTR(&pin_PB30) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D60), MP_ROM_PTR(&pin_PB31) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D64), MP_ROM_PTR(&pin_PB03) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D61), MP_ROM_PTR(&pin_PB00) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_PB01) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_PB02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_PB03) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_TCK), MP_ROM_PTR(&pin_PB01) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TDI), MP_ROM_PTR(&pin_PB02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TMS), MP_ROM_PTR(&pin_PB03) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_ESP_CS),MP_ROM_PTR(&pin_PB15) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB16) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB17) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA04) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TX1), MP_ROM_PTR(&pin_PA12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RX1), MP_ROM_PTR(&pin_PA13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TX2), MP_ROM_PTR(&pin_PB16) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RX2), MP_ROM_PTR(&pin_PB17) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA09) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_RTS), MP_ROM_PTR(&pin_PB11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_DTR), MP_ROM_PTR(&pin_PB10) },
|
||||
|
Loading…
Reference in New Issue
Block a user