Move atmel-samd to tinyusb and support nRF flash.

This started while adding USB MIDI support (and descriptor support is
in this change.) When seeing that I'd have to implement the MIDI class
logic twice, once for atmel-samd and once for nrf, I decided to refactor
the USB stack so its shared across ports. This has led to a number of
changes that remove items from the ports folder and move them into
supervisor.

Furthermore, we had external SPI flash support for nrf pending so I
factored out the connection between the usb stack and the flash API as
well. This PR also includes the QSPI support for nRF.
crypto-aes
Scott Shawcroft 4 years ago
parent d08747d374
commit 9d91111b1b
No known key found for this signature in database
GPG Key ID: FD0EDC4B6C53CA59
  1. 2
      .gitmodules
  2. 2
      lib/tinyusb
  3. 3
      main.c
  4. 72
      ports/atmel-samd/Makefile
  5. 7
      ports/atmel-samd/background.c
  6. 7
      ports/atmel-samd/boards/arduino_zero/board.c
  7. 8
      ports/atmel-samd/boards/arduino_zero/mpconfigboard.h
  8. 39
      ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h
  9. 2
      ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk
  10. 40
      ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h
  11. 2
      ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk
  12. 4
      ports/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.h
  13. 4
      ports/atmel-samd/boards/feather_m0_basic/mpconfigboard.h
  14. 37
      ports/atmel-samd/boards/feather_m0_express/mpconfigboard.h
  15. 2
      ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk
  16. 38
      ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.h
  17. 2
      ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk
  18. 4
      ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.h
  19. 4
      ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.h
  20. 37
      ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.h
  21. 2
      ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.mk
  22. 7
      ports/atmel-samd/boards/feather_m4_express/mpconfigboard.h
  23. 3
      ports/atmel-samd/boards/feather_m4_express/mpconfigboard.mk
  24. 38
      ports/atmel-samd/boards/feather_radiofruit_zigbee/mpconfigboard.h
  25. 2
      ports/atmel-samd/boards/feather_radiofruit_zigbee/mpconfigboard.mk
  26. 2
      ports/atmel-samd/boards/gemma_m0/mpconfigboard.h
  27. 7
      ports/atmel-samd/boards/grandcentral_m4_express/board.c
  28. 11
      ports/atmel-samd/boards/grandcentral_m4_express/mpconfigboard.h
  29. 3
      ports/atmel-samd/boards/grandcentral_m4_express/mpconfigboard.mk
  30. 41
      ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.h
  31. 2
      ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk
  32. 38
      ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.h
  33. 2
      ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.mk
  34. 7
      ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.h
  35. 2
      ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk
  36. 6
      ports/atmel-samd/boards/meowmeow/mpconfigboard.h
  37. 39
      ports/atmel-samd/boards/metro_m0_express/mpconfigboard.h
  38. 4
      ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk
  39. 7
      ports/atmel-samd/boards/metro_m4_express/board.c
  40. 19
      ports/atmel-samd/boards/metro_m4_express/mpconfigboard.h
  41. 3
      ports/atmel-samd/boards/metro_m4_express/mpconfigboard.mk
  42. 2
      ports/atmel-samd/boards/pirkey_m0/mpconfigboard.h
  43. 7
      ports/atmel-samd/boards/trellis_m4_express/mpconfigboard.h
  44. 2
      ports/atmel-samd/boards/trellis_m4_express/mpconfigboard.mk
  45. 2
      ports/atmel-samd/boards/trinket_m0/mpconfigboard.h
  46. 42
      ports/atmel-samd/boards/trinket_m0_haxpress/mpconfigboard.h
  47. 2
      ports/atmel-samd/boards/trinket_m0_haxpress/mpconfigboard.mk
  48. 39
      ports/atmel-samd/boards/ugame10/mpconfigboard.h
  49. 2
      ports/atmel-samd/boards/ugame10/mpconfigboard.mk
  50. 47
      ports/atmel-samd/common-hal/busio/SPI.c
  51. 3
      ports/atmel-samd/common-hal/busio/SPI.h
  52. 15
      ports/atmel-samd/common-hal/microcontroller/Pin.c
  53. 1
      ports/atmel-samd/common-hal/microcontroller/Pin.h
  54. 220
      ports/atmel-samd/common-hal/microcontroller/__init__.c
  55. 7
      ports/atmel-samd/common-hal/supervisor/Runtime.c
  56. 106
      ports/atmel-samd/common-hal/usb_hid/Device.c
  57. 152
      ports/atmel-samd/common-hal/usb_hid/__init__.c
  58. 64
      ports/atmel-samd/external_flash/external_flash.h
  59. 10
      ports/atmel-samd/mpconfigport.h
  60. 2
      ports/atmel-samd/mpconfigport.mk
  61. 34
      ports/atmel-samd/mphalport.c
  62. 2
      ports/atmel-samd/mphalport.h
  63. 2
      ports/atmel-samd/peripherals
  64. 4
      ports/atmel-samd/reset.c
  65. 110
      ports/atmel-samd/supervisor/internal_flash.c
  66. 0
      ports/atmel-samd/supervisor/internal_flash.h
  67. 31
      ports/atmel-samd/supervisor/internal_flash_root_pointers.h
  68. 39
      ports/atmel-samd/supervisor/port.c
  69. 22
      ports/atmel-samd/supervisor/qspi_flash.c
  70. 79
      ports/atmel-samd/supervisor/serial.c
  71. 59
      ports/atmel-samd/supervisor/usb.c
  72. 2
      ports/atmel-samd/tick.h
  73. 326
      ports/atmel-samd/usb.c
  74. 338
      ports/atmel-samd/usb_mass_storage.c
  75. 2
      ports/esp8266/Makefile
  76. 2
      ports/esp8266/mpconfigport.h
  77. 48
      ports/nrf/Makefile
  78. 2
      ports/nrf/README.md
  79. 11
      ports/nrf/background.c
  80. 2
      ports/nrf/board_busses.c
  81. 2
      ports/nrf/boards/feather_nrf52840_express/board.c
  82. 23
      ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h
  83. 9
      ports/nrf/boards/feather_nrf52840_express/mpconfigboard.mk
  84. 2
      ports/nrf/boards/makerdiary_nrf52840_mdk/board.c
  85. 25
      ports/nrf/boards/makerdiary_nrf52840_mdk/mpconfigboard.h
  86. 9
      ports/nrf/boards/makerdiary_nrf52840_mdk/mpconfigboard.mk
  87. 2
      ports/nrf/boards/pca10056/board.c
  88. 23
      ports/nrf/boards/pca10056/mpconfigboard.h
  89. 9
      ports/nrf/boards/pca10056/mpconfigboard.mk
  90. 5
      ports/nrf/boards/pca10059/board.c
  91. 5
      ports/nrf/boards/pca10059/mpconfigboard.mk
  92. 18
      ports/nrf/common-hal/busio/SPI.c
  93. 2
      ports/nrf/common-hal/busio/UART.c
  94. 5
      ports/nrf/common-hal/digitalio/DigitalInOut.c
  95. 13
      ports/nrf/common-hal/microcontroller/Pin.c
  96. 1
      ports/nrf/common-hal/microcontroller/Pin.h
  97. 7
      ports/nrf/common-hal/microcontroller/Processor.c
  98. 2
      ports/nrf/common-hal/pulseio/PulseIn.c
  99. 2
      ports/nrf/common-hal/pulseio/PulseOut.c
  100. 94
      ports/nrf/common-hal/usb_hid/Device.h
  101. Some files were not shown because too many files have changed in this diff Show More

