Difference between revisions of "PcDuino9"

From LinkSprite Playgound
Jump to: navigation, search
(介绍)
(I2C RTC)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
== 介绍 ==
+
== Introduction ==
  
[[File:pcduino9.png|640px]]
+
[[File:pcduino9 d.jpg|640px]]
  
pcDuino9是一个高性能平台,拥有强大的多线程运算能力、图形处理能力以及硬件解码能力,而且它支持 Android和 Ubuntu 双系统,所以它也是一台强大的小型电脑, 我们希望你的创意和灵感能让它变得不平凡。
+
[[File:pcduino9 b.jpg|640px]]
  
== 规格 ==
+
[[File:pcduino9 c.jpg|640px]]
 +
 
 +
PcDuino9 is a high-performance platform with powerful multi-threaded computing power, graphics processing and hardware decoding capabilities, and it supports Android and Ubuntu dual system, so it is also a powerful small computer, we hope that your creativity and inspiration will make it become more extraordinary.
 +
 
 +
== Specifications ==
  
 
*CPU : Rockchip RK3288 ARM Corte-A17 Quad-Core up to 1.8GHz
 
*CPU : Rockchip RK3288 ARM Corte-A17 Quad-Core up to 1.8GHz
Line 31: Line 35:
 
*Board Size : 96 x 76 mm
 
*Board Size : 96 x 76 mm
  
== 产品参数 ==
+
== Hardware specifications ==
 +
 
 +
*CPU : Rockchip RK3288 ARM Corte-A17 Quad-Core up to 1.8GHz
  
*CPU: Rockchip RK3288 ARM Corte-A17 Quad-Core up to 1.8GHz
+
*GPU : ARM Mali-T760 MP4 Support OpenGL ES 1.1/2.0 /3.0, OpenVG1.1, OpenCL1.1, Directx11
 +
 
 +
*Memory : 1GB-4GB Dual-channel 32-bit LPDDR3
 +
 
 +
*Storage : 8GB-16GB eMMC (Opt.), Micro SD slot support SDXC
 +
 
 +
*Ethernet : 10/100/1000Mbps Ethernet (RTL8211)
 +
 
 +
*USB : USB 2.0 Host x 2 (Opt.), USB OTG x 1
  
*GPU: ARM Mali-T760 MP4 Support OpenGL ES 1.1/2.0 /3.0, OpenVG1.1, OpenCL1.1, Directx11
+
*Video : HDMI2.0 support maximum 4K@60Hz display (Micro HDMI), LVDS/MIPI-DSI display interface
  
*内存: 2GB DDR3 双通道
+
*Audio : 3.5mm audio In/Out
  
*存储器 : 16GB eMMC Flash, Micro SD
+
*Camera : MIPI-CSI camera interface
  
*网络 :以太网 -10/100/1000M以太网,无线网 -2.4GHz/5GHz双频WiFi,支持802.11a/b/g/n/ac协议,蓝牙 -Bluetooth 4.0
+
*WiFi/BT : AP6212 WiFi + BT module
  
*视频输入输出:HDMI2.0 up to 3840x2160@60O ,VGA up to 1080P
+
*IR: support infrared remote control function
  
*USB : USB2.0 x 1
+
*GPIO Extension : Raspberry Pi compatible GPIO, support UART, SPI, I2C BMC extension GPIO (Opt.), support ADC, PWM, UART, I2C
  
*IR : 支持红外遥控功能
+
*Board Size : 96 x 76 mm
  
*电源 : DC -5V/2.5A
+
*Power supply: DC -5V / 2.5A
  
== GPIOs 映射 ==
+
== GPIOs mapping ==
  
 
[[File:pcduino 9 d.png|640px]]
 
[[File:pcduino 9 d.png|640px]]
Line 63: Line 77:
 
[[File:pcduino9 f.png|640px]]
 
[[File:pcduino9 f.png|640px]]
  
== 快速入门 ==
+
== Quick Start ==
 
 
=== 1.在Windows烧写系统到eMMC ===
 
 
 
==== a.安装 RK USB 驱动 ====
 
 
 
