Replace Arduino Zero USB with SAMD21 M0-Mini board

This commit is contained in:
Leonel Lopes Parente 2021-05-18 01:07:43 +02:00
parent c5a422ac42
commit 4e4350f9ad
3 changed files with 39 additions and 34 deletions

View file

@ -178,8 +178,8 @@ An external display can be optionally connected. For details and wiring instruct
| NodeMCU V2 (aka v1.0) | ESP8266 | yes | yes | yes | no | nodemcuv2 |
| Raspberry Pi Pico | RP2040 | yes | yes | yes | no | pico |
| Arduino Pro Mini (ATmega328 8mHz) | ATmega328 | yes | yes | no | no | pro8mhzatmega328 |
| SAMD21 M0-Mini | SAMD21 | yes | yes | no | no | samd21_m0_mini |
| Teensy LC | MKL26Z64VFT4 | yes | yes | yes | no | teensylc |
| Arduino Zero (USB) | SAMD21 | yes | yes | yes | no | zerousb |
_\*7_: These boards have onboard USB but by default do not support firmware upload over USB or serial over USB. For upload use a STLink programmer or USB to serial adapter.

View file

@ -63,8 +63,8 @@ default_envs =
; nodemcuv2 ; NodeMCU V2
; pico ; Raspberry Pi Pico
; pro8mhzatmega328 ; Arduino Pro Mini 3.3V 8Mhz
; samd21_m0_mini ; SAMD21 M0-Mini
; teensylc ; Teensy LC
; zerousb ; Arduino Zero (USB)
; ------------------------------------------------------------------------------
@ -755,6 +755,27 @@ build_flags =
; -D USE_LED ; NOT SUPPORTED
; -D USE_DISPLAY ; Requires external I2C OLED display
[env:samd21_m0_mini]
; SAMD21 M0-Mini (SAMD21)
; The SPI pins are available on the ICSP connector pins on top of the PCB
; No display
platform = atmelsam
board = zeroUSB
framework = arduino
monitor_speed = ${common.monitor_speed}
lib_deps =
${common.lib_deps}
${mcci_lmic.lib_deps}
build_flags =
${common.build_flags}
${mcci_lmic.build_flags}
-D BSFILE=\"boards/bsf_samd21_m0_mini.h\"
-D MONITOR_SPEED=${common.monitor_speed}
-D USE_SERIAL
; -D USE_LED ; NOT SUPPORTED
; -D USE_DISPLAY ; Requires external I2C OLED display
[env:teensylc]
; Teensy LC (NXP MKL26Z64VFT4)
@ -776,25 +797,4 @@ build_flags =
; -D USE_DISPLAY ; Requires external I2C OLED display
[env:zerousb]
; Arduino Zero USB (SAMD21)
; The SPI pins are available on the ICSP connector pins on top of the PCB
; No display
platform = atmelsam
board = zeroUSB
framework = arduino
monitor_speed = ${common.monitor_speed}
lib_deps =
${common.lib_deps}
${mcci_lmic.lib_deps}
build_flags =
${common.build_flags}
${mcci_lmic.build_flags}
-D BSFILE=\"boards/bsf_zerousb.h\"
-D MONITOR_SPEED=${common.monitor_speed}
-D USE_SERIAL
-D USE_LED
; -D USE_DISPLAY ; Requires external I2C OLED display
; end of file

View file

@ -1,9 +1,9 @@
/*******************************************************************************
*
* File: bsf_zerousb.h
* File: bsf_samd21_m0_mini.h
*
* Function: Board Support File for Arduino Zero (USB Native port)
* and SAMD21 M0-Mini, with external SPI LoRa module.
* Function: Board Support File for SAMD21 M0-Mini
* with external SPI LoRa module.
*
* Copyright: Copyright (c) 2021 Leonel Lopes Parente
*
@ -14,6 +14,10 @@
* Description: This board has onboard USB (provided by the MCU).
* It supports automatic firmware upload and serial over USB.
* No onboard display. Optionally an external display con be connected.
*
* On some boards a user LED is present while on
* others it PA17 / 13 which is shared which is also used for SPI SCK.
* Therefore onboard LED is not supported by LMIC-node.
*
* The SPI pins are located on the top side of the PCB as part of
* the ICSP connector. It is strange that this board has an ICSP
@ -30,7 +34,7 @@
*
* Leds GPIO
* ---- ----
* LED <> PA17 / 13 (LED_BUILTIN, PIN_LED, PIN_LED_13)
* LED - (LED_BUILTIN, PIN_LED, PIN_LED_13)
* LED2 <> PB03 / 25 (RX, PIN_LED2, PIN_LED_RXL)
* LED3 <> PA27 / 26 (TX, PIN_LED3, PIN_LED_TXL)
*
@ -53,7 +57,7 @@
* Docs: https://docs.platformio.org/en/latest/boards/atmelsam/zeroUSB.html
*
* Identifiers: LMIC-node
* board: zerousb
* board: samd21_m0_mini
* PlatformIO
* board: zeroUSB
* platform: atmelsam
@ -65,12 +69,12 @@
#pragma once
#ifndef BSF_ZEROUSB_H_
#define BSF_ZEROUSB_H_
#ifndef BSF_SAMD21_M0_MINI_
#define BSF_SAMD21_M0_MINI_
#include "LMIC-node.h"
#define DEVICEID_DEFAULT "zero-usb" // Default deviceid value
#define DEVICEID_DEFAULT "samd21-m0-mini" // Default deviceid value
// Wait for Serial
// Can be useful for boards with MCU with integrated USB support.
@ -100,8 +104,9 @@ const lmic_pinmap lmic_pins = {
#endif
#ifdef USE_LED
EasyLed led(LED_BUILTIN, EasyLed::ActiveLevel::High);
#endif
#error Invalid option: USE_LED. Onboard LED is not supported.
// EasyLed led(<external LED GPIO>, EasyLed::ActiveLevel::Low);
Endif
#ifdef USE_DISPLAY
// Create U8x8 instance for SSD1306 OLED display (no reset) using hardware I2C.
@ -134,4 +139,4 @@ bool boardInit(InitType initType)
}
#endif // BSF_ZEROUSB_H_
#endif // BSF_SAMD21_M0_MINI_