Introduction
This micro development board is specially designed to run Linux. Despite a mini body, it has all the vital functions. Equipped with F1C200S as the maincontroller chip, the board offers various commonly-used peripheral ports: GPIO, I2C & SPI, SDIO, Audio port(record, play), Video(RGB565 Display, touch, DVP), USB Host, OTG, etc. Besides, the board comes with a built-in 64MB DDR and onboard 128MB Nand Flash, which fully supports Linux ecology and running complete Python.
Currently, this product is fully open source so that users are allowed to compile any module according to their own requirements. However, it’s mainly for Python developers and senior enthusiasts as it’s a little difficult to get started.
Specification
- Built-in 64MB DDR
- On-board 128MB Nand Flash
- 420MHz system clock default frequency, able to be overclocked to 700MHz and above
- Rich GPIO pins
- Onboard SDIO port for connecting SD card or SDIO WiFi + BT module
- DVP camera interface in support of cameras such as OV2640, GC0328, etc.
- RGB565 display interface and 6-wire touch interface
- Onboard mic and power amplifier
- Low power consumption
- Support complete Python running
1. Driver Installtion on Windows
If you are a Windows user, you will need to install a driver when using this MangoPi-R3.
1.1 Download the zadig driver installation helper
Click to download: zadig-2.5.exe
Original Link: https://github.com/aodzip/buildroot-tiny200/blob/master/flashutils/windows/README.md
1.2 Install FEL mode Driver
Select Device -> Create New Device
The input box turns available for input.
Input the driver and USB ID as the image below ( USB ID must be corresponding ), click Install Driver.
Wait for the driver to be installed.
1.3 Install DFU mode Driver
Select Device -> Create New Device
The input box turns available for input.
Input the driver and USB ID as the image below ( USB ID must be corresponding ), click Install Driver.
Wait for the driver to be installed
Firmware Burning
Since the interface is multiplexed, the camera and SPI cannot be used at the same time. So, the firmware is divided into "camera firmware" and "spi firmware". Users can burn them according to their needs.
The current firmware version is version 0.2, click on the link below to download the firmware.
2.1 Burning on Windows
SPI NAND Flash Burning Tool
The software is a burning soft tool developed specifically for F1C100S/F1C200S chips and operates in Windows.
Software Download
Click to download SPI NAND Flash Tool
Software interface. The software will automatically get the port number and the main control IC model after it runs.
How to use the software
After running the software, it will automatically get ports as the following picture shows.
Connect the computer to the TTL and OTG of the MangoPi-R3 (both interfaces need to be connected to the computer) and wait for the software to acquire the board serial port and SOC.
If "COM port found:" is displayed, and the SOC recognizes and displays it, indicating that the next step can be made.
- Click Erase Flash, coming “Please press BOOT and RST buttons, and release to enter FEL mode”, then go on as the steps below:
1) Press the BOOT button on the board 2) Press the RST button 3) Release the BOOT button 4) Release the RST button
- The erase will be completed until it shows “Erase completed”
NOTE: This step is very necessary, which is also set in the software that if not to erase Flash, it cannot write in the firmware.
- Click boot ... button to browse the folder, select the corresponding burn file in the downloaded SPI NAND Flash tool kit.
Camera firmware package file path: Camera_firmwareV0.2\output\images\u-boot-sunxi-with-nand-spl.bin
SPI firmware package file path: SPI_firmwareV0.2\output\images\u-boot-sunxi-with-nand-spl.bin
- Click dtb ... button to browse the folder, select the corresponding burn file in the downloaded firmware package.
Camera firmware package file path: Camera_firmwareV0.2\output\images\devicetree.dtb
SPI firmware package file path: SPI_firmwareV0.2\output\images\devicetree_i2c_spi.dtb
- Click kernel ... Button to browse the folder, select the corresponding burn file in the downloaded firmware package.
Camera firmware package file path: Camera_firmwareV0.2\output\images\zlmage
SPI firmware package file path: SPI_firmwareV0.2\output\images\zlmage
- Click rootfs ... Button to browse the folder, select the corresponding burn file in the downloaded firmware package.
Camera firmware package file path: Camera_firmwareV0.2\output\images\rootfs.ubi
SPI firmware package file path: SPI_firmwareV0.2\output\images\rootfs.ubi
- Click the Write button in turn to start burning. When "Please press BOOT and RST buttons, and release to start burning" appears, follow the order of operations: 1)Press the BOOT button on the board 2)Press the RST button 3)Release the BOOT button 4)Release the RST button
Wait for the burn. The successful burning will be indicated by the appearing “Burning completed successfully”, then click the next Write button.
- After completing all the burning steps, "Please press RST button to restart system..." will appear, indicating that the burning is done!
Press the RST button on the board and the new system starts working!
2.2 Burning on Linux (Use Command Line)
Install Burning Tool
What is sunxi-tools?
sunxi-tools is a command line tools collection for ARM devices with Allwinner SoC (Intelligent Application Processor Soc developed by Allwinner Technology).
Set up and install sunxi-tools
Install dependency packages
sudo apt install pkg-config zlib1g-dev libusb-dev libusb-1.0-0-dev
Download codes
git clone https://github.com/Icenowy/sunxi-tools.git -b f1c100s-spiflash
Compile and install
cd sunxi-tools
make
sudo make install
What is dfu? Device Firmware Upgrade (DFU) is a mechanism independent of distributor and equipment, which is used to upgrade the firmware of a USB device through improved versions provided by its manufacturer, thereby offering (for example) a method of deploying firmware error repairing. During the firmware upgrade operation, the USB device will effectively change its operating mode, thus becoming a PROM programmer. Following the official DFU specification, any type of USB device can implement this function. DFU also allows users to freely use backup firmware to refresh USB devices. One of the results is that the refreshed USB device may act as a variety of device types.
What is dfu-util? dfu-util is a host (PC) program that implements the USB DFU (Universal Serial Bus Device Firmware Upgrade) protocol. DFU will download the firmware to the device that connected by USB, or download the firmware from the device. Its application ranges from small devices such as micro-controller boards to mobile phones devices. Using dfu-util, you can download/upload firmware to/from DFU-enabled devices.
Install dfu-util through apt-get
sudo apt install dfu-util
Burn firmware
Download firmware
Decompress the firmware
Create a folder (mkdir ll) --> move the compressed package (mv Camera_firmwareV0.2.zip ll) --> decompress the compressed package (unzip Camera_firmwareV0.2.zip)
What is putty?
putty is a Telnet, SSH, and serial interface connection software.
Install the serial port tool putty
sudo apt-get install putty
Open the serial port debugging software putty
In the case of default installation, putty is added to the /usr/bin directory, so you can directly use the putty command in the terminal to open it.
Get the serial port address
Connect the board to the computer, use the command dmesg | grep tty, view serial device information.
From this, we can get that the serial port of the board is ttyUSB0
Generally, the name of the serial port is under dev, which if you don't have an external serial port card, the default is dev.
Use the command ls /dev/ttyUSB0 to see if it exists
If the result exists, then the serial port address is /dev/ttyUSB0
Fill the serial port in putty, and then open the serial port to format
- serial line: fill in the corresponding serial number
- speed: fill in 115200
Enter the firmware folder (the location where the firmware is stored)
Press the boot button and rst button of tiny200 at the same time, then release
Run the .\fel-uboot.sh script at this time
Then wait for the completion of the operation, and then enter mtd erase spi-nand0, format it.
Add file permissions
Use the ll command to view file permissions.
If the file does not have execute permissions, you need to add permissions, adding permissions through the following command.
chmod +x fel-uboot.sh
chmod +x dfu-nand-ubifs.sh
If adding permissions fails, you can try to add sudo (ie sudo chmod +x fel-uboot.sh) in front of the command, or you can switch to the administrator account (su), and then add permissions.
Start burning
Enter the firmware folder ().
Press the boot button and rst button of tiny200, then release the rst button and run the following command.
sudo ./fel-uboot.sh && ./dfu-nand-ubifs.sh
Verify whether Mango-Pi is successfully burned
Press the RST button of Mango-Pi, enter the operational mode.
Need to wait for more than 10s if you use it for the first time.
Testing through ifconfig
A network card adapter with the address of 192.168.9.6 appears, which proves that the programming is successfully burned.
The Python environment has been built in, the version is Python 3.8.5
Connect the mainboard
- Mainboard RNDIS network card IP address: 192.168.9.1
- Username: root
- Password: dfrobot
- Install RNDIS driver
3.1 RNDIS
RNDIS refers to Remote NDIS. The implementation of RNDIS based on USB is actually TCP/IP over USB, which is to run TCP/IP on the USB device, it make the USB device act like a network card. We can access the motherboard through the network protocol.
RNDIS driver installation
Use a usb data cable to connect the OTG socket on the Mango-Pi board, connect the board to the computer.
Windows driver download address
Step 1. Open "Device Manager"
Open the menu with Win+X, select "Device Manager"
Step 2. Right-click and select the port which represent the Mango-Pi board
Mango-Pi in my case is a USB serial device (COM43)
Step 3. Install Driver
Select "Update Driver" >>> Select "Browse my computer for finding driver
Click "Browse" to locate the folder where the RNDIS driver is. Click "Next", wait for a while, it will show that the driver is installed successfully.
Step 4. Check that if the driver is installed successfully
After the driver is installed, "USB Ethernet/RNDIS Gadget" will appear in the device manager.
ps: "#3" behind USB Ethernet/RNDIS Gadget is meaningless.
图片 英文
About the functions of the two USB ports on Mango-Pi.
They are TTL and OTG interfaces
TTL interface
The TTL interface is leads out from the CP2104 chip, it converts the UART0 of the F1C200S chip into a USB serial port, we can use it as a serial port terminal on the motherboard.
OTG interface
The OTG interface is a interface that leads out the USB port of the F1C200S chip, we simulate the USB port of the F1C200S chip as an RNDIS device, which becomes a USB network card that connected to the board under the action of RNDIS driver.
3.2 Recommended software
We use the SSH protocol to remotely control the motherboard, use the sftp protocol to remotely transfer files. We recommend two commonly used software, one is PyCharm (commercial version), the other is MobaXterm.
PyCharm
PyCharm is a Python IDE, it has a set of tools that can help users become more efficiency when they are using Python language development, and also provides SSH remote control, sftp remote transmission functions.
Use PyCharm to connect to the mainboard
Connect the board, notice: the access point is the OTG interface of Mango-Pi.
1) Click Tools->Deployment->Configuration on the Pycharm tab
2) On the pop-up window, click the "+" sign, select "SFTP", create a remote server configuration
3) Then enter the remote server name on the pop-up window, click "ok"
4) Modify the SSH configuration, determine whether it can be connected through Test Connection, the Root path can be determined through Autodetect button.
- host: 192.168.9.1
- Username: root
- Password: dfrobot
5) Click Tools->Deployment->Browse Remote Host on the Pycharm tab
Then the following screen will appear.
At this point, the connection to the motherboard is completed.
Compile and run the hello dfrobot program
1) Right-click on the blank space of the Remote Host window, select File under New, create a py file, and name it hello.py
2) Write the script, and click the upload button (the red box), upload the content to Mango-Pi
3) Run hello.py
Click Tools->Start SSH Session on the Pycharm tab
In the pop-up window, select the previously configured SSH configuration information.
Then enter "python hello.py" in the pop-up window, and press Enter.
MobaXTerm
Mobaxterm is a fully functional and free to use terminal tool, it supports multiple remote terminal access methods such as SSH, Serial, VNC, X11, etc.
After installing it, we can remotely control all linux remote hosts.
Install MobaXTerm
- Connect the board, note: the access point is the OTG interface of Mango-Pi.
- Run the program, start the first step
Step 1 Create a session
Select "Session"
Select the session type "SSH"
In the "Remote host" box, fill in "192.168.9.1", select "Specify username", and then write "root"
Click "OK", enter the session interface.
Step 2 Enter the session interface
Enter the password: dfrobot ------> The password entered here will not be displayed
Then press enter.
After pressed "enter", it will enter the session interface.
The sftp window on the left side can be used for file editing, the ssh window on the right side is used for command interaction.
Install pinpong Library
To be completed....
4. Control mainboard resources
4.1 GPIO
Requirements
Mango-Pi board with firmware burned ×1
Button ×1
LED ×1
GPIO mapping relationship under sysfs file system
Mapping pin formula: 32×pin group serial number + pin sub-number = mapped pin number
Pin Group
Pin Classification | Mapped Serail Number |
---|---|
Pin start with PA | 0 |
Pin start with PB | 1 |
Pin start with PC | 2 |
Pin start with PD | 3 |
Pin start with PE | 4 |
Pin start with PF | 5 |
And so on.
Example
Example 1: Suppose you want to operate the pin PE4
The serial number of PE is 4
The corresponding position of PE4 is the fourth pin under PE
Plug it into the formula, you get: 32×4+4=132
Which is, PE4 mapped to GPIO is pin 132Example 2: Suppose you want to operate the pin PA6
The serial number of PA is 0
The corresponding position of PA4 is the sixth pin under PA
Plug it into the formula, you get: 32×0+6=6
Which is, PA6 mapped to GPIO is pin 6Example 3: Suppose you want to operate the pin PF1
The serial number of PF is 5
The corresponding position of PF1 is the first pin under PF
Plug it into the formula, you get: 32×5+1=161
Which is, PF1 mapped to GPIO is pin 161
Start Mapping
- Export the GPIO we need
# ls /sys/class/gpio
export gpiochip0 unexport
# echo 132 > /sys/class/gpio/export
# ls /sys/class/gpio/
export gpio132 gpiochip0 unexport
- Set GPIO as output direction
echo out > /sys/class/gpio/gpio132/direction
- Set the output level of GPIO
echo 1 > /sys/class/gpio/gpio132/value # Set GPIO output high level
echo 0 > /sys/class/gpio/gpio132/value # Set GPIO output low level
- Set GPIO as input direction
echo in > /sys/class/gpio/gpio133/direction
- Read GPIO level in the input mode
#cat /sys/class/gpio/gpio133/value
1
- Delete GPIO configuration file
#echo 132 > /sys/class/gpio/unexport
#ls /sys/class/gpio
export gpiochip0 unexport
Control GPIO via Pinpong
- Blink(Output mode test)
Make the LED blink.
import time
from pinpong.board import Board, Pin
b = Board("F1C")
b.begin()
led = Pin(3, Pin.OUT)
while True:
led.value(1)
time.sleep(1)
led.value(0)
time.sleep(1)
- Test Result
Connect an LED light to pin 131 (PE3)
The LED flashes after running the program.
- Button(Input mode + output mode test)
Turn on/off the LED.
import time
from pinpong.board import Board, Pin
pyb = Board("PYB").begin()
btn = Pin(130, Pin.IN)
led = Pin(131, Pin.OUT)
while True:
v = btn.value()
print(v)
led.value(v)
time.sleep(0.1)
- Test Result
Connect an LED light to pin 131 (PE3); Connect a button to pin 130 (PE2)
After running, you can turn on and off the LED lights by pressing the button
4.2 LCD Screen
Requirements
- Mango-Pi board with firmware burned ×1
- FPC-SH500J01Z LCD Screen ×1
Operate the LCD
Plug the LCD cable into the motherboard socket
Check the screen interface
# ls /dev/fb0
/dev/fb0
Check the result
Power on, start the system.
Print string to the screen
#echo hello dfrobot > /dev/tty1
4.3 Camera (please install camera firmware)
Requirements
- Mango-Pi board with camera firmware burned ×1
- ov2640 Camera ×1
Start taking photo
Set image format
media-ctl --set-v4l2 '"ov2640 0-0030":0[fmt:YUYV8_2X8/640x480]'
Test
fswebcam -d /dev/video0 --no-banner -r 640x480 -S 10 1.jpg
Check the result
Here, I set up a file server to get the pictures
python -m http.server 8081
4.4 Record/Play
Requirements
- Mango-Pi board with firmware burned ×1
- Serial port to network port installation driver
- Speaker ×1
Connect a speaker to the port OUT+ and OUT-.
Modify the configuration file
How to modify?
Modify command: tinymix set serial Number Content
For Example: tinymix set 2 1 Modify the value of the term which the serial number is 2 to on.
Modify it like this
Number of controls: 25
ctl type num name value
0 INT 1 DAC Playback Volume 63 (range 0->63)
1 INT 1 Headphone Playback Volume 63 (range 0->63)
2 BOOL 2 Headphone Playback Switch On, On
3 INT 1 Line In Playback Volume 0 (range 0->7)
4 INT 1 FM In Playback Volume 0 (range 0->7)
5 INT 1 Mic In Playback Volume 3 (range 0->7)
6 INT 1 Mic Boost Volume 4 (range 0->7)
7 INT 1 ADC Capture Volume 3 (range 0->7)
8 BOOL 1 ADC Mixer Right Out Capture Switch Off
9 BOOL 1 ADC Mixer Left Out Capture Switch Off
10 BOOL 1 ADC Mixer Line In Capture Switch Off
11 BOOL 1 ADC Mixer Right FM In Capture Switch Off
12 BOOL 1 ADC Mixer Left FM In Capture Switch Off
13 BOOL 1 ADC Mixer Mic Capture Switch On
14 BOOL 1 Left Mixer Right DAC Playback Switch Off
15 BOOL 1 Left Mixer Left DAC Playback Switch Off
16 BOOL 1 Left Mixer FM In Playback Switch Off
17 BOOL 1 Left Mixer Line In Playback Switch Off
18 BOOL 1 Left Mixer Mic In Playback Switch Off
19 BOOL 1 Right Mixer Left DAC Playback Switch Off
20 BOOL 1 Right Mixer Right DAC Playback Switch Off
21 BOOL 1 Right Mixer FM In Playback Switch Off
22 BOOL 1 Right Mixer Line In Playback Switch Off
23 BOOL 1 Right Mixer Mic In Playback Switch Off
24 ENUM 2 Headphone Source Playback Route , DACMixer, , DACMixer
Start Playing Audio
tinplay 001.wav
Start Recording
tinycap 1.wav -d 0 -c 1 -r 44100 -b 16
Press Ctrl + C to end recording.
Check the recording result
tinplay 1.wav
4.5 I2C
Requirements
- Mango-Pi board with firmware burned ×1
- OLED Screen
Connect the OLED screen to Mango-Pi
Connect VCC, GND, SCL, and SDA to the corresponding positions on the Mango-Pi board.
Screen Pin | Mango-Pi Pin |
---|---|
VCC | 3V3 |
GND | GND |
SCL | SCL |
SDA | SDA |
Write Script
import time
from pinpong.board import Board
from pinpong.libs.dfrobot_ssd1306 import SSD1306_I2C #Import ssd1306 library
Board("F1C").begin()
oled=SSD1306_I2C(width=128, height=64, bus_num=0) #Initializes the screen, transmits in the numbers of screen pixels
while True:
oled.fill(1) #fully filled display
oled.show() #Display is valid
print("1")
time.sleep(1)
oled.fill(0) #turn off fully filled, clear the screen
oled.show() #Display is valid
print("0")
time.sleep(1)
oled.text(0) #Display numbers
oled.text("Hello PinPong",8,8) #Display texts at specified location
oled.show() #Display is valid
time.sleep(2)
Check the result
Use the following command to verify if it succeeded.
python oled.py
4.6 SPI(Use SPI Firmware)
Requirements
- Mango-Pi board with firmware burned ×1
- TFT LCD Screen ×1
Connect the TFT LCD screen to Mango-Pi
Connect DC, RES, CS, MISO, MOSI, SCLK, GND, VCC to the corresponding positions on the tiny200 board in turn.
Screen Pin | Mango-Pi Pin | Pinpong Pin |
---|---|---|
DC | PE5 | 133 |
RES | PE4 | 132 |
CS | PE7 | 135 |
MISO | PE10 | 138 |
MOSI | PE8 | 136 |
SCLK | PE9 | 137 |
GND | GND | GND |
VCC | 3V3 | 3V3 |
Write the script
import time
from pinpong.board import Board,Pin
from pinpong.libs.dfrobot_ili9341 import ILI9341_SPI #Import ili9341 library
Board("F1C").begin()
dc = Pin(5, Pin.OUT)
res = Pin(4, Pin.OUT)
lcd = ILI9341_SPI(width=240, height=320, bus_num=1,device_num=0, dc=dc, res=res) #Initializes the screen, transmits in the numbers of screen pixels
lcd.begin()
while True:
lcd.fill(lcd.COLOR_RGB565_BLACK)
time.sleep(1)
lcd.fill(lcd.COLOR_RGB565_NAVY)
time.sleep(1)
lcd.fill(lcd.COLOR_RGB565_DGREEN)
time.sleep(1)
Check the result
Use the following command to verify if it succeeded.
python ili.py
4.7 WiFi
To be completed...
FAQ
For any questions, advice or cool ideas to share, please visit the DFRobot Forum.