2
.gitmodules vendored

@ -78,7 +78,7 @@
url = https://github.com/adafruit/nrfx.git
[submodule "lib/tinyusb"]
path = lib/tinyusb
url = https://github.com/hathach/tinyusb.git
url = https://github.com/tannewt/tinyusb.git
branch = develop
[submodule "tools/huffman"]
path = tools/huffman

@ -1 +1 @@
Subproject commit 33c61bfda2c3aada3cb06d36e12d7cf57da02037
Subproject commit 30e3c64134789416e10ed867fa12c210b808e98f

@ -51,6 +51,7 @@
#include "supervisor/shared/autoreload.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/rgb_led_status.h"
#include "supervisor/shared/status_leds.h"
#include "supervisor/shared/stack.h"
#include "supervisor/serial.h"
@ -388,6 +389,8 @@ int __attribute__((used)) main(void) {
// initialise the cpu and peripherals
safe_mode_t safe_mode = port_init();
// Turn on LEDs
init_status_leds();
rgb_led_status_init();
stack_init();

@ -45,16 +45,13 @@ INC += -I. \
-Iasf4/$(CHIP_FAMILY)/hpl/tc \
-Iasf4/$(CHIP_FAMILY)/include \
-Iasf4/$(CHIP_FAMILY)/CMSIS/Include \
-Iasf4/$(CHIP_FAMILY)/usb \
-Iasf4/$(CHIP_FAMILY)/usb/class/cdc \
-Iasf4/$(CHIP_FAMILY)/usb/class/hid \
-Iasf4/$(CHIP_FAMILY)/usb/class/msc \
-Iasf4/$(CHIP_FAMILY)/usb/device \
-Iasf4_conf/$(CHIP_FAMILY) \
-Iboards/$(BOARD) \
-Iboards/ \
-Iperipherals/ \
-Ifreetouch \
-I../../lib/tinyusb/src \
-I../../supervisor/shared/usb \
-I$(BUILD)
BASE_CFLAGS = \
@ -90,11 +87,15 @@ BASE_CFLAGS = \
# NDEBUG disables assert() statements. This reduces code size pretty dramatically, per tannewt.
ifeq ($(CHIP_FAMILY), samd21)
CFLAGS = -Os -DNDEBUG
CFLAGS += -Os -DNDEBUG
# TinyUSB defines
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD21 -DCFG_TUD_CDC_RX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=128 -DCFG_TUD_MSC_BUFSIZE=512
endif
ifeq ($(CHIP_FAMILY), samd51)
CFLAGS = -Os -DNDEBUG
CFLAGS += -O0 -DNDEBUG
# TinyUSB defines
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD51 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024
endif
#Debugging/Optimization
@ -104,7 +105,7 @@ ifeq ($(DEBUG), 1)
# You may want to disable -flto if it interferes with debugging.
CFLAGS += -flto
# You may want to enable these flags to make setting breakpoints easier.
## CFLAGS += -fno-inline -fno-ipa-sra
# CFLAGS += -fno-inline -fno-ipa-sra
ifeq ($(CHIP_FAMILY), samd21)
CFLAGS += -DENABLE_MICRO_TRACE_BUFFER
endif
@ -204,7 +205,6 @@ SRC_ASF := \
hal/src/hal_spi_m_sync.c \
hal/src/hal_timer.c \
hal/src/hal_usart_async.c \
hal/src/hal_usb_device.c \
hpl/adc/hpl_adc.c \
hpl/core/hpl_init.c \
hpl/dac/hpl_dac.c \
@ -214,12 +214,6 @@ SRC_ASF := \
hpl/rtc/hpl_rtc.c \
hpl/sercom/hpl_sercom.c \
hpl/systick/hpl_systick.c \
hpl/usb/hpl_usb.c \
usb/class/cdc/device/cdcdf_acm.c \
usb/class/hid/device/hiddf_generic.c \
usb/class/msc/device/mscdf.c \
usb/device/usbdc.c \
usb/usb_protocol.c \
hal/utils/src/utils_list.c \
hal/utils/src/utils_ringbuffer.c \
@ -246,7 +240,6 @@ SRC_C = \
board_busses.c \
background.c \
fatfs_port.c \
flash_api.c \
mphalport.c \
reset.c \
peripherals/samd/clocks.c \
@ -265,8 +258,6 @@ SRC_C = \
peripherals/samd/$(CHIP_FAMILY)/sercom.c \
peripherals/samd/$(CHIP_FAMILY)/timers.c \
tick.c \
usb.c \
usb_mass_storage.c \
bindings/samd/__init__.c \
bindings/samd/Clock.c \
boards/$(BOARD)/board.c \
@ -274,6 +265,8 @@ SRC_C = \
lib/oofatfs/ff.c \
lib/oofatfs/option/ccsbcs.c \
lib/timeutils/timeutils.c \
lib/tinyusb/src/portable/microchip/$(CHIP_FAMILY)/dcd.c \
lib/tinyusb/src/portable/microchip/$(CHIP_FAMILY)/hal.c \
lib/utils/buffer_helper.c \
lib/utils/context_manager_helpers.c \
lib/utils/interrupt_char.c \
@ -282,7 +275,6 @@ SRC_C = \
lib/utils/sys_stdio_mphal.c \
lib/libc/string0.c \
lib/mp-readline/readline.c \
$(BUILD)/autogen_usb_descriptor.c \
freetouch/adafruit_ptc.c \
supervisor/shared/memory.c
@ -306,19 +298,6 @@ SRC_MOD += $(addprefix $(WIZNET5K_DIR)/,\
endif # MICROPY_PY_WIZNET5K
endif # MICROPY_PY_NETWORK
# Choose which flash filesystem impl to use.
# (Right now INTERNAL_FLASH_FILESYSTEM and SPI_FLASH_FILESYSTEM are mutually exclusive.
# But that might not be true in the future.)
ifeq ($(INTERNAL_FLASH_FILESYSTEM),1)
SRC_C += internal_flash.c
endif
ifeq ($(SPI_FLASH_FILESYSTEM),1)
SRC_C += external_flash/external_flash.c external_flash/spi_flash.c
endif
ifeq ($(QSPI_FLASH_FILESYSTEM),1)
SRC_C += external_flash/external_flash.c external_flash/qspi_flash.c
endif
SRC_COMMON_HAL = \
board/__init__.c \
busio/__init__.c \
@ -339,7 +318,6 @@ SRC_COMMON_HAL = \
rotaryio/IncrementalEncoder.c \
rtc/__init__.c \
rtc/RTC.c \
storage/__init__.c \
supervisor/__init__.c \
supervisor/Runtime.c \
time/__init__.c \
@ -352,10 +330,8 @@ SRC_COMMON_HAL = \
pulseio/PulseIn.c \
pulseio/PulseOut.c \
pulseio/PWMOut.c \
usb_hid/__init__.c \
usb_hid/Device.c \
touchio/__init__.c \
touchio/TouchIn.c \
touchio/TouchIn.c
ifeq ($(INTERNAL_LIBM),1)
SRC_LIBM = $(addprefix lib/,\
@ -412,12 +388,17 @@ SRC_SHARED_MODULE = \
_stage/__init__.c \
_stage/Layer.c \
_stage/Text.c \
storage/__init__.c \
os/__init__.c \
random/__init__.c \
storage/__init__.c \
struct/__init__.c \
uheap/__init__.c \
ustack/__init__.c
ustack/__init__.c \
usb_hid/__init__.c \
usb_hid/Device.c
# usb_midi/__init__.c
# usb_midi/Port.c
ifeq ($(MICROPY_PY_NETWORK),1)
SRC_SHARED_MODULE += socket/__init__.c network/__init__.c
@ -489,21 +470,6 @@ $(BUILD)/firmware.uf2: $(BUILD)/firmware.bin
$(STEPECHO) "Create $@"
$(Q)$(PYTHON3) $(TOP)/tools/uf2/utils/uf2conv.py -b $(BOOTLOADER_SIZE) -c -o $@ $^
$(BUILD)/autogen_usb_descriptor.c $(BUILD)/genhdr/autogen_usb_descriptor.h: autogen_usb_descriptor.intermediate
.INTERMEDIATE: autogen_usb_descriptor.intermediate
autogen_usb_descriptor.intermediate: tools/gen_usb_descriptor.py Makefile | $(HEADER_BUILD)
$(STEPECHO) "GEN $@"
$(Q)install -d $(BUILD)/genhdr
$(Q)$(PYTHON3) tools/gen_usb_descriptor.py \
--manufacturer $(USB_MANUFACTURER)\
--product $(USB_PRODUCT)\
--vid $(USB_VID)\
--pid $(USB_PID)\
--output_c_file $(BUILD)/autogen_usb_descriptor.c\
--output_h_file $(BUILD)/genhdr/autogen_usb_descriptor.h
deploy: $(BUILD)/firmware.bin
$(ECHO) "Writing $< to the board"
$(BOSSAC) -u $<

@ -27,8 +27,7 @@
#include "audio_dma.h"
#include "tick.h"
#include "usb.h"
#include "usb_mass_storage.h"
#include "supervisor/usb.h"
#include "shared-module/displayio/__init__.h"
#include "shared-module/network/__init__.h"
@ -45,8 +44,8 @@ void run_background_tasks(void) {
#if MICROPY_PY_NETWORK
network_module_background();
#endif
usb_msc_background();
usb_cdc_background();
usb_background();
last_finished_tick = ticks_ms;
}

@ -30,13 +30,6 @@
void board_init(void)
{
gpio_set_pin_function(MICROPY_HW_LED_TX, GPIO_PIN_FUNCTION_OFF);
gpio_set_pin_direction(MICROPY_HW_LED_TX, GPIO_DIRECTION_OUT);
gpio_set_pin_level(MICROPY_HW_LED_TX, true);
gpio_set_pin_function(MICROPY_HW_LED_RX, GPIO_PIN_FUNCTION_OFF);
gpio_set_pin_direction(MICROPY_HW_LED_RX, GPIO_DIRECTION_OUT);
gpio_set_pin_level(MICROPY_HW_LED_RX, true);
}
bool board_requests_safe_mode(void) {

@ -1,16 +1,14 @@
#define MICROPY_HW_BOARD_NAME "Arduino Zero"
#define MICROPY_HW_MCU_NAME "samd21g18"
// #define MICROPY_HW_LED_MSC PIN_PA17 // red
#define MICROPY_HW_LED_TX PIN_PA27
#define MICROPY_HW_LED_RX PIN_PB03
// #define MICROPY_HW_LED_MSC &pin_PA17 // red
#define MICROPY_HW_LED_TX &pin_PA27
#define MICROPY_HW_LED_RX &pin_PB03
#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25 | PORT_PA27)
#define MICROPY_PORT_B (PORT_PB03)
#define MICROPY_PORT_C (0)
#include "internal_flash.h"
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)

@ -8,52 +8,25 @@
#define SPI_FLASH_BAUDRATE (8000000)
// On-board flash
#define SPI_FLASH_MOSI_PIN PIN_PA20
#define SPI_FLASH_MISO_PIN PIN_PA16
#define SPI_FLASH_SCK_PIN PIN_PA21
#define SPI_FLASH_CS_PIN PIN_PB22
#define SPI_FLASH_MOSI_PIN_FUNCTION PINMUX_PA20D_SERCOM3_PAD2
#define SPI_FLASH_MISO_PIN_FUNCTION PINMUX_PA16D_SERCOM3_PAD0
#define SPI_FLASH_SCK_PIN_FUNCTION PINMUX_PA21D_SERCOM3_PAD3
#define SPI_FLASH_SERCOM SERCOM3
#define SPI_FLASH_SERCOM_INDEX 3
#define SPI_FLASH_MOSI_PAD 2
#define SPI_FLASH_MISO_PAD 0
#define SPI_FLASH_SCK_PAD 3
// <o> Transmit Data Pinout
// <0x0=>PAD[0,1]_DO_SCK
// <0x1=>PAD[2,3]_DO_SCK
// <0x2=>PAD[3,1]_DO_SCK
// <0x3=>PAD[0,3]_DO_SCK
#define SPI_FLASH_DOPO 1
#define SPI_FLASH_DIPO 0 // same as MISO PAD
#define SPI_FLASH_MOSI_PIN &pin_PA20
#define SPI_FLASH_MISO_PIN &pin_PA16
#define SPI_FLASH_SCK_PIN &pin_PA21
#define SPI_FLASH_CS_PIN &pin_PB22
// These are pins not to reset.
// PA24 and PA25 are USB.
#define MICROPY_PORT_A (PORT_PA16 | PORT_PA20 | PORT_PA21 | PORT_PA24 | PORT_PA25)
#define MICROPY_PORT_B (PORT_PB22)
#define MICROPY_PORT_A (0)
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
#define SPEAKER_ENABLE_PIN (&pin_PA30)
#include "external_flash/devices.h"
// If you change this, then make sure to update the linker scripts as well to
// make sure you don't overwrite code.
#define CIRCUITPY_INTERNAL_NVM_SIZE 256
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#include "external_flash/devices.h"
#define EXTERNAL_FLASH_DEVICE_COUNT 2
#define EXTERNAL_FLASH_DEVICES S25FL216K, \
GD25Q16C
#include "external_flash/external_flash.h"
#define CALIBRATE_CRYSTALLESS 1
// Explanation of how a user got into safe mode.

@ -5,6 +5,8 @@ USB_PRODUCT = "CircuitPlayground Express"
USB_MANUFACTURER = "Adafruit Industries LLC"
SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 2
EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C"
LONGINT_IMPL = MPZ
CHIP_VARIANT = SAMD21G18A

@ -11,52 +11,24 @@
#define SPI_FLASH_BAUDRATE (8000000)
// On-board flash
#define SPI_FLASH_MOSI_PIN PIN_PA20
#define SPI_FLASH_MISO_PIN PIN_PA16
#define SPI_FLASH_SCK_PIN PIN_PA21
#define SPI_FLASH_CS_PIN PIN_PB22
#define SPI_FLASH_MOSI_PIN_FUNCTION PINMUX_PA20D_SERCOM3_PAD2
#define SPI_FLASH_MISO_PIN_FUNCTION PINMUX_PA16D_SERCOM3_PAD0
#define SPI_FLASH_SCK_PIN_FUNCTION PINMUX_PA21D_SERCOM3_PAD3
#define SPI_FLASH_SERCOM SERCOM3
#define SPI_FLASH_SERCOM_INDEX 3
#define SPI_FLASH_MOSI_PAD 2
#define SPI_FLASH_MISO_PAD 0
#define SPI_FLASH_SCK_PAD 3
// <o> Transmit Data Pinout
// <0x0=>PAD[0,1]_DO_SCK
// <0x1=>PAD[2,3]_DO_SCK
// <0x2=>PAD[3,1]_DO_SCK
// <0x3=>PAD[0,3]_DO_SCK
#define SPI_FLASH_DOPO 1
#define SPI_FLASH_DIPO 0 // same as MISO PAD
#define SPI_FLASH_MOSI_PIN &pin_PA20
#define SPI_FLASH_MISO_PIN &pin_PA16
#define SPI_FLASH_SCK_PIN &pin_PA21
#define SPI_FLASH_CS_PIN &pin_PB22
// These are pins not to reset.
// PA24 and PA25 are USB.
#define MICROPY_PORT_A (PORT_PA16 | PORT_PA20 | PORT_PA21 | PORT_PA24 | PORT_PA25)
#define MICROPY_PORT_B (PORT_PB22)
#define MICROPY_PORT_A (0)
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
#define SPEAKER_ENABLE_PIN (&pin_PA30)
#include "external_flash/devices.h"
// If you change this, then make sure to update the linker scripts as well to
// make sure you don't overwrite code.
#define CIRCUITPY_INTERNAL_NVM_SIZE 256
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#include "external_flash/devices.h"
#define EXTERNAL_FLASH_DEVICE_COUNT 2
#define EXTERNAL_FLASH_DEVICES S25FL216K, \
GD25Q16C
#include "external_flash/external_flash.h"
#define CALIBRATE_CRYSTALLESS 1
// Explanation of how a user got into safe mode.

@ -5,6 +5,8 @@ USB_PRODUCT = "CircuitPlayground Express with Crickit libraries"
USB_MANUFACTURER = "Adafruit Industries LLC"
SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 2
EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C"
# Turn off longints for Crickit build to make room for additional frozen libs.
LONGINT_IMPL = NONE

@ -3,12 +3,10 @@
#define MICROPY_HW_BOARD_NAME "Adafruit Feather M0 Adalogger"
#define MICROPY_HW_MCU_NAME "samd21g18"
#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25)
#define MICROPY_PORT_A (0)
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
#include "internal_flash.h"
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)

@ -4,12 +4,10 @@
#define MICROPY_HW_BOARD_NAME "Adafruit Feather M0 Basic"
#define MICROPY_HW_MCU_NAME "samd21g18"
#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25)
#define MICROPY_PORT_A (0)
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
#include "internal_flash.h"
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)

@ -3,35 +3,16 @@
#define MICROPY_HW_NEOPIXEL (&pin_PA06)
// Clock rates are off: Salae reads 12MHz which is the limit even though we set it to the safer 8MHz.
#define SPI_FLASH_BAUDRATE (8000000)
#define SPI_FLASH_MOSI_PIN PIN_PA08
#define SPI_FLASH_MISO_PIN PIN_PA14
#define SPI_FLASH_SCK_PIN PIN_PA09
#define SPI_FLASH_CS_PIN PIN_PA13
#define SPI_FLASH_MOSI_PIN_FUNCTION PINMUX_PA08D_SERCOM2_PAD0
#define SPI_FLASH_MISO_PIN_FUNCTION PINMUX_PA14C_SERCOM2_PAD2
#define SPI_FLASH_SCK_PIN_FUNCTION PINMUX_PA09D_SERCOM2_PAD1
#define SPI_FLASH_SERCOM SERCOM2
#define SPI_FLASH_SERCOM_INDEX 2
#define SPI_FLASH_MOSI_PAD 0
#define SPI_FLASH_MISO_PAD 2
#define SPI_FLASH_SCK_PAD 1
// <o> Transmit Data Pinout
// <0x0=>PAD[0,1]_DO_SCK
// <0x1=>PAD[2,3]_DO_SCK
// <0x2=>PAD[3,1]_DO_SCK
// <0x3=>PAD[0,3]_DO_SCK
#define SPI_FLASH_DOPO 0
#define SPI_FLASH_DIPO 2 // same as MISO pad
#define SPI_FLASH_MOSI_PIN &pin_PA08
#define SPI_FLASH_MISO_PIN &pin_PA14
#define SPI_FLASH_SCK_PIN &pin_PA09
#define SPI_FLASH_CS_PIN &pin_PA13
// These are pins not to reset.
#define MICROPY_PORT_A (PORT_PA06 | PORT_PA08 | PORT_PA09 | PORT_PA13 | PORT_PA14 | PORT_PA24 | PORT_PA25)
#define MICROPY_PORT_A (PORT_PA06)
#define MICROPY_PORT_B ( 0 )
#define MICROPY_PORT_C ( 0 )
#include "external_flash/external_flash.h"
// If you change this, then make sure to update the linker scripts as well to
// make sure you don't overwrite code.
@ -39,14 +20,6 @@
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#include "external_flash/devices.h"
#define EXTERNAL_FLASH_DEVICE_COUNT 2
#define EXTERNAL_FLASH_DEVICES S25FL216K, \
GD25Q16C
#include "external_flash/external_flash.h"
#define BOARD_HAS_CRYSTAL 1
#define DEFAULT_I2C_BUS_SCL (&pin_PA23)

@ -5,6 +5,8 @@ USB_PRODUCT = "Feather M0 Express"
USB_MANUFACTURER = "Adafruit Industries LLC"
SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 2
EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C"
LONGINT_IMPL = MPZ
CHIP_VARIANT = SAMD21G18A

@ -3,50 +3,22 @@
#define MICROPY_HW_NEOPIXEL (&pin_PA06)
// Clock rates are off: Salae reads 12MHz which is the limit even though we set it to the safer 8MHz.
#define SPI_FLASH_BAUDRATE (8000000)
#define SPI_FLASH_MOSI_PIN PIN_PA08
#define SPI_FLASH_MISO_PIN PIN_PA14
#define SPI_FLASH_SCK_PIN PIN_PA09
#define SPI_FLASH_CS_PIN PIN_PA13
#define SPI_FLASH_MOSI_PIN_FUNCTION PINMUX_PA08D_SERCOM2_PAD0
#define SPI_FLASH_MISO_PIN_FUNCTION PINMUX_PA14C_SERCOM2_PAD2
#define SPI_FLASH_SCK_PIN_FUNCTION PINMUX_PA09D_SERCOM2_PAD1
#define SPI_FLASH_SERCOM SERCOM2
#define SPI_FLASH_SERCOM_INDEX 2
#define SPI_FLASH_MOSI_PAD 0
#define SPI_FLASH_MISO_PAD 2
#define SPI_FLASH_SCK_PAD 1
// <o> Transmit Data Pinout
// <0x0=>PAD[0,1]_DO_SCK
// <0x1=>PAD[2,3]_DO_SCK
// <0x2=>PAD[3,1]_DO_SCK
// <0x3=>PAD[0,3]_DO_SCK
#define SPI_FLASH_DOPO 0
#define SPI_FLASH_DIPO 2 // same as MISO pad
#define SPI_FLASH_MOSI_PIN &pin_PA08
#define SPI_FLASH_MISO_PIN &pin_PA14
#define SPI_FLASH_SCK_PIN &pin_PA09
#define SPI_FLASH_CS_PIN &pin_PA13
// These are pins not to reset.
#define MICROPY_PORT_A (PORT_PA06 | PORT_PA08 | PORT_PA09 | PORT_PA13 | PORT_PA14 | PORT_PA24 | PORT_PA25)
#define MICROPY_PORT_A (PORT_PA06)
#define MICROPY_PORT_B ( 0 )
#define MICROPY_PORT_C ( 0 )
#include "external_flash/external_flash.h"
// If you change this, then make sure to update the linker scripts as well to
// make sure you don't overwrite code.
#define CIRCUITPY_INTERNAL_NVM_SIZE 256
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#include "external_flash/devices.h"
#define EXTERNAL_FLASH_DEVICE_COUNT 2
#define EXTERNAL_FLASH_DEVICES S25FL216K, \
GD25Q16C
#include "external_flash/external_flash.h"
#define BOARD_HAS_CRYSTAL 1
#define DEFAULT_I2C_BUS_SCL (&pin_PA23)

@ -5,6 +5,8 @@ USB_PRODUCT = "Feather M0 Express"
USB_MANUFACTURER = "Adafruit Industries LLC"
SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 2
EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C"
LONGINT_IMPL = MPZ
CHIP_VARIANT = SAMD21G18A

@ -4,12 +4,10 @@
#define MICROPY_HW_BOARD_NAME "Adafruit Feather M0 RFM69"
#define MICROPY_HW_MCU_NAME "samd21g18"
#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25)
#define MICROPY_PORT_A (0)
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
#include "internal_flash.h"
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)

