Différences entre versions de « ENG-CANSAT-FEATHER-M0-USER-GUIDE »

De MCHobby - Wiki
Sauter à la navigation Sauter à la recherche
 
(2 versions intermédiaires par le même utilisateur non affichées)
Ligne 1 : Ligne 1 :
 
{{ENG-CANSAT-NAV}}
 
{{ENG-CANSAT-NAV}}
  
== Feather M0 Express in details ==
+
== Feather M0 Express ==
 
The Feather M0 use the ATSAMD21G18 ARM Cortex M0+ processor with 3.3V logic and 48 MHz. This chip embed 256K of FLASH (8x more than the Atmega328/Uno) and has 32K RAM (16x more than UNO)!  
 
The Feather M0 use the ATSAMD21G18 ARM Cortex M0+ processor with 3.3V logic and 48 MHz. This chip embed 256K of FLASH (8x more than the Atmega328/Uno) and has 32K RAM (16x more than UNO)!  
 +
 +
<div style="margin: 15px 0; background: rgba(255,204,102,.3); display: block; padding: 15px 15px 15px 15px; -webkit-border-radius: 2px; -moz-border-radius: 2px; border-radius: 2px; border: 1px solid #ff9900;" >As Feather M0 is compatible Arduino IDE, everything learned for Arduino Uno can be applied to Feather M0. Just care about voltage, the UNO is 5V Logic and the '''Feather 3.3V logic'''.</div>
 +
 +
{| class="wikitable" border="1" style="display: inline-block;"
 +
|-
 +
| align="center" | '''Feather M0 Features'''
 +
|- style="font-size: 90%"
 +
| align="left" | 20 GPIOs
 +
|- style="font-size: 90%"
 +
| align="left" | 6 Analog inputs 12bits<br />value from 0 to 4095.
 +
|- style="font-size: 90%"
 +
| align="left" | 1 Analog output 10 bits<br />value from 0 to 1023.
 +
|- style="font-size: 90%"
 +
| align="left" | PWM on all pins
 +
|- style="font-size: 90%"
 +
| align="left" | Hardware I2C et SPI buses
 +
|- style="font-size: 90%"
 +
| align="left" | UART
 +
|}
 +
 +
{| class="wikitable" border="1" style="vertical-align: top; display: inline-block;"
 +
|-
 +
| align="center" | '''Feather are:'''
 +
|- style="font-size: 90%"
 +
| align="left" | * Small (5c2xm)
 +
|- style="font-size: 90%"
 +
| align="left" | * Light (4.7Gr)
 +
|- style="font-size: 90%"
 +
| align="left" | * Powerful
 +
|- style="font-size: 90%"
 +
| align="left" | * Versatile
 +
|- style="font-size: 90%"
 +
| align="left" | * Polyvalent
 +
|- style="font-size: 90%"
 +
| align="left" | * Available with<br />{{cl|87|complete ecosystem}}
 +
|}
 +
 +
[[fichier:ENG-CANSAT-CONTENT-00.png|640px]]
 +
  
 
This ATSAMD21G18 has USB built-in which offers USB-to-Serial and debug feature (so no need for FTDI-like chip).
 
This ATSAMD21G18 has USB built-in which offers USB-to-Serial and debug feature (so no need for FTDI-like chip).
Ligne 80 : Ligne 119 :
 
* '''#13''' - GPIO #13, also connected to the '''red LED''' near if the microUSB située près du connecteur micro USB.
 
* '''#13''' - GPIO #13, also connected to the '''red LED''' near if the microUSB située près du connecteur micro USB.
 
* '''A0''' - '''Analog input A0''' and also a real '''Analog output''' since the DAC is wired on this pin (DAC = Digital to Analog Converter). The output voltage can be set with a value between 0 and 3.3V. Unlike the PWM output, this pin is {{underline|a real analog output}}. So you can experiment with signal generator.
 
* '''A0''' - '''Analog input A0''' and also a real '''Analog output''' since the DAC is wired on this pin (DAC = Digital to Analog Converter). The output voltage can be set with a value between 0 and 3.3V. Unlike the PWM output, this pin is {{underline|a real analog output}}. So you can experiment with signal generator.
* '''A1 to A5''' - each pin is an Analog input and also a Digital Input/Output.
+
* '''A1 to A5''' - each pin is an Analog input and also a Digital Input/Output.<br />It is a 12-bit analog inputs (so with values from 0 to 4095)
 
* '''SCK/MOSI/MISO''' - those are the pins for the hardware SPI bus. The pin can also been used to as Digital Input/Output.  
 