*下载 [https://github.com/delongqilinksprite/pcDuino9-user-manual.git DriverAssistant],解压,然后运行里面的DriverInstallexe。
 
 
 
*为了使所有设备都是用更新的驱动,请选择“驱动卸载”,然后在选择“驱动安装”。
 
 
 
[[File:pcduino 9 g.png|640px]]
 
 
 
'''连接设备'''
 
 
 
*1.确保设备连接好电源适配器并处于通电状态。
 
 
 
*2.用 Micro USB OTG 线连接好设备和主机。
 
 
 
*3.按住设备上的 RECOVERY (恢复)键并保持。
 
 
 
*4.短按一下 RRESET(复位)键。
 
 
 
*5.大约两秒钟后,松开 RECOVERY 键。
 
 
 
*6.注意:如果发现按了 RESET 键后还是没有发现设备,请在保持 RECOVERY 键按下的同时,长按一下 PWRKEY 键,然后才松开 RECOVERY 键。
 
 
 
主机应该会提示发现新硬件并配置驱动。打开设备管理器,会见到新设备"Rockusb Device" 出现,如下图。如果没有,则需要返回上一步重新安装驱动。
 
 
 
[[File:pcduino 9 h.png|640px]]
 
 
 
==== b.烧写固件 ====
 
 
 
下载[https://github.com/delongqilinksprite/pcDuino9-user-manual.git AndroidTool],解压,运行里面的AndroidTool.exe(注意,如果是Windows7/8,需要按鼠标右键,选择以管理员身份运行),如下图:
 
 
 
[[File:pcduino 9 i.png|640px]]
 
 
 
'''烧写统一固件 xxxx.img 的步骤如下''':
 
 
 
*1.切换至"升级固件"页。
 
 
 
*2.按"固件"按钮,打开要升级的固件文件。升级工具会显示详细的固件信息。
 
 
 
*3.按"升级"按钮开始升级。
 
 
 
*如果升级失败,可以尝试先按"擦除Flash"按钮来擦除 Flash,然后再升级。
 
 
 
'''注意:如果你烧写的固件laoder版本与原来的机器的不一致,请在升级固件前先执行"擦除Flash"。'''
 
  
[[File:pcduino 9 j.png|640px]]
+
=== 1.Write the system to eMMC by SD card ===
  
'''烧写分区映像'''
+
Download the image which named pcDuino9-SD-to-eMMC-xxx.img,use dd or Win32Disk,copy the image to SD card ,put the SD card on pcDuino9,and then pcDuino9 system on switch SD,that means switch the button “on” ,use ttl uart to watch system log,when kernel start,put the system on switch to “off”,then wait for all things done.
 +
System user name : linaro ,password:linaro
  
烧写分区映像时,请使用对应SDK下的FFTools/AndroidTool.rar烧写。步骤如下:
+
=== 2.Write the system to eMMC on Linux ===
  
*1.切换至"下载镜像"页。
+
RK provides a command line tool of '''upgrade_tool''' under Linux, supporting for unified firmware '''update.img''' and partition image programming.
  
*2.勾选需要烧录的分区,可以多选。
+
There are two options for the open source tool:
 
 
*3.确保映像文件的路径正确,需要的话,点路径右边的空白表格单元格来重新选择。
 
 
 
*4.点击"执行"按钮开始升级,升级结束后设备会自动重启。
 
 
 
[[File:pcduino 9 k.png|640px]]
 
 
 
=== 2.在Linux烧写系统到eMMC ===
 
 
 
RK 提供了一个 Linux 下的命令行工具 upgrade_tool,支持统一固件 update.img 和分区镜像的烧写。
 
 
 
开源工具则有两个选择:
 
  
 
*rkflashtool [https://github.com/Galland/rkflashtool_rk3066 https://github.com/Galland/rkflashtool_rk3066]
 
*rkflashtool [https://github.com/Galland/rkflashtool_rk3066 https://github.com/Galland/rkflashtool_rk3066]
Line 137: Line 94:
 
*rkflashkit [https://github.com/linuxerwang/rkflashkit https://github.com/linuxerwang/rkflashkit]
 
*rkflashkit [https://github.com/linuxerwang/rkflashkit https://github.com/linuxerwang/rkflashkit]
  
它们都仅支持分区映像烧写,不支持统一固件。rkflashtool 是命令行工具,rkflashkit 有图形界面,后加了命令行支持,更是好用。以下仅对 rkflashkit 做介绍。 Linux 下无须安装设备驱动,参照 Windows 章节连接设备则可。
+
They only support the partition image programming, does not support a unified firmware. Rkflashtool is a command line tool, rkflashkit has a graphical interface and a command line support, which make it easier to use. The following only do an introduction of rkflashkit. There is no need to install the device driver for Linux, you can refer to the Windows chapter to connect the device.
  
 
'''upgrade_tool'''
 
'''upgrade_tool'''
  
下载 [Linux_Upgrade_Tool Linux_Upgrade_Tool], 并按以下方法安装到系统中,方便调用:
+
Download Linux_Upgrade_Tool, and install to the system as the following method to be easy to call:
  
 
  tar xf Linux_UpgradeTool_v1.2.tar.gz
 
  tar xf Linux_UpgradeTool_v1.2.tar.gz
Line 148: Line 105:
 
  sudo chown root:root /usr/local/bin/upgrade_tool
 
  sudo chown root:root /usr/local/bin/upgrade_tool
  
烧写统一固件 uxxxx.img:
+
Write unite firmware uxxxx.img:
  
 
  sudo upgrade_tool uf update.img
 
  sudo upgrade_tool uf update.img
  
烧写分区镜像:
+
Program partition image:
  
 
  sudo upgrade_tool di -b /path/to/boot.img
 
  sudo upgrade_tool di -b /path/to/boot.img
Line 160: Line 117:
 
  sudo upgrade_tool di -m /path/to/misc.img
 
  sudo upgrade_tool di -m /path/to/misc.img
 
  sudo upgrade_tool di resource /path/to/resource.img
 
  sudo upgrade_tool di resource /path/to/resource.img
  sudo upgrade_tool di -p paramater  #烧写 parameter
+
  sudo upgrade_tool di -p paramater  #Write parameter
  sudo upgrade_tool ul bootloader.bin # 烧写 bootloader
+
  sudo upgrade_tool ul bootloader.bin #Write bootloader
 +
 
  
如果因 flash 问题导致升级时出错,可以尝试低级格式化、擦除 nand flash:
+
If flash problems lead to an error during the upgrade, you can try low-level format or erase nand flash:
  
  sudo upgrade_tool lf  # 低级格式化
+
  sudo upgrade_tool lf  # low-level format
  sudo upgrade_tool ef  # 擦除
+
  sudo upgrade_tool ef  # erase nand flash
  
 
'''rkflashkit'''
 
'''rkflashkit'''
  
安装:
+
Installation:
  
 
  sudo apt-get install build-essential fakeroot  
 
  sudo apt-get install build-essential fakeroot  
Line 179: Line 137:
 
  sudo dpkg -i rkflashkit_0.1.2_all.deb
 
  sudo dpkg -i rkflashkit_0.1.2_all.deb
  
图形界面:
+
Graphic interface:
  
 
  sudo rkflashkit
 
  sudo rkflashkit
Line 185: Line 143:
 
[[File:pcduino 9 l.png|640px]]
 
[[File:pcduino 9 l.png|640px]]
  
命令行:
+
Command Line:
  
 
  $ rkflashkit --help
 
  $ rkflashkit --help
Line 198: Line 156:
 
  sudo rkflashkit flash @boot boot.img @kernel.img kernel.img reboot
 
  sudo rkflashkit flash @boot boot.img @kernel.img kernel.img reboot
  
=== 3.SD卡启动系统 ===
+
=== 3.SD card boot system ===
 
 
*下载xxxx.img系统镜像
 
  
*准备一张内存卡(4GB以上C10)
+
*Download the xxxx.img system image
  
*使用dd命令将系统复制到SD
+
*Prepare a memory card (C10 of more than 4GB)
  
*将卡插在pcDuino9,开机需要按着MASKROM键从TF卡启动
+
*Use the dd command to copy the system to SD
  
=== 4.pcDuino9硬件操作 ===
+
*Insert the card into the pcDuino9, press the MASKROM button starting from the TF card to boot.
  
硬件操作基于NightWiring 现在它是一个跨平台的C++库控制的硬件接口,包括UART、I2C、SPI和GPIO。大部分的代码是从wiringpi。 GPIO的功能是基于sysfs的现在,这是稍微慢一点,但灵活。
+
=== 4.pcDuino9 hardware operation ===
  
 +
Hardware operation is based on '''NightWiring''', which is a hardware interface controlled by a cross-platform C ++ library, including UART, I2C, SPI and GPIO.Most of the code can be downloaded from wiringpi. GPIO is based on the function of the sysfs, it will be slightly slower, but very flexible.
  
 
*git clone [https://github.com/nightseas/nightWiring.git https://github.com/nightseas/nightWiring.git]
 
*git clone [https://github.com/nightseas/nightWiring.git https://github.com/nightseas/nightWiring.git]
Line 219: Line 176:
 
  sudo make install
 
  sudo make install
  
==== GPIO LED控制 ====
+
==== GPIO LED control ====
  
 
  #include "nightWiring.h"
 
  #include "nightWiring.h"
Line 261: Line 218:
 
  }
 
  }
  
==== GPIO 按键输入 ====
+
==== GPIO key input ====
  
 
  #include "nightWiring.h"
 
  #include "nightWiring.h"
Line 388: Line 345:
 
     return 0;
 
     return 0;
 
  }
 
  }
 +
 +
== Produce pcDuino9 system image ==
 +
 +
=== Preparations ===
 +
 +
*Download pcDuino9 kernel [http://pan.baidu.com/s/1slB59XN kernel.tar.gz]
 +
 +
*Download pcDuino9 uboot [http://pan.baidu.com/s/1hsjxHp6 u-boot.tar.gz]
 +
 +
*Download root file system of pcDuino9 [https://pan.baidu.com/s/1eSE1tfW#list/path=%2F rockchip]
 +
 +
Create a directory called rk-linux in the linux host, and then download the uboot, kernel and root file system into this file.
 +
 +
=== The necessary environment for the installation ===
 +
 +
'''Note: Please use the 5.x version for the GCC version'''
 +
 +
sudo apt-get install git-core gitk git-gui gcc-arm-linux-gnueabihf u-boot-tools device-tree-compiler gcc-aarch64-linux-gnu
 +
sudo apt-get install gcc-arm-linux-gnueabihf libssl-dev gcc-aarch64-linux-gnu
 +
 +
=== Compile the kernel ===
 +
 +
cd rk-linux/kernel/
 +
make clean
 +
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- rockchip_linux_defconfig
 +
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4
 +
 +
=== Compile uboot ===
 +
 +
cd /rk-linux/u-boot/
 +
make distclean
 +
CROSS_COMPILE=arm-linux-gnueabihf- make fennec-rk3288_defconfig all
 +
 +
=== Produce boot.img ===
 +
 +
*Produce uboot-spl.img
 +
 +
cd rk-linux/
 +
u-boot/tools/mkimage -n rk3288 -T rksd -d u-boot/spl/u-boot-spl-dtb.bin uboot-spl.img
 +
cat u-boot/u-boot-dtb.bin >> uboot-spl.img
 +
 +
=== Produce extlinux.conf ===
 +
 +
vim extlinux.comf
 +
 +
label kernel-4.4
 +
    kernel /zImage
 +
    fdt /rk3288-fennec.dtb
 +
    append  earlyprintk console=ttyS2,115200n8 rw root=/dev/mmcblk1p7 rootfstype=ext4 init=/sbin/init
 +
 +
*Produce boot.img
 +
 +
cd rk-linux/
 +
sudo dd if=/dev/zero of=boot.img bs=1M count=128
 +
sudo mkfs.fat boot.img
 +
mkdir boot
 +
sudo mount boot.img boot
 +
sudo cp kernel/arch/arm/boot/zImage boot
 +
sudo cp kernel/arch/arm/boot/dts/rk3288-fennec.dtb boot
 +
sudo mkdir boot/extlinux
 +
sudo cp extlinux.conf boot/extlinux
 +
sudo umount boot
 +
 +
=== Download the root file system ===
 +
 +
Download the root file system and rename it.
 +
 +
mv linaro-rootfs.img rootfs.img
 +
 +
=== Create a card update system ===
 +
 +
Download [http://pan.baidu.com/s/1bPrkUq initrd.img]
 +
 +
*Format the SD card
 +
 +
chen@chen-HP-ProDesk-680-G1-TWR:~/work/linaro-alip/ramdisk/update$ sudo gdisk /dev/sdb
 +
GPT fdisk (gdisk) version 0.8.8
 +
Partition table scan:
 +
  MBR: protective
 +
  BSD: not present
 +
  APM: not present
 +
  GPT: present
 +
 +
 +
 +
Found valid GPT with protective MBR; using GPT.
 +
 +
 +
 +
Command (? for help): o
 +
This option deletes all partitions and creates a new protective MBR.
 +
Proceed? (Y/N): y
 +
 +
Command (? for help): n
 +
Partition number (1-128, default 1): 1
 +
First sector (34-126613470, default = 2048) or {+-}size{KMGTP}: 8192
 +
Last sector (8192-126613470, default = 126613470) or {+-}size{KMGTP}:
 +
Current type is 'Linux filesystem'
 +
Hex code or GUID (L to show codes, Enter = 8300):
 +
Changed type of partition to 'Linux filesystem'
 +
 +
Command (? for help): w
 +
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
 +
PARTITIONS!!
 +
Do you want to proceed? (Y/N): y
 +
OK; writing new GUID partition table (GPT) to /dev/sdc.
 +
Warning: The kernel is still using the old partition table.
 +
The new table will be used at the next reboot.
 +
The operation has completed successfully.
 +
 +
 +
 +
sudo umount /dev/sdb1
 +
 +
sudo mkfs.fat /dev/sdb1
 +
 +
 +
 +
sudo dd if=uboot-spl.img of=/dev/sdb seek=64
 +
 +
*Copy zimage, dts and ramdisk to /dev/sdb1
 +
 +
cd rk-linux/
 +
 +
cp kernel/arch/arm/boot/zImage /media/chen/9F35-9565/
 +
 +
cp kernel/arch/arm/boot/dts/rk3288-fennec.dtb /media/ls/9F35-9565/rk3288-fennec.dtb
 +
 +
cp ../rk-initrd-build/initrd.img /media/ls/9F35-9565/
 +
 +
*Add extlinux/extlinux.conf in the dev/sdb1/directory
 +
 +
label kernel-4.4
 +
    kernel /zImage
 +
    fdt /rk3288-fennec.dtb
 +
    initrd /initrd.img
 +
    append  earlyprintk console=ttyS2,115200n8 rw root=/dev/ram0 rootfstype=ext4 init=/sbin/init ramdisk_size=49152
 +
 +
*Copy u-boot-dtb.img, uboot-spl.img, boot.img, rootfs.img and update.sh to /dev/sdb1
 +
 +
mkdir /media/chen/9F35-9565/update
 +
cp uboot-spl.img /media/chen/9F35-9565/update
 +
cp boot.img /media/chen/9F35-9565/update
 +
cp rootfs.img /media/chen/9F35-9565/update
 +
cp update.sh /media/chen/9F35-9565/update
 +
 +
== Update the pcDuino9 system via SD card ==
 +
 +
Insert the SD card into the pcDuino9, and set the switch to the startup mode. When the kernel is up, set the switch to start the eMMC. When the system is up, you can see that the system image is being programmed into eMMC.

Latest revision as of 06:54, 19 January 2017

Introduction

Pcduino9 d.jpg

Pcduino9 b.jpg

Pcduino9 c.jpg

PcDuino9 is a high-performance platform with powerful multi-threaded computing power, graphics processing and hardware decoding capabilities, and it supports Android and Ubuntu dual system, so it is also a powerful small computer, we hope that your creativity and inspiration will make it become more extraordinary.

Specifications

  • CPU : Rockchip RK3288 ARM Corte-A17 Quad-Core up to 1.8GHz
  • GPU : ARM Mali-T760 MP4 Support OpenGL ES 1.1/2.0 /3.0, OpenVG1.1, OpenCL1.1, Directx11
  • Memory : 1GB-4GB Dual-channel 32-bit LPDDR3
  • Storage : 8GB-16GB eMMC (Opt.), Micro SD slot support SDXC
  • Ethernet : 10/100/1000Mbps Ethernet (RTL8211)
  • USB : USB 2.0 Host x 2 (Opt.), USB OTG x 1
  • Video : HDMI2.0 support maximum 4K@60Hz display (Micro HDMI), LVDS/MIPI-DSI display interface
  • Audio : 3.5mm audio In/Out
  • Camera : MIPI-CSI camera interface
  • WiFi/BT : AP6212 WiFi + BT module
  • GPIO Extension : Raspberry Pi compatible GPIO, support UART, SPI, I2C BMC extension GPIO (Opt.), support ADC, PWM, UART, I2C
  • Board Size : 96 x 76 mm

Hardware specifications

  • CPU : Rockchip RK3288 ARM Corte-A17 Quad-Core up to 1.8GHz
  • GPU : ARM Mali-T760 MP4 Support OpenGL ES 1.1/2.0 /3.0, OpenVG1.1, OpenCL1.1, Directx11
  • Memory : 1GB-4GB Dual-channel 32-bit LPDDR3
  • Storage : 8GB-16GB eMMC (Opt.), Micro SD slot support SDXC
  • Ethernet : 10/100/1000Mbps Ethernet (RTL8211)
  • USB : USB 2.0 Host x 2 (Opt.), USB OTG x 1
  • Video : HDMI2.0 support maximum 4K@60Hz display (Micro HDMI), LVDS/MIPI-DSI display interface
  • Audio : 3.5mm audio In/Out
  • Camera : MIPI-CSI camera interface
  • WiFi/BT : AP6212 WiFi + BT module
  • IR: support infrared remote control function
  • GPIO Extension : Raspberry Pi compatible GPIO, support UART, SPI, I2C BMC extension GPIO (Opt.), support ADC, PWM, UART, I2C
  • Board Size : 96 x 76 mm
  • Power supply: DC -5V / 2.5A

GPIOs mapping

Pcduino 9 d.png

pcDuino9

Pcduino 9 e.png

BMC STM32F411

Pcduino9 f.png

Quick Start

1.Write the system to eMMC by SD card

Download the image which named pcDuino9-SD-to-eMMC-xxx.img,use dd or Win32Disk,copy the image to SD card ,put the SD card on pcDuino9,and then pcDuino9 system on switch SD,that means switch the button “on” ,use ttl uart to watch system log,when kernel start,put the system on switch to “off”,then wait for all things done. System user name : linaro ,password:linaro

2.Write the system to eMMC on Linux

RK provides a command line tool of upgrade_tool under Linux, supporting for unified firmware update.img and partition image programming.

There are two options for the open source tool:

They only support the partition image programming, does not support a unified firmware. Rkflashtool is a command line tool, rkflashkit has a graphical interface and a command line support, which make it easier to use. The following only do an introduction of rkflashkit. There is no need to install the device driver for Linux, you can refer to the Windows chapter to connect the device.

upgrade_tool

Download Linux_Upgrade_Tool, and install to the system as the following method to be easy to call:

tar xf Linux_UpgradeTool_v1.2.tar.gz
cd Linux_UpgradeTool_v1.2
sudo mv upgrade_tool /usr/local/bin
sudo chown root:root /usr/local/bin/upgrade_tool

Write unite firmware uxxxx.img:

sudo upgrade_tool uf update.img

Program partition image:

sudo upgrade_tool di -b /path/to/boot.img
sudo upgrade_tool di -k /path/to/kernel.img
sudo upgrade_tool di -s /path/to/system.img
sudo upgrade_tool di -r /path/to/recovery.img
sudo upgrade_tool di -m /path/to/misc.img
sudo upgrade_tool di resource /path/to/resource.img
sudo upgrade_tool di -p paramater   #Write parameter
sudo upgrade_tool ul bootloader.bin #Write bootloader


If flash problems lead to an error during the upgrade, you can try low-level format or erase nand flash:

sudo upgrade_tool lf   # low-level format
sudo upgrade_tool ef   # erase nand flash

rkflashkit

Installation:

sudo apt-get install build-essential fakeroot 
git clone https://github.com/linuxerwang/rkflashkit
cd rkflashkit
./waf debian
sudo apt-get install python-gtk2
sudo dpkg -i rkflashkit_0.1.2_all.deb

Graphic interface:

sudo rkflashkit

Pcduino 9 l.png

Command Line:

$ rkflashkit --help
Usage: <cmd> [args] [<cmd> [args]...]
part                              List partition
flash @<PARTITION> <IMAGE FILE>   Flash partition with image file
cmp @<PARTITION> <IMAGE FILE>     Compare partition with image file
backup @<PARTITION> <IMAGE FILE>  Backup partition to image file
erase  @<PARTITION>               Erase partition
reboot                            Reboot device
For example, flash device with boot.img and kernel.img, then reboot:
sudo rkflashkit flash @boot boot.img @kernel.img kernel.img reboot

3.SD card boot system

  • Download the xxxx.img system image
  • Prepare a memory card (C10 of more than 4GB)
  • Use the dd command to copy the system to SD
  • Insert the card into the pcDuino9, press the MASKROM button starting from the TF card to boot.

4.pcDuino9 hardware operation

Hardware operation is based on NightWiring, which is a hardware interface controlled by a cross-platform C ++ library, including UART, I2C, SPI and GPIO.Most of the code can be downloaded from wiringpi. GPIO is based on the function of the sysfs, it will be slightly slower, but very flexible.

cd nightWiring/
make -j4
sudo make install

GPIO LED control

#include "nightWiring.h"
#include "nightWiringGPIO.h"
#include "stdio.h"

static int fennecGpioMap[] = {

    /*  GPIO2_A0  */
            56,
    /*  GPIO2_A1,       GPIO2_A2,       GPIO2_A3,       GPIO2_A4    */
            57,             58,             59,             60,
    /*  GPIO2_A5,       GPIO2_A6,       GPIO7_B1,       GPIO2_A7    */
            61,             62,             225,            63,
    /*  GPIO2_B0,        GPIO2_B1,      GPIO2_B2,       GPIO2_B4    */
            64,             65,             66,             68,
    /*  GPIO2_B5,        GPIO7_B0,      GPIO7_A7,       GPIO7_B2    */
            69,             224,            223,            226
}; 

int ledMap[] = {2, 10, 3, 11};

int main(void)
{
    int i, j;
    nightWiringSetup();
    nightWiringGpioSetup(fennecGpioMap, 17);
    for(i=0; i<4; i++)
        pinMode(ledMap[i], OUTPUT);
    while(1)
    {
        for(i=0; i<4; i++)
        {
            for(j=0; j<4; j++)
                digitalWrite(ledMap[j], HIGH);
            digitalWrite(ledMap[i], LOW);
            delay(500);
        }
    }
    return 0;
}

GPIO key input

#include "nightWiring.h"
#include "nightWiringGPIO.h"
#include "stdio.h"

static int fennecGpioMap[] = {
    /*  GPIO2_A0  */
            56,
    /*  GPIO2_A1,       GPIO2_A2,       GPIO2_A3,       GPIO2_A4    */
            57,             58,             59,             60,
    /*  GPIO2_A5,       GPIO2_A6,       GPIO7_B1,       GPIO2_A7    */
            61,             62,             225,            63,
    /*  GPIO2_B0,        GPIO2_B1,      GPIO2_B2,       GPIO2_B4    */
            64,             65,             66,             68,
    /*  GPIO2_B5,        GPIO7_B0,      GPIO7_A7,       GPIO7_B2    */
            69,             224,            223,            226
};

int keyMap[] = {6, 13, 4, 12, 5};
char keyName[5][7] = {"UP\0", "CENTER\0", "DOWN\0", "LEFT\0", "RIGHT\0"};     

int readKey(int num)
{
    int key = digitalRead(keyMap[num]);
    if(key == LOW)
    {
        // Delay for a while and re-detect the key status
        // Filtering glitches on the signal
        delay(10);
        if(key == LOW)
            return 1;
    } 

    return 0;
} 

int main(void)
{
    int i;
    nightWiringSetup();
    nightWiringGpioSetup(fennecGpioMap, 17);
    for(i=0; i<5; i++)
        pinMode(keyMap[i], INPUT);
    while(1)
    {
        for(i=0; i<5; i++)
        {
            if(readKey(i))
            {
                printf("Key %s is pressed!\n", keyName[i]);
                delay(500);
            }          
        }
    }
    return 0;
}

I2C RTC

#include "nightWiring.h"

#include "nightWiringI2C.h"

#include "stdio.h"

#define DS1307_ADDR 0x68

int i2cFd;
int quitFlag = 0;

unsigned char DEC2BCD(unsigned char val)
{
  return ( (val/10*16) + (val%10) );

}

unsigned char BCD2DEC(unsigned char val)
{
   return ( (val/16*10) + (val%16) );
}


void rtcSetTime(unsigned char year, unsigned char month, unsigned char date, unsigned char dayofWeek, unsigned char hour, unsigned char min ,unsigned   char sec)
{
  unsigned char reg = 0x00;
  i2cWriteReg8(i2cFd, 0x00, DEC2BCD(sec));
  i2cWriteReg8(i2cFd, 0x01, DEC2BCD(min));
  i2cWriteReg8(i2cFd, 0x02, DEC2BCD(hour));
  i2cWriteReg8(i2cFd, 0x03, DEC2BCD(dayofWeek));
  i2cWriteReg8(i2cFd, 0x04, DEC2BCD(date));
  i2cWriteReg8(i2cFd, 0x05, DEC2BCD(month));
  i2cWriteReg8(i2cFd, 0x06, DEC2BCD(year));   
}

void rtcGetTime() 
{
  unsigned char year, month, date, dayofWeek, hour, min ,sec;
  unsigned char reg = 0x00;
  sec       = BCD2DEC(i2cReadReg8(i2cFd, 0x00) & 0x7f);
  min       = BCD2DEC(i2cReadReg8(i2cFd, 0x01));
  hour      = BCD2DEC(i2cReadReg8(i2cFd, 0x02) & 0x3f);
  dayofWeek = BCD2DEC(i2cReadReg8(i2cFd, 0x03));
  date      = BCD2DEC(i2cReadReg8(i2cFd, 0x04));
  month     = BCD2DEC(i2cReadReg8(i2cFd, 0x05));
  year      = BCD2DEC(i2cReadReg8(i2cFd, 0x06));
  printf("Time: %02d-%02d-%02d  %02d:%02d:%02d.\n", year, month, date, hour, min ,sec);
}

int main(void)
{
    int i;
    if((i2cFd=i2cSetup("/dev/i2c-4", DS1307_ADDR)) < 0)
    {
        printf("Error: I2C acess failed! i2cSetup() return %d\n",i2cFd);
        return 0;
    }
    printf("I2C interface init complete.\n");
    printf("Writing time 2016-10-01 Sat 21:10:00 to RTC...\n");
    rtcSetTime(16,10,1,6,21,10,0);
    while(1)
    {
        rtcGetTime();
        delay(1000);
    }
    return 0;
}

Produce pcDuino9 system image

Preparations

  • Download root file system of pcDuino9 rockchip

Create a directory called rk-linux in the linux host, and then download the uboot, kernel and root file system into this file.

The necessary environment for the installation

Note: Please use the 5.x version for the GCC version

sudo apt-get install git-core gitk git-gui gcc-arm-linux-gnueabihf u-boot-tools device-tree-compiler gcc-aarch64-linux-gnu
sudo apt-get install gcc-arm-linux-gnueabihf libssl-dev gcc-aarch64-linux-gnu

Compile the kernel

cd rk-linux/kernel/
make clean
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- rockchip_linux_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4

Compile uboot

cd /rk-linux/u-boot/
make distclean
CROSS_COMPILE=arm-linux-gnueabihf- make fennec-rk3288_defconfig all

Produce boot.img

  • Produce uboot-spl.img
cd rk-linux/
u-boot/tools/mkimage -n rk3288 -T rksd -d u-boot/spl/u-boot-spl-dtb.bin uboot-spl.img
cat u-boot/u-boot-dtb.bin >> uboot-spl.img

Produce extlinux.conf

vim extlinux.comf
label kernel-4.4
    kernel /zImage
    fdt /rk3288-fennec.dtb
    append  earlyprintk console=ttyS2,115200n8 rw root=/dev/mmcblk1p7 rootfstype=ext4 init=/sbin/init
  • Produce boot.img
cd rk-linux/
sudo dd if=/dev/zero of=boot.img bs=1M count=128
sudo mkfs.fat boot.img
mkdir boot
sudo mount boot.img boot
sudo cp kernel/arch/arm/boot/zImage boot
sudo cp kernel/arch/arm/boot/dts/rk3288-fennec.dtb boot
sudo mkdir boot/extlinux
sudo cp extlinux.conf boot/extlinux
sudo umount boot

Download the root file system

Download the root file system and rename it.

mv linaro-rootfs.img rootfs.img

Create a card update system

Download initrd.img

  • Format the SD card
chen@chen-HP-ProDesk-680-G1-TWR:~/work/linaro-alip/ramdisk/update$ sudo gdisk /dev/sdb
GPT fdisk (gdisk) version 0.8.8
Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present



Found valid GPT with protective MBR; using GPT.



Command (? for help): o
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): y

Command (? for help): n
Partition number (1-128, default 1): 1
First sector (34-126613470, default = 2048) or {+-}size{KMGTP}: 8192
Last sector (8192-126613470, default = 126613470) or {+-}size{KMGTP}: 
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): 
Changed type of partition to 'Linux filesystem'

Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sdc.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot.
The operation has completed successfully.


sudo umount /dev/sdb1

sudo mkfs.fat /dev/sdb1


sudo dd if=uboot-spl.img of=/dev/sdb seek=64
  • Copy zimage, dts and ramdisk to /dev/sdb1
cd rk-linux/

cp kernel/arch/arm/boot/zImage /media/chen/9F35-9565/

cp kernel/arch/arm/boot/dts/rk3288-fennec.dtb /media/ls/9F35-9565/rk3288-fennec.dtb

cp ../rk-initrd-build/initrd.img /media/ls/9F35-9565/
  • Add extlinux/extlinux.conf in the dev/sdb1/directory
label kernel-4.4
    kernel /zImage
    fdt /rk3288-fennec.dtb
    initrd /initrd.img
    append  earlyprintk console=ttyS2,115200n8 rw root=/dev/ram0 rootfstype=ext4 init=/sbin/init ramdisk_size=49152
  • Copy u-boot-dtb.img, uboot-spl.img, boot.img, rootfs.img and update.sh to /dev/sdb1
mkdir /media/chen/9F35-9565/update
cp uboot-spl.img /media/chen/9F35-9565/update
cp boot.img /media/chen/9F35-9565/update
cp rootfs.img /media/chen/9F35-9565/update
cp update.sh /media/chen/9F35-9565/update

Update the pcDuino9 system via SD card

Insert the SD card into the pcDuino9, and set the switch to the startup mode. When the kernel is up, set the switch to start the eMMC. When the system is up, you can see that the system image is being programmed into eMMC.