@ -4,12 +4,10 @@
#define MICROPY_HW_BOARD_NAME "Adafruit Feather M0 RFM9x"
#define MICROPY_HW_MCU_NAME "samd21g18"
#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25)
#define MICROPY_PORT_A (0)
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
#include "internal_flash.h"
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)

@ -5,49 +5,22 @@
#define MICROPY_HW_NEOPIXEL (&pin_PA06)
// Clock rates are off: Salae reads 12MHz which is the limit even though we set it to the safer 8MHz.
#define SPI_FLASH_BAUDRATE (8000000)
#define SPI_FLASH_MOSI_PIN PIN_PA08
#define SPI_FLASH_MISO_PIN PIN_PA14
#define SPI_FLASH_SCK_PIN PIN_PA09
#define SPI_FLASH_CS_PIN PIN_PA13
#define SPI_FLASH_MOSI_PIN_FUNCTION PINMUX_PA08D_SERCOM2_PAD0
#define SPI_FLASH_MISO_PIN_FUNCTION PINMUX_PA14C_SERCOM2_PAD2
#define SPI_FLASH_SCK_PIN_FUNCTION PINMUX_PA09D_SERCOM2_PAD1
#define SPI_FLASH_SERCOM SERCOM2
#define SPI_FLASH_SERCOM_INDEX 2
#define SPI_FLASH_MOSI_PAD 0
#define SPI_FLASH_MISO_PAD 2
#define SPI_FLASH_SCK_PAD 1
// <o> Transmit Data Pinout
// <0x0=>PAD[0,1]_DO_SCK
// <0x1=>PAD[2,3]_DO_SCK
// <0x2=>PAD[3,1]_DO_SCK
// <0x3=>PAD[0,3]_DO_SCK
#define SPI_FLASH_DOPO 0
#define SPI_FLASH_DIPO 2 // same as MISO pad
#define SPI_FLASH_MOSI_PIN &pin_PA08
#define SPI_FLASH_MISO_PIN &pin_PA14
#define SPI_FLASH_SCK_PIN &pin_PA09
#define SPI_FLASH_CS_PIN &pin_PA13
// These are pins not to reset.
#define MICROPY_PORT_A (PORT_PA06 | PORT_PA08 | PORT_PA09 | PORT_PA13 | PORT_PA14 | PORT_PA24 | PORT_PA25)
#define MICROPY_PORT_A (PORT_PA06)
#define MICROPY_PORT_B ( 0 )
#define MICROPY_PORT_C ( 0 )
#include "external_flash/external_flash.h"
// If you change this, then make sure to update the linker scripts as well to
// make sure you don't overwrite code.
#define CIRCUITPY_INTERNAL_NVM_SIZE 256
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#include "external_flash/devices.h"
#define EXTERNAL_FLASH_DEVICE_COUNT 1
#define EXTERNAL_FLASH_DEVICES S25FL064L
#include "external_flash/external_flash.h"
#define DEFAULT_I2C_BUS_SCL (&pin_PA23)
#define DEFAULT_I2C_BUS_SDA (&pin_PA22)