* '''SCK/MOSI/MISO''' - those are the pins for the hardware SPI bus. The pin can also been used to as Digital Input/Output.  
  

Version actuelle datée du 3 octobre 2018 à 16:46

Feather M0 Express

The Feather M0 use the ATSAMD21G18 ARM Cortex M0+ processor with 3.3V logic and 48 MHz. This chip embed 256K of FLASH (8x more than the Atmega328/Uno) and has 32K RAM (16x more than UNO)!

As Feather M0 is compatible Arduino IDE, everything learned for Arduino Uno can be applied to Feather M0. Just care about voltage, the UNO is 5V Logic and the Feather 3.3V logic.
Feather M0 Features
20 GPIOs
6 Analog inputs 12bits
value from 0 to 4095.
1 Analog output 10 bits
value from 0 to 1023.
PWM on all pins
Hardware I2C et SPI buses
UART
Feather are:
* Small (5c2xm)
* Light (4.7Gr)
* Powerful
* Versatile
* Polyvalent
* Available with
complete ecosystem

ENG-CANSAT-CONTENT-00.png


This ATSAMD21G18 has USB built-in which offers USB-to-Serial and debug feature (so no need for FTDI-like chip).

The feather has the following specs:

  • Size: 51mm x 23mm x 8mm
  • Weight: 5 grams
  • ATSAMD21G18 @ 48MHz
  • 3.3V logic/power
  • 256KB of FLASH
  • 32KB of RAM
  • No EEPROM
  • RTC & Clock based on 32.768 KHz crystal
  • 3.3V regulator (500mA peak current) with Power/enable pin
  • USB native support (has USB bootloader)
  • 20 GPIO pins (PWM on all pins)
  • Hardware Serial + Hardware I2C + Hardware SPI support
  • 6 x 12-bit analog inputs (from 0 to 4095)
  • 1 x DAC 10-bit analog ouput (from 0 to 1024)
  • Lipo Charger included: 100mA charging with status LED
  • Red LED attached on pin #13 (like Arduino UNO)
  • Reset button
  • Mini NeoPixel
  • 2 MB SPI additional Flash storage.
The Feather M0 Express can be be programmed with Arduino IDE -OR- with CircuitPython (a flavor of MicroPython). This tutorial focus on Arduino IDE development. Check the Adafruit Tutorial if you are interested in CircuitPython Programming.

About the additionnal Flash:
The SPI Flash storage act like a tiny hard drive.

  • Under CircuitPython, the 2 MB Flash is used to the Python scripts, libraries and other files.
  • With Arduino, the 2 MB Flash is used to read/write files to it (like a SD card). Adafruit has helper program to access those files over USB.

The UF2 bootloader:
The Feather M0 is pre-loaded with an UF2 bootloader which looks like a USB Flash Drive. Simply drag an UF2 firmware on the USB Flash drive to completely reprogram de board firmware (No special tools, No special drivers needed)! The UF2 bootloader can be used to load up CircuitPython, MakeCode PXT file or Arduino IDE (bossa-compatible).

Feather M0 Express PINOUT

Introduction

FEATHER-M0-EXPRESS-Brochage-01.png
Crédit: AdaFruit Industries www.adafruit.com
Click to enlarge

