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

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

1

The input box turns available for input.

2

Input the driver and USB ID as the image below ( USB ID must be corresponding ), click Install Driver.

3

Wait for the driver to be installed.

4

1.3 Install DFU mode Driver

Select Device -> Create New Device

5

The input box turns available for input.

6

Input the driver and USB ID as the image below ( USB ID must be corresponding ), click Install Driver.

7

Wait for the driver to be installed

8

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.1, 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.

9

How to use the software

  1. After running the software, it will automatically get ports as the following picture shows.

  2. 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.

10

  1. 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

11

  1. The erase will be completed until it shows “Erase completed”

warning_yellow.png 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.

12

Camera firmware package file path: Camera_firmwareV0.1\output\images\u-boot-sunxi-with-nand-spl.bin

SPI firmware package file path: SPI_firmwareV0.1\output\images\u-boot-sunxi-with-nand-spl.bin

Camera firmware package file path: Camera_firmwareV0.1\output\images\devicetree.dtb

SPI firmware package file path: SPI_firmwareV0.1\output\images\devicetree_i2c_spi.dtb

Camera firmware package file path: Camera_firmwareV0.1\output\images\zlmage

SPI firmware package file path: SPI_firmwareV0.1\output\images\zlmage

Camera firmware package file path: Camera_firmwareV0.1\output\images\rootfs.ubi

SPI firmware package file path: SPI_firmwareV0.1\output\images\rootfs.ubi

13

14

  1. 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.

15

  1. After completing all the burning steps, "Please press RST button to restart system..." will appear, indicating that the burning is done!

16

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

17

Download codes

git clone https://github.com/Icenowy/sunxi-tools.git -b f1c100s-spiflash

18

Compile and install

cd sunxi-tools
make 
sudo make install

19

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

20

Burn firmware

Download firmware

21

Decompress the firmware

Create a folder (mkdir ll) --> move the compressed package (mv Camera_firmwareV0.1.zip ll) --> decompress the compressed package (unzip Camera_firmwareV0.1.zip)

22

What is putty?

putty is a Telnet, SSH, and serial interface connection software.

Install the serial port tool putty

sudo apt-get install putty

23

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.

24

Get the serial port address

Connect the board to the computer, use the command dmesg | grep tty, view serial device information.

25

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

26

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

27

Enter the firmware folder (the location where the firmware is stored)

28

Press the boot button and rst button of tiny200 at the same time, then release

Run the .\fel-uboot.sh script at this time

29

Then wait for the completion of the operation, and then enter mtd erase spi-nand0, format it.

30

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

31

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

32

33

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

34

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

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"

35

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.

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

36

2) On the pop-up window, click the "+" sign, select "SFTP", create a remote server configuration

37

3) Then enter the remote server name on the pop-up window, click "ok"

38

4) Modify the SSH configuration, determine whether it can be connected through Test Connection, the Root path can be determined through Autodetect button.

39

5) Click Tools->Deployment->Browse Remote Host on the Pycharm tab

40

Then the following screen will appear.

41

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

42

43

2) Write the script, and click the upload button (the red box), upload the content to Mango-Pi

44

3) Run hello.py

Click Tools->Start SSH Session on the Pycharm tab

45

In the pop-up window, select the previously configured SSH configuration information.

46

Then enter "python hello.py" in the pop-up window, and press Enter.

47

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

Step 1 Create a session

Select "Session"

48

Select the session type "SSH"

In the "Remote host" box, fill in "192.168.9.1", select "Specify username", and then write "root"

49

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.

50

After pressed "enter", it will enter the session interface.

51

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

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

Start Mapping

# ls /sys/class/gpio
export  gpiochip0  unexport
# echo 132 > /sys/class/gpio/export
# ls /sys/class/gpio/
export     gpio132    gpiochip0  unexport
echo out > /sys/class/gpio/gpio132/direction
echo 1 > /sys/class/gpio/gpio132/value # Set GPIO output high level
echo 0 > /sys/class/gpio/gpio132/value # Set GPIO output low level
echo in > /sys/class/gpio/gpio133/direction
#cat /sys/class/gpio/gpio133/value
1
#echo 132 > /sys/class/gpio/unexport
#ls /sys/class/gpio
export  gpiochip0  unexport

Control GPIO via Pinpong

Make the LED blink.

import time
from pinpong.board import Board, Pin

b = Board("PYB")
b.begin()
led = Pin(131, Pin.OUT)

while True:
    led.value(1)
    time.sleep(1)
    led.value(0)
    time.sleep(1)

Connect an LED light to pin 131 (PE3)

52

The LED flashes after running the program.

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)

Connect an LED light to pin 131 (PE3); Connect a button to pin 130 (PE2)

53

After running, you can turn on and off the LED lights by pressing the button

4.2 LCD Screen

Requirements

54

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.

55

#echo hello dfrobot > /dev/tty1

56

4.3 Camera (please install camera firmware)

Requirements

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

57

Check the result

Here, I set up a file server to get the pictures

python -m http.server 8081

58

59

60

61

4.4 Record/Play

Requirements

62

Connect a speaker to the port OUT+ and OUT-.

Modify the configuration file

63

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.

64

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

65

Start Recording

tinycap 1.wav -d 0 -c 1 -r 44100 -b 16

Press Ctrl + C to end recording.

66

Check the recording result

tinplay 1.wav

67

4.5 I2C

Requirements

68

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("PYB").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

69

70

4.6 SPI(Use SPI Firmware)

Requirements

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
DC PE5
RES PE4
CS PE7
MISO PE10
MOSI PE8
SCLK PE9
GND GND
VCC 3V3

Write the script

import time
from pinpong.board import Board,Pin
from pinpong.libs.dfrobot_ili9341 import ILI9341_SPI #Import ili9341 library

Board("PYB").begin()

dc = Pin(133, Pin.OUT)
res = Pin(132, 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

70

72

4.7 WiFi

To be completed...

FAQ

Please click the topic link on DFRobot Forum.

For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents

DFshopping_car1.png Get MangoPi R3 from DFRobot Store or DFRobot Distributor.

Turn to the Top