@ -5,6 +5,8 @@ USB_PRODUCT = "Feather M0 Supersized"
USB_MANUFACTURER = "Dave Astels"
SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 1
EXTERNAL_FLASH_DEVICES = "S25FL064L"
LONGINT_IMPL = MPZ
CHIP_VARIANT = SAMD21G18A

@ -23,15 +23,8 @@
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#include "external_flash/devices.h"
#define EXTERNAL_FLASH_DEVICE_COUNT 1
#define EXTERNAL_FLASH_DEVICES GD25Q16C
#define EXTERNAL_FLASH_QSPI_DUAL
#include "external_flash/external_flash.h"
#define BOARD_HAS_CRYSTAL 1
#define DEFAULT_I2C_BUS_SCL (&pin_PA13)

@ -5,6 +5,9 @@ USB_PRODUCT = "Feather M4 Express"
USB_MANUFACTURER = "Adafruit Industries LLC"
QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 1
EXTERNAL_FLASH_DEVICES = GD25Q16C
LONGINT_IMPL = MPZ
CHIP_VARIANT = SAMD51J19A

@ -3,50 +3,22 @@
#define MICROPY_HW_NEOPIXEL (&pin_PA22)
// Clock rates are off: Salae reads 12MHz which is the limit even though we set it to the safer 8MHz.
#define SPI_FLASH_BAUDRATE (8000000)
#define SPI_FLASH_MOSI_PIN PIN_PA31
#define SPI_FLASH_MISO_PIN PIN_PA30
#define SPI_FLASH_SCK_PIN PIN_PA17
#define SPI_FLASH_CS_PIN PIN_PA28
#define SPI_FLASH_MOSI_PIN_FUNCTION PINMUX_PA31D_SERCOM1_PAD3
#define SPI_FLASH_MISO_PIN_FUNCTION PINMUX_PA30D_SERCOM1_PAD2
#define SPI_FLASH_SCK_PIN_FUNCTION PINMUX_PA17C_SERCOM1_PAD1
#define SPI_FLASH_SERCOM SERCOM1
#define SPI_FLASH_SERCOM_INDEX 1
#define SPI_FLASH_MOSI_PAD 3
#define SPI_FLASH_MISO_PAD 2
#define SPI_FLASH_SCK_PAD 1
// <o> Transmit Data Pinout
// <0x0=>PAD[0,1]_DO_SCK
// <0x1=>PAD[2,3]_DO_SCK
// <0x2=>PAD[3,1]_DO_SCK
// <0x3=>PAD[0,3]_DO_SCK
#define SPI_FLASH_DOPO 2
#define SPI_FLASH_DIPO 2 // same as MISO pad
#define SPI_FLASH_MOSI_PIN &pin_PA31
#define SPI_FLASH_MISO_PIN &pin_PA30
#define SPI_FLASH_SCK_PIN &pin_PA17
#define SPI_FLASH_CS_PIN &pin_PA28
// These are pins not to reset.
#define MICROPY_PORT_A (PORT_PA17 | PORT_PA22 | PORT_PA24 | PORT_PA25 | PORT_PA28 | PORT_PA30 | PORT_PA31)
#define MICROPY_PORT_A (PORT_PA22)
#define MICROPY_PORT_B ( 0 )
#define MICROPY_PORT_C ( 0 )
#include "external_flash/external_flash.h"
// If you change this, then make sure to update the linker scripts as well to
// make sure you don't overwrite code.
#define CIRCUITPY_INTERNAL_NVM_SIZE 256
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#include "external_flash/devices.h"
#define EXTERNAL_FLASH_DEVICE_COUNT 2
#define EXTERNAL_FLASH_DEVICES S25FL216K, \
GD25Q16C
#include "external_flash/external_flash.h"
#define BOARD_HAS_CRYSTAL 1
#define DEFAULT_I2C_BUS_SCL (&pin_PA13)

