View Source MangoPi MQ Pro Support

CircleCI Hex version

This is the base Nerves System configuration for the MangoPi MQ Pro.

The MangoPi MQ Pro works well, but there are active updates upstream and here. Backwards incompatible changes may be out of our control.

MangoPi MQ Pro


<sup>[Image credit](#mangopi)</sup>
FeatureDescription
CPU1 GHz 64 bit RISC-V
Memory512 MB or 1 GB DRAM
StorageMicroSD
Linux kernel6.1 w/ patches
IEx terminalUART ttyS0
GPIO, I2C, SPIYes - Elixir Circuits
DisplayYes, but not supported yet
ADCNo
PWM8 channels (4 exposed), but no Elixir support
UARTttyS0
CameraYes, but not supported yet
EthernetNo
WiFiOnboard WiFi
RTCNo
HW WatchdogYes

Using

The most common way of using this Nerves System is create a project with mix nerves.new and add mangopi_mq_pro references where needed and in a similar way to the default systems like bbb, etc. Then export MIX_TARGET=mangopi_mq_pro. See the Getting started guide for more information.

If you need custom modifications to this system for your device, clone this repository and update as described in Making custom systems.

Example use

This example assumes some familiarity with Nerves. To use this system, you'll need OTP 25. Follow the Nerves installation instructions for additional system dependencies.

Creating a new hello world application:

mix nerves.new hello_mango
cd hello_mango

Open up your mix.exs and add :mangopi_mq_pro to the @all_targets list at the top. It's ok to delete targets that you don't plan on using.

Then add the :nerves_system_mango_mq_pro dependency to the deps function:

    {:nerves_system_mangopi_mq_pro, "~> 0.1", runtime: false, targets: :mangopi_mq_pro},

This will load the latest released version. To use the latest code on the main branch here, add the following line:

    {:nerves_system_mangopi_mq_pro, runtime: false, targets: :mangopi_mq_pro, nerves: [compile: true], git: "https://github.com/nerves-project/nerves_system_mangopi_mq_pro", branch: "main"}

To build and write to a MicroSD card, run:

export MIX_TARGET=mangopi_mq_pro
mix deps.get
mix firmware
mix burn

Console access

The console is configured to output to the UART on pins 8 and 10 on the 40-pin GPIO connector. This is just like the Raspberry Pi. A 3.3V FTDI cable is needed to access the output.

Networking

The board has two network interfaces, a WiFi module and a virtual Ethernet on the USB C connector marked "OTG". If virtual Ethernet isn't working for you, try a different USB cable. You're welcome.

GPIO

The following table is a mapping between the logical GPIO numbers used in software (sysfs, Circuits.GPIO), and the pin numbers on the 20x2 Raspberry Pi header. For example, to control pin 11 you would open a connection to GPIO 117.

{:ok, pin} = Circuits.GPIO.open(117, :output)

The comments in the "Note" columns come from the official schematic.

GPIONotePinPinNoteGPIO
3v312Vin
205SDA34Vin
204SCL56GND
39MCLK78TX040
GND910RX041
117TX11112I2S_CLK / PWM0 / Audio37
118RX11314GND
32PWM31516PWM433
3v31718DC110
MOSI1920GND
MISO2122RX265
SCLK2324CS0
GND2526CS1111
145SDA2728SCL144
422930GND
433132TX264
443334GND
38PWM1 / I2S_FS3536DI234
1133738I2S_DI035
GND3940I2S_D036

You can also get the pinout at the IEx prompt by using the pinout library.

Pinout diagram

© CC-0 4.0 Lucas Sifoni

Schematics and datasheets

Thanks

The most helpful Allwinner D1 information comes from linux-sunxi.org/Allwinner_Nezha. All of the work here wouldn't have been possible with out it. Thanks especially to smaeul's Allwinner D1 Linux fork

Here are more useful links:

Image credit: This image is from mangopi.cc.