advertisement
3.9.2
Development of GUI Programs with QT Library
With the development kit, you can develop a qt-based GUI program. Follow these steps, you can quickly convert your QT Project to a GUI application for RSB-4220:
1.
On your host PC, set up QT Build Environment.
#source /usr/local/cross_compiler/linux-devkit/environment-setup
2.
Build QT Instructions:
# cd projectdir
# qmake projectName.pro
# make
3.Run QT demo:
# ./qtappName -qws
Note!
The -qws Parameter tell the QT Application to run as a server.
3.9.3
Demo program source code
3.9.3.1
Serial Port Programming
Please refer to <BSP_PATH>/source/demo/uart
It is an example of sending and receiving data via the serial port.
Receiving data:
# ./uart_ctrl read /dev/ttyO1
Sending data:
# ./uart_ctrl write /dev/ttyO2
Before using your program of serial port, please ensure that your serial port is in 232/
422/485 mode.
User can reference the uart demo source code to develop the uart application.
3.9.3.2
Watchdog Programming
RSB-4220 support hardware watchdog, the watchdog API is follow posix standards.
The valid timeout value is from 1 to 6553 seconds, if the timeout value to set is not in this scope, driver will set timeout value to default value (60 seconds).
Sample C code:
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <signal.h>
#include <linux/watchdog.h> int fd; int main(int argc, const char *argv[]) { int timeout = 10;
/*open watchdog device, the watchdog device node is /dev/watchdog */ fd=open("/dev/watchdog",O_WRONLY);
/*set timeout to 10 seconds*/
57 RSB-4220 User Manual
/*when set timeout value, the watchdog driver will enable the watchdog automatically.*/ ioctl (fd, WDIOC_SETTIMEOUT, &timeout); while (1)
{
/*feed the watchdog every 5 seconds*/
/*when call this funtion to feed watchdog, the watchdog will reset its internal timer so it doesn't trigger the board reset. If do not feed the watchdog more than 10 seconds, the watchdog will timeout and the board will reset.*/ ioctl( fd, WDIOC_KEEPALIVE, NULL ); sleep (5);
} close (fd);
}
Here are some other APIs for watchdog.
Disable the watchdog timer sample code:
/*if user want to disable the watchdog before timeout, call the following ioctl function*/ int i_dis = WDIOS_DISABLECARD; ioctl( fd, WDIOC_SETOPTIONS, &i_dis );
Enable the watchdog timer sample code:
/*if user want to enable the watchdog again before timeout when it is disabled, call the following ioctl function. */ int i_en = WDIOS_ENABLECARD; ioctl( fd, WDIOC_SETOPTIONS, & i_en);
Get the current timeout value:
/*get the current timeout value the driver used*/ int timeout = 0; ioctl (fd, WDIOC_GETTIMEOUT, &timeout);
Please refer to <BSP_PATH>/source/demo/watchdog folder to get more information.
RSB-4220 User Manual 58
3.9.3.3
GPIO Programming
RSB-4220 has 8 gpios. Please refer to <BSP_PATH>/source/demo/gpio
Usage:
# ./gpio 200 out 1
Note!
“200” means gpio0, and so 200-207 corresponds to gpio0-gpio7.
“out” means output .
“1” is the value set to the corresponding gpio port.
3.9.3.4
Can Programming
Please refer to <BSP_PATH>/source/demo/can_test.
Note!
Can sending data sample c code, please refer to can_write.c.
Can receiving data sample c code, please refer to can_read.c.
3.9.3.5
Brightness Programming
Please refer to <BSP_PATH>/source/demo/brightness
Brightness driver provide the sys interface, so we can set and get brightness value throught the sys file:
/sys/class/backlight/pwm-backlight/brightness
You can set brightness using flowing command:
# echo “20” > /sys/class/backlight/pwm-backlight/brightness
Note!
The value should be between 1-100.
You can get current brightness value using flowing command:
# cat /sys/class/backlight/pwm-backlight/brightness
59 RSB-4220 User Manual
RSB-4220 User Manual 60
Chapter
4
4
System Recovery
This chapter introduces how to recover Linux operating system if it is damaged accidentally.
advertisement
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Related manuals
advertisement
Table of contents
- 8 Introduction
- 8 Specifications
- 8 Functional Specifications
- 9 Mechanical Specifications
- 9 Electrical Specifications
- 9 Environmental Specifications
- 9 Block Diagram
- 12 Jumpers
- 12 Jumper Description
- 12 Jumper List
- 12 Table 2.1: Jumper List
- 13 Jumper Settings
- 15 Connectors
- 15 Connector List
- 15 Connector Settings
- 16 Figure 2.1 miniPCIE
- 17 Figure 2.2 Debug Port
- 17 Figure 2.3 USB Type A connector
- 18 Figure 2.4 JTAG Pin header
- 20 Figure 2.5 Ethernet Connector
- 21 Figure 2.6 DC power Jack
- 21 Figure 2.7 Reset button
- 22 Figure 2.8 SD Slot
- 23 Figure 2.9 LVDS Connector
- 24 Figure 2.10LVDS Inverter Power Connector
- 25 Figure 2.112X20 pin Connector
- 26 Mechanical
- 26 Jumper and Connector Locations
- 26 Figure 2.12Jumper and Connector Layout (Top side)
- 26 Figure 2.13Jumpers and Connector Layout (Bottom Side)
- 26 Figure 2.14Coastline Layout
- 27 Board Dimensions
- 27 Figure 2.15Board Dimension Layout (Top Side)
- 27 Figure 2.16Board Dimension Layout (Bottom Side)
- 28 Figure 2.17Board Dimension Layout (Coastline)
- 28 Quick Start of RSB
- 28 Debug Port Connection
- 28 Debug Port Setting
- 28 Figure 2.18HyperTerminal Settings for Terminal Setup
- 29 Test Tools
- 29 eMMC Test
- 30 USB Test
- 30 SD Test
- 31 SPI Test
- 32 I2C Test
- 32 CAN Test
- 33 GPIO Test
- 33 LVDS Test
- 34 Mini-PCIe WIFI Test
- 35 2.5.10 LAN Test
- 37 2.5.11 RS232 Test
- 39 2.5.12 Watchdog Timer Test
- 42 Introduction
- 42 Package Content
- 42 Pre-built System Image
- 42 Source Code Package
- 43 Figure 3.1 Source code package structure
- 44 Figure 3.2 image\rootfs
- 46 Set up Build Environment
- 46 setenv.sh
- 47 Build Instructions
- 47 Build u-boot Image
- 47 Build Linux Kernel Image
- 47 Build Log
- 48 Kernel Source Code Modification
- 48 Add a Driver to Kernel by menuconfig
- 48 Figure 3.3 Linux Kernel Configuration
- 49 Figure 3.4 Selecting TI TPS65910 RTC Driver
- 50 Create a Linux System Boot Media
- 50 Storage Information (eMMC/SD card)
- 50 Create a Linux System SD Card
- 51 Boot from Onboard Flash
- 51 Debug Message
- 51 Figure 3.5 HyperTerminal Settings for Serial Console Setup
- 52 Linux System Configuration and Use
- 52 Display Output Setting
- 54 Service Configuration
- 56 Network configuration
- 56 Figure 3.6 IP Configuration
- 57 Date/Time Configuration
- 57 Figure 3.7 Date/Time Settings
- 57 About System
- 57 Figure 3.8 About System
- 58 Brightness Control
- 58 Figure 3.9 Brightness Control
- 58 Serial Tools
- 58 Figure 3.10Serial Control
- 59 Matrix GUI User’s Guide
- 59 Figure 3.11Matrix
- 60 Screen Rotation for Qt Application
- 61 3.8.10 Add a Startup items when boot
- 61 3.8.11 Package online install
- 62 Development Guide and Reference
- 62 Development of C/C++ Programs
- 63 Development of GUI Programs with QT Library
- 63 Demo program source code
- 68 System Recovery
- 70 RISC Design-in Services
- 72 Contact Information
- 73 Global Service Policy
- 73 Warranty Policy
- 74 Repair Process