@ -5,6 +5,8 @@ USB_PRODUCT = "Feather RadioFruit Zigbee"
USB_MANUFACTURER = "Adafruit Industries LLC"
SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 2
EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C"
LONGINT_IMPL = MPZ
CHIP_VARIANT = SAMR21G18A

@ -18,8 +18,6 @@
#define DEFAULT_UART_BUS_RX (&pin_PA05)
#define DEFAULT_UART_BUS_TX (&pin_PA04)
#include "internal_flash.h"
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
#define IGNORE_PIN_PA03 1

@ -29,13 +29,6 @@
#include "hal/include/hal_gpio.h"
void board_init(void) {
gpio_set_pin_function(MICROPY_HW_LED_TX, GPIO_PIN_FUNCTION_OFF);
gpio_set_pin_direction(MICROPY_HW_LED_TX, GPIO_DIRECTION_OUT);
gpio_set_pin_level(MICROPY_HW_LED_TX, true);
gpio_set_pin_function(MICROPY_HW_LED_RX, GPIO_PIN_FUNCTION_OFF);
gpio_set_pin_direction(MICROPY_HW_LED_RX, GPIO_DIRECTION_OUT);
gpio_set_pin_level(MICROPY_HW_LED_RX, true);
}
bool board_requests_safe_mode(void) {

@ -5,8 +5,8 @@
// This is for Rev A which is green
#define MICROPY_HW_LED_TX PIN_PC30
#define MICROPY_HW_LED_RX PIN_PC31
#define MICROPY_HW_LED_TX &(pin_PC30)
#define MICROPY_HW_LED_RX &(pin_PC31)
#define MICROPY_HW_NEOPIXEL (&pin_PC24)
@ -27,13 +27,6 @@
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#include "external_flash/devices.h"
#define EXTERNAL_FLASH_DEVICE_COUNT 1
#define EXTERNAL_FLASH_DEVICES GD25Q64C
#include "external_flash/external_flash.h"
#define BOARD_HAS_CRYSTAL 1
#define DEFAULT_I2C_BUS_SCL (&pin_PB21)

@ -5,6 +5,9 @@ USB_PRODUCT = "Grand Central M4 Express"
USB_MANUFACTURER = "Adafruit Industries LLC"
QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 1
EXTERNAL_FLASH_DEVICES = "GD25Q64C"
LONGINT_IMPL = MPZ
CHIP_VARIANT = SAMD51P20A

@ -3,51 +3,22 @@
#define MICROPY_HW_NEOPIXEL (&pin_PA12)
// Clock rates are off: Saleae reads 12MHz which is the limit even though we set it to the safer 8MHz.
#define SPI_FLASH_BAUDRATE (8000000)
#define SPI_FLASH_MOSI_PIN PIN_PB10
#define SPI_FLASH_MISO_PIN PIN_PA13
#define SPI_FLASH_SCK_PIN PIN_PB11
#define SPI_FLASH_CS_PIN PIN_PA07
#define SPI_FLASH_MOSI_PIN_FUNCTION PINMUX_PB10D_SERCOM4_PAD2
#define SPI_FLASH_MISO_PIN_FUNCTION PINMUX_PA13D_SERCOM4_PAD1
#define SPI_FLASH_SCK_PIN_FUNCTION PINMUX_PB11D_SERCOM4_PAD3
#define SPI_FLASH_SERCOM SERCOM4
#define SPI_FLASH_SERCOM_INDEX 4
#define SPI_FLASH_MOSI_PAD 2
#define SPI_FLASH_MISO_PAD 1
#define SPI_FLASH_SCK_PAD 3
// <o> Transmit Data Pinout
// <0x0=>PAD[0,1]_DO_SCK
// <0x1=>PAD[2,3]_DO_SCK
// <0x2=>PAD[3,1]_DO_SCK
// <0x3=>PAD[0,3]_DO_SCK
#define SPI_FLASH_DOPO 0x1
#define SPI_FLASH_DIPO 1 // same as MISO pad
#define SPI_FLASH_MOSI_PIN &pin_PB10
#define SPI_FLASH_MISO_PIN &pin_PA13
#define SPI_FLASH_SCK_PIN &pin_PB11
#define SPI_FLASH_CS_PIN &pin_PA07
// These are pins not to reset.
#define MICROPY_PORT_A ( PORT_PA01 | PORT_PA07 | PORT_PA12 | PORT_PA13 | PORT_PA24 | PORT_PA25 | PORT_PA27 | PORT_PA28)
#define MICROPY_PORT_B ( PORT_PB10 | PORT_PB11 | PORT_PB22 | PORT_PB23 )
#define MICROPY_PORT_A ( PORT_PA01 | PORT_PA12 | PORT_PA27 | PORT_PA28)
#define MICROPY_PORT_B ( PORT_PB22 | PORT_PB23 )
#define MICROPY_PORT_C ( 0 )
#include "external_flash/external_flash.h"
// If you change this, then make sure to update the linker scripts as well to
// make sure you don't overwrite code.
#define CIRCUITPY_INTERNAL_NVM_SIZE 256
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#include "external_flash/devices.h"
#define EXTERNAL_FLASH_DEVICE_COUNT 2
#define EXTERNAL_FLASH_DEVICES W25Q64JV_IQ, \
GD25Q64C
#include "external_flash/external_flash.h"
#define DEFAULT_I2C_BUS_SCL (&pin_PA17)
#define DEFAULT_I2C_BUS_SDA (&pin_PA16)

@ -5,6 +5,8 @@ USB_PRODUCT = "HalloWing M0 Express"
USB_MANUFACTURER = "Adafruit Industries LLC"
SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 2
EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ, GD25Q64C"
LONGINT_IMPL = MPZ
CHIP_VARIANT = SAMD21G18A

@ -5,32 +5,14 @@
#define MICROPY_HW_APA102_MOSI (&pin_PA01)
#define MICROPY_HW_APA102_SCK (&pin_PA00)
// Saleae reads 12mhz which is the limit even though we set it to the safer 8mhz.
#define SPI_FLASH_BAUDRATE (8000000)
#define SPI_FLASH_MOSI_PIN PIN_PB22
#define SPI_FLASH_MISO_PIN PIN_PB03
#define SPI_FLASH_SCK_PIN PIN_PB23
#define SPI_FLASH_CS_PIN PIN_PA27
#define SPI_FLASH_MOSI_PIN_FUNCTION PINMUX_PB22D_SERCOM5_PAD2
#define SPI_FLASH_MISO_PIN_FUNCTION PINMUX_PB03D_SERCOM5_PAD1
#define SPI_FLASH_SCK_PIN_FUNCTION PINMUX_PB23D_SERCOM5_PAD3
#define SPI_FLASH_SERCOM SERCOM5
#define SPI_FLASH_SERCOM_INDEX 5
#define SPI_FLASH_MOSI_PAD 2
#define SPI_FLASH_MISO_PAD 1
#define SPI_FLASH_SCK_PAD 3
// <o> Transmit Data Pinout
// <0x0=>PAD[0,1]_DO_SCK
// <0x1=>PAD[2,3]_DO_SCK
// <0x2=>PAD[3,1]_DO_SCK
// <0x3=>PAD[0,3]_DO_SCK
#define SPI_FLASH_DOPO 1
#define SPI_FLASH_DIPO 1 // same as MISO pad
#define SPI_FLASH_MOSI_PIN &pin_PB22
#define SPI_FLASH_MISO_PIN &pin_PB03
#define SPI_FLASH_SCK_PIN &pin_PB23
#define SPI_FLASH_CS_PIN &pin_PA27
// These are pins not to reset.
#define MICROPY_PORT_A (PORT_PA00 | PORT_PA01 | PORT_PA27 | PORT_PA24 | PORT_PA25)
#define MICROPY_PORT_B (PORT_PB22 | PORT_PB23 | PORT_PB03 )
#define MICROPY_PORT_A (PORT_PA00 | PORT_PA01)
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
// If you change this, then make sure to update the linker scripts as well to
@ -39,14 +21,6 @@
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#include "external_flash/devices.h"
#define EXTERNAL_FLASH_DEVICE_COUNT 2
#define EXTERNAL_FLASH_DEVICES W25Q16FW, \
GD25Q16C
#include "external_flash/external_flash.h"
#define DEFAULT_I2C_BUS_SCL (&pin_PA23)
#define DEFAULT_I2C_BUS_SDA (&pin_PA22)

@ -5,6 +5,8 @@ USB_PRODUCT = "ItsyBitsy M0 Express"
USB_MANUFACTURER = "Adafruit Industries LLC"
SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 2
EXTERNAL_FLASH_DEVICES = "W25Q16FW, GD25Q16C"
LONGINT_IMPL = MPZ
CHIP_VARIANT = SAMD21G18A

@ -25,13 +25,6 @@
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#include "external_flash/devices.h"
#define EXTERNAL_FLASH_DEVICE_COUNT 1
#define EXTERNAL_FLASH_DEVICES GD25Q16C
#include "external_flash/external_flash.h"
#define DEFAULT_I2C_BUS_SCL (&pin_PA13)
#define DEFAULT_I2C_BUS_SDA (&pin_PA12)

@ -5,6 +5,8 @@ USB_PRODUCT = "ItsyBitsy M4 Express"
USB_MANUFACTURER = "Adafruit Industries LLC"
QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 1
EXTERNAL_FLASH_DEVICES = GD25Q16C
LONGINT_IMPL = MPZ
CHIP_VARIANT = SAMD51G19A

@ -1,15 +1,11 @@
#define MICROPY_HW_BOARD_NAME "Meow Meow"
#define MICROPY_HW_MCU_NAME "samd21g18"
// These are pins not to reset.
// PA24 and PA25 are USB.
#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25)
#define MICROPY_PORT_A (0)
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
#include "internal_flash.h"
// If you change this, then make sure to update the linker scripts as well to
// make sure you don't overwrite code.
#define CIRCUITPY_INTERNAL_NVM_SIZE 0

@ -1,37 +1,22 @@
#define MICROPY_HW_BOARD_NAME "Adafruit Metro M0 Express"
#define MICROPY_HW_MCU_NAME "samd21g18"
#define MICROPY_HW_LED_TX PIN_PA27
//#define MICROPY_HW_LED_RX PIN_PA31
//#define MICROPY_HW_LED_TX &pin_PA27
//#define MICROPY_HW_LED_RX &pin_PA31
#define MICROPY_HW_NEOPIXEL (&pin_PA30)
// Clock rates are off: Salae reads 12MHz which is the limit even though we set it to the safer 8MHz.
#define SPI_FLASH_BAUDRATE (8000000)
#define SPI_FLASH_MOSI_PIN PIN_PB22
#define SPI_FLASH_MISO_PIN PIN_PB03
#define SPI_FLASH_SCK_PIN PIN_PB23
#define SPI_FLASH_CS_PIN PIN_PA13
#define SPI_FLASH_MOSI_PIN_FUNCTION PINMUX_PB22D_SERCOM5_PAD2
#define SPI_FLASH_MISO_PIN_FUNCTION PINMUX_PB03D_SERCOM5_PAD1
#define SPI_FLASH_SCK_PIN_FUNCTION PINMUX_PB23D_SERCOM5_PAD3
#define SPI_FLASH_SERCOM SERCOM5
#define SPI_FLASH_SERCOM_INDEX 5
#define SPI_FLASH_MOSI_PAD 2
#define SPI_FLASH_MISO_PAD 1
#define SPI_FLASH_SCK_PAD 3
// <o> Transmit Data Pinout
// <0x0=>PAD[0,1]_DO_SCK
// <0x1=>PAD[2,3]_DO_SCK
// <0x2=>PAD[3,1]_DO_SCK
// <0x3=>PAD[0,3]_DO_SCK
#define SPI_FLASH_DOPO 1
#define SPI_FLASH_DIPO 1 // same as MISO pad
#define SPI_FLASH_MOSI_PIN &pin_PB22
#define SPI_FLASH_MISO_PIN &pin_PB03
#define SPI_FLASH_SCK_PIN &pin_PB23
#define SPI_FLASH_CS_PIN &pin_PA13
// These are pins not to reset.
#define MICROPY_PORT_A (PORT_PA13 |PORT_PA24 | PORT_PA25 | PORT_PA27 | PORT_PA30 | PORT_PA31)
#define MICROPY_PORT_B (PORT_PB03 | PORT_PB22 | PORT_PB23)
#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25 | PORT_PA30 | PORT_PA31)
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
// If you change this, then make sure to update the linker scripts as well to
@ -40,14 +25,6 @@
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#include "external_flash/devices.h"
#define EXTERNAL_FLASH_DEVICE_COUNT 2
#define EXTERNAL_FLASH_DEVICES S25FL216K, \
GD25Q16C
#include "external_flash/external_flash.h"
#define BOARD_HAS_CRYSTAL 1
#define DEFAULT_I2C_BUS_SCL (&pin_PA23)

@ -12,3 +12,7 @@ CHIP_FAMILY = samd21
MICROPY_PY_NETWORK = 1
MICROPY_PY_WIZNET5K = 5500
SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 2
EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C"

@ -29,13 +29,6 @@
#include "hal/include/hal_gpio.h"
void board_init(void) {
gpio_set_pin_function(MICROPY_HW_LED_TX, GPIO_PIN_FUNCTION_OFF);
gpio_set_pin_direction(MICROPY_HW_LED_TX, GPIO_DIRECTION_OUT);
gpio_set_pin_level(MICROPY_HW_LED_TX, true);
gpio_set_pin_function(MICROPY_HW_LED_RX, GPIO_PIN_FUNCTION_OFF);
gpio_set_pin_direction(MICROPY_HW_LED_RX, GPIO_DIRECTION_OUT);
gpio_set_pin_level(MICROPY_HW_LED_RX, true);
}
bool board_requests_safe_mode(void) {

@ -5,16 +5,16 @@
// This is for Rev F which is green
#define MICROPY_HW_LED_TX PIN_PA27
#define MICROPY_HW_LED_RX PIN_PB06
#define MICROPY_HW_LED_TX (&pin_PA27)
#define MICROPY_HW_LED_RX (&pin_PB06)
#define MICROPY_HW_NEOPIXEL (&pin_PB22)
// These are pins not to reset.
// QSPI Data pins and TX LED
#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11 | PORT_PA27)
// RX LED, QSPI CS, QSPI SCK and NeoPixel pin
#define MICROPY_PORT_B ( PORT_PB06 | PORT_PB10 | PORT_PB11 | PORT_PB22)
// QSPI Data pins
#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11)
// QSPI CS, QSPI SCK and NeoPixel pin
#define MICROPY_PORT_B (PORT_PB10 | PORT_PB11 | PORT_PB22)
#define MICROPY_PORT_C (0)
#define MICROPY_PORT_D (0)
@ -26,13 +26,6 @@
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#include "external_flash/devices.h"
#define EXTERNAL_FLASH_DEVICE_COUNT 3
#define EXTERNAL_FLASH_DEVICES S25FL116K, S25FL216K, GD25Q16C
#include "external_flash/external_flash.h"
#define BOARD_HAS_CRYSTAL 1
#define DEFAULT_I2C_BUS_SCL (&pin_PB03)

@ -5,6 +5,9 @@ USB_PRODUCT = "Metro M4 Express"
USB_MANUFACTURER = "Adafruit Industries LLC"
QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 3
EXTERNAL_FLASH_DEVICES = "S25FL116K, S25FL216K, GD25Q16C"
LONGINT_IMPL = MPZ
CHIP_VARIANT = SAMD51J19A

@ -15,8 +15,6 @@
// A number of modules are removed for pIRKey to make room for frozen libraries.
#define PIRKEY_M0 (1)
#include "internal_flash.h"
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
#define IGNORE_PIN_PA02 1

@ -26,13 +26,6 @@
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#include "external_flash/devices.h"
#define EXTERNAL_FLASH_DEVICE_COUNT 1
#define EXTERNAL_FLASH_DEVICES GD25Q64C
#include "external_flash/external_flash.h"
#define DEFAULT_I2C_BUS_SCL (&pin_PB08)
#define DEFAULT_I2C_BUS_SDA (&pin_PB09)

@ -5,6 +5,8 @@ USB_PRODUCT = "Trellis M4 Express"
USB_MANUFACTURER = "Adafruit Industries LLC"
QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 1
EXTERNAL_FLASH_DEVICES = GD25Q64C
LONGINT_IMPL = MPZ
CHIP_VARIANT = SAMD51G19A

@ -9,8 +9,6 @@
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
#include "internal_flash.h"
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)

@ -5,56 +5,24 @@
// #define MICROPY_HW_APA102_MOSI (&pin_PA00)
// #define MICROPY_HW_APA102_SCK (&pin_PA01)
// Salae reads 12mhz which is the limit even though we set it to the
// safer 8mhz.
#define SPI_FLASH_BAUDRATE (8000000)
#define SPI_FLASH_MOSI_PIN PIN_PA16
#define SPI_FLASH_MISO_PIN PIN_PA19
#define SPI_FLASH_SCK_PIN PIN_PA17
#define SPI_FLASH_CS_PIN PIN_PA11<