arduino / ArduinoCore-samd

Arduino Core for SAMD21 CPU
GNU Lesser General Public License v2.1
475 stars 722 forks source link

Please add board / proper support for SAMD21 M0-Mini #470

Open lnlp opened 5 years ago

lnlp commented 5 years ago

I am using a SAMD21 M0-Mini board (example of the board and pinout for the board).

This board is available from different manufacturers and labeled either as 'Wemos' or 'Robotdyn'.

I have seen blogs stating that one should select board "Arduino Zero (USB Native Port) for this board. This works but gives problems for SPI.

The problem is that the 'Arduino Zero (USB Native Port)' board definition defines SPI pins as part of the ICSP connector which is on the top of the board but these pins are not available on the side/bottom of the board which is not breadboard-friendly.

Instead I would like to use other pins on the side/bottom of the board for the standard SPI port. This currently appears not to be supported. Adding a separate board definition for the SAMD21 M0-Mini (where the standard SPI port is defined using pins on the side/bottom) could fix this.

I know that it is possible to define a second SPI port which is described in the Adafruit article Creating a new SPI. But that adds second SPI port. It does not redefine the pins for the standard SPI port. It is important that the standard SPI port and not a second SPI port because using the second SPI port does require that current code and libraries need to be modified, which depending on the quality of the code/libraries, may either be relatively easy or more complex and difficult to implement. To make the standard SPI port available on other more regular pins than those of the ICSP connector on top, either the standard SPI pins need to be remapped/redefined in setup() (if possible at all and I don't know how) or a separate board definition for the SAMD21 M0-Mini needs to be added.

It is more useful and more common to define the default SPI port on pins that are available on the side/bottom than define them for the pins of the ICSP connector (that is only available on top).

ardiri commented 5 years ago

why not copy the variants/mkrzero directory and make a new one - editing the PINS for SPI in the configuration of the variants.h file?

lnlp commented 5 years ago

I thought about that but that will get overwritten with every update of the SAMD Arduino Core and will require some additional tweaking when using PlatformIO, which means that over time it is maintenance and error prone. Much better is to have a board definition added for this board. While I realize that this board is not produced by the Arduino organisation I would like it to be added to the standard SAMD Arduino Core. Similar to how Espressif adds all ESP32 board definitions to the ESP32 Arduino Core, also the boards not produced by Espressif.

ardiri commented 5 years ago

yeah; you could do it. then do a pull request to get it integrated into the official version.

sezeryalcin commented 2 years ago

+1

JAndrassy commented 2 years ago

https://arduino.stackexchange.com/questions/54484/adding-a-custom-board-to-the-arduino-ide/60660#60660

lnlp commented 2 years ago

yeah; you could do it. then do a pull request to get it integrated into the official version.

I only have one of these boards for testing to support it for the cross-platform application LMIC-node. I therefore have no intention of adding support for the SAMD21 M0-Mini board to the SAMD Arduino Core myself.