The Metro M4 is chock-full of microcontroller goodness. There's also a lot of pins and ports. We'll take you a tour of them now!
There's a lot of ways to power the Metro M4 Express, and a lot of ways to get power out as well.
There are two primary ways to power the Metro:
- Through the Micro USB port up at the top left
- Through the DC jack at the bottom left
The MicroUSB jack provides 5V at 500mA or so, there is a fuse that will shut off temporarily when more than 1000mA is drawn, this is to protect a computer USB port. You can plug this into any computer or USB charger with a USB cable. You can draw up to 500mA between the Vin, 5V and 3.3V supplies (combined).
The DC Jack is a 5.5mm/2.1mm center-positive DC connector, which is the most common available. Provide about 6V-12V here to power the Metro. There is no fuse on this connection so you can draw more current, up to 800mA between the 5V and 3.3V supplies, and 2A from Vin.
Onboard regulators take the USB or DC power and linearly convert it to 3.3V and 5V:
- 3V - this is the output from the 3.3V regulator, it can supply 500mA peak
- 5V - this is the output from the 5V regulator (when DC jack is used), or from USB. It can supply ~500mA peak from USB and ~800mA peak from DC
- GND - this is the common ground for all power and logic
- Vin - this is the higher of the DC jack or USB voltage. So if the DC jack is plugged in and 9V, Vin is 9V. If only USB connected, this will be 5V.
There is also an on/off switch. This switch is only for the DC jack and does not affect powering via USB
This is the general purpose I/O pin set for the microcontroller.
All logic is 3.3V
All of the pins except SCL can do PWM output (A0 and A1 have true analog output instead)
All pins can be interrupt inputs
- #0 / RX - GPIO #0, also receive (input) pin for Serial1 (hardware UART)
#1 / TX - GPIO #1, also transmit (output) pin for Serial1
- #2 through #12 - These are general purpose GPIO. If there's a dot next to the pad it can act as a PWM output.
- #13 - GPIO #13 and is connected to the red LED marked L next to the USB jack. Also PWM output.
- SDA - the I2C (Wire) data pin. There's no pull up on this pin by default so when using with I2C, you may need a 2.2K-10K pullup.
- SCL - the I2C (Wire) clock pin. There's no pull up on this pin by default so when using with I2C, you may need a 2.2K-10K pullup.
- A0 - This pin is analog input A0 but is also an analog output due to having a DAC (digital-to-analog converter). This is the first DAC, and is 'independent' of A1. You can set the raw voltage to anything from 0 to 3.3V, unlike PWM outputs this is a true analog output
- A1 - This pin is analog input A1 but is also an analog output due to having a DAC (digital-to-analog converter). This is the second DAC, and is 'independent' of A0. You can set the raw voltage to anything from 0 to 3.3V, unlike PWM outputs this is a true analog output
- A2 thru A5 - These are each analog input as well as digital I/O pins.
Additional analog inputs
In addition to the A0-A5 pins, there are extra analog inputs available. There's not a ton because we ended up going with prioritizing the PCC camera peripheral pins rather than try to stuff as many analog inputs as possible
- SDA is also A6
- SCL is also A7
These pins are available in CircuitPython under the
board module. Names that start with # are prefixed with D and other names are as is. So #0 / RX above is available as
board.RX for example.
Parallel Capture Peripheral
There's a 'camera' input peripheral you can use with some camera chips to capture video with 10-bit data width. We thought this was neat so we made sure all those pins were available. Here are the PCC pins (left) and the Metro M4 pins it's mapped to. Unlike other peripherals, you cannot mux these signals to other pins!
- DEN1: MOSI
- DEN2: SCK
- CLK: MISO
- D0: D13
- D1: D12
- D2: D10
- D3: D11
- D4: D9
- D5: D8
- D6: D1
- D7: D0
- D8: D5
- D9: D6
As part of the 'Express' series of boards, the Metro M4 Express is designed for use with CircuitPython. To make that easy, we have added two extra parts to this Metro M4: a mini NeoPixel (RGB LED) and a 2 MB QSPI (Quad SPI) Flash chip
The NeoPixel is connected to pin #40 in Arduino, so just use our NeoPixel library and set it up as a single-LED strand on pin 40. In CircuitPython, the NeoPixel is
board.NEOPIXEL and the library for it is here and in the bundle. The NeoPixel is powered by the 3.3V power supply but that hasn't shown to make a big difference in brightness or color. The NeoPixel is also used by the bootloader to let you know if the device has enumerated correctly (green) or USB failure (red). In CircuitPython, the LED is used to indicate the runtime status.
The QSPI Flash is connected to 6 pins that are not brought out on the GPIO pads. This way you don't have to worry about the SPI flash colliding with other devices on the main SPI connection.
QSPI is neat because it allows you to have 4 data in/out lines instead of just SPI's single line in and single line out. This means that QSPI is at least 4 times faster. But in reality is at least 10x faster because you can clock the QSPI peripheral much faster than a plain SPI peripheral
However, the QSPI port is not also on an SERCOM. So, you have to either use the QSPI peripheral or bitbang SPI if you want to talk to the chip. We have an Arduino library here which provides QSPI interfacing for Arduino. In CircuitPython, the QSPI flash is used natively by the interpretter and is read-only to user code, instead the Flash just shows up as the writeable disk drive!
You'll need an adapter and cable to convert the 2x10 JTAG cable to SWD