(Please note that AREF is PA03 (and not PA02)

FEATHER-M0-EXPRESS-Brochage-02.jpg
Crédit: AdaFruit Industries www.adafruit.com

The Feather M0 benefits from the Cortex M0 microcontroler hardware. If has many buses and many pins. Let's review them togheter!

Power Pin

FEATHER-M0-EXPRESS-Brochage-03.jpg
Crédit: AdaFruit Industries www.adafruit.com

  • GND  : is the common ground. The 0v reference voltage for all the logic and power supplies.
  • BAT : positive pin from the JST connector (the optional Lipo).
  • USB  : positive pin from the USB connector. Will allow you to detect if the board is connected on USB.
  • EN : Enable pin of the 3.3V regulator. This pin has a Pull-Up résistor. Connect the EN pin to the ground will shutdown the 3.3V regulator.
  • 3V : Output of the 3.3V regulator (500mA peak)

Logical pins

FEATHER-M0-EXPRESS-Brochage-04.jpg
Crédit: AdaFruit Industries www.adafruit.com

This concerns all the I/O pins on the microcontroler.

All PINS are 3.3V Logic
  • Almost all pins can generate PWM signal (also called "analog output" on Arduino UNO board).
  • All pins can be used for Interrupt Request (IRQ).

The following pins have specific features:

  • #0 / RX - GPIO #0, also receiving pin of the Serial1 UART (hardware serial port, input). Also an analog input.
  • #1 / TX - GPIO #1, also transmitting pins of the Serial1 UART (hardware serial port, output). Also an analog input.
  • SDA - Data pin for the I2C bus. There is no pull-up resistor on that pin, so you need to add a 2.2K-10K pull-up when used for I2C bus.
  • SCL - Clock pin for the I2C bus. There is no pull-up resistor on that pin, so you need to add a 2.2K-10K pull-up when used for I2C bus.
  • #5 - GPIO #5
  • #6 - GPIO #6
  • #9 - GPIO #9, also analog input A7. This analog input is wired on a divider resistor bridge to read the Lipoly battery voltage. As a consequence, the voltage of that pin is fixed to a voltage around ~2V.
  • #10 - GPIO #10
  • #11 - GPIO #11
  • #12 - GPIO #12
  • #13 - GPIO #13, also connected to the red LED near if the microUSB située près du connecteur micro USB.
  • A0 - Analog input A0 and also a real Analog output since the DAC is wired on this pin (DAC = Digital to Analog Converter). The output voltage can be set with a value between 0 and 3.3V. Unlike the PWM output, this pin is a real analog output. So you can experiment with signal generator.
  • A1 to A5 - each pin is an Analog input and also a Digital Input/Output.
    It is a 12-bit analog inputs (so with values from 0 to 4095)
  • SCK/MOSI/MISO - those are the pins for the hardware SPI bus. The pin can also been used to as Digital Input/Output.

About buses:

  • The SPI bus can reach really high speed so it is a good idea to preserve it, mostly useful with TFT display requiring high throughput to display the content.
  • The I2C bus can be shared among several devices (usually sensors). So it is also a good idea to preserve the SDA & SCL pins.

SPI Flash and NeoPixel

The "Express" product line is designed to also run CircuitPython. To ease the prototyping, Adafruit added 2 additional items on the Feather M0:

  • a mini NeoPixel LED (NeoPixel are Digital RGB LEDs that can be controled with only one data pin)
  • a 2 MB additional memory (Flash memory on SPI bus.

FEATHER-M0-EXPRESS-Brochage-05.jpg
Crédit: AdaFruit Industries www.adafruit.com

The NeoPixel LED is wired on the #8 (in Arduino), so you can use the library by configuring a ribbon of only 1 pixel. The NeoPixel is powered with 3.3V but this doesn't impact the color or the brightness.

NeoPixel

The NeoPixel is also used by the bootloader to inform the user about the bootloader state:

  • Green : The device has been proprely enumerated over the USB interface.
  • Red : error with the USB.

Note: In CircuitPython, the LED is used to mention the running status.

The SPI Flash memory

The Flash memory is wired on 4 reserved pins. Those pins are not made available as GPIO, so no worries about collision risk when using device on the Feather SPI bus. The SPI Flash memory is wired on a different SPI bus... so no worries.

Under Arduino

The Flash pins are:

  • SCK = pin #3,
  • MISO = pin #2,
  • MOSI = pin #4
  • CS = pin #38.

On the Feather M0 Express you will be able to access this SPI bus (and the Flash) under the name SPI1. So the Flash device is totally distinct from the Feather GPIO's.

When used with Arduino, this SPI Flash memory would allow read/write operations.
Under CircuitPython (MicroPython Flavor)

Under CircuitPython, the SPI Flash memory is a native storage for the Python interpreter. The Flash memory does appears as read only for the user code.

Other pins!

FEATHER-M0-EXPRESS-Brochage-06.jpg
Crédit: AdaFruit Industries www.adafruit.com

  • RST - "Reset" pin. Wire this pin to the ground (GND) to reset the microcontroler and start the bootloader.
  • ARef - "Analog Reference" pin used when the microcontroler reads analog voltage. As default behavior, the reference voltage is identical to the logic level (so 3.3V). However, you can use a another analog reference voltage (eg: 1.5V) and inform you software to use the external reference AREF EXTERNE. In such case, the 12bits analog reads (value from 0 to 4095) would cover a voltage range from 0 to 1.5V, so a resolution of 1.5/4095=0.366mV.
    The reference voltage can never exceed 3.3v. The analogic pin voltage can never exceed the ARef reference voltage!

Debug Interface

For advanced users.

FEATHER-M0-EXPRESS-Brochage-07.jpg
Crédit: AdaFruit Industries www.adafruit.com

  • SWCLK et SWDIO - those contact points, visible under the board, are used to program the microcontroler. You can also use thoses contact to connect the SWD debugger.

Written by Meurisse D. from MC Hobby - License: CC-SA-BY.