Embest SBC6845 User manual

SBC6845
SBC6845
SBC6845
SBC6845
Single
Single
Single
Single Board
Board
Board
Board Computer
Computer
Computer
Computer
User
User
User
User Manual
Manual
Manual
Manual
(For
(For
(For
(For Linux
Linux
Linux
Linux System)
System)
System)
System)
Version 1.1 – Jan.11.2013

Embest Technology
Copyright © 2012-2013 Embest Technology SBC6845 User Manual
i
i
i
i
Copyright
Copyright
Copyright
Copyright Statement:
Statement:
Statement:
Statement:
SBC6845 and its related intellectual property are owned by Shenzhen Embest
Technology Co., Ltd.
Shenzhen Embest Technology has the copyright of this document and reserves
all rights. Any part of the document should not be modified, distributed or
duplicated in any approach and form with the written permission issued by
Embest Technology Co., Ltd.
Disclaimer:
Disclaimer:
Disclaimer:
Disclaimer:
Shenzhen Embest Technology does not take warranty of any kind, either
expressed or implied, as to the program source code, software and documents
in the CD/DVD-ROMs provided along with the products, and including, but not
limited to, warranties of fitness for a particular purpose; The entire risk as to the
quality or performance of the program is with the user of products; Should the
program prove defective, the user of products assumes the cost of all
necessary servicing, repair or correction.
Revision
Revision
Revision
Revision History:
History:
History:
History:
Version
Version
Version
Version Date
Date
Date
Date Note
Note
Note
Note
1.0 2012-11-16 Original Version
1.1 201 3 - 01 -
11
First Revision

Embest Technology
Copyright © 2012-2013 Embest Technology SBC6845 User Manual
ii
ii
ii
ii
Table
Table
Table
Table of
of
of
of Contents
Contents
Contents
Contents
Chapter
Chapter
Chapter
Chapter 1
1
1
1 Product
Product
Product
Product Overview
Overview
Overview
Overview .....................................................................................................
.....................................................................................................
.....................................................................................................
..................................................................................................... 1
1
1
1
1.1 Introduction ....................................................................................................................... 1
1.2 Packing List ...................................................................................................................... 1
1.3 Product Features ............................................................................................................. 1
1.4 Components on SBC6845 .............................................................................................. 3
1.5 Hardware Dimensions ..................................................................................................... 4
1.6 BSP Package in CD-ROM .............................................................................................. 4
Chapter
Chapter
Chapter
Chapter 2
2
2
2 System
System
System
System Boot-up
Boot-up
Boot-up
Boot-up and
and
and
and Testing
Testing
Testing
Testing .................................................................................
.................................................................................
.................................................................................
................................................................................. 6
6
6
6
2.1 System Boot-up ................................................................................................................ 6
2.2 Example Applications ...................................................................................................... 7
2.3 Introduction to API ........................................................................................................... 9
2.4 Starting Testing .............................................................................................................. 12
2.4.1 Touch-Screen Testing ........................................................................................ 12
2.4.2 LCD Color Testing .............................................................................................. 12
2.4.3 LCD Backlight Testing ........................................................................................ 13
2.4.4 Ethernet Testing .................................................................................................. 13
2.4.5 Serial Interface Testing ...................................................................................... 14
2.4.6 CAN Bus Testing ................................................................................................ 14
2.4.7 RS485 Bus Testing ............................................................................................. 15
2.4.8 USB Testing ......................................................................................................... 16
2.4.9 RTC Testing ......................................................................................................... 17
2.4.10 SD Card Testing ............................................................................................... 18
2.4.11 LED Testing ....................................................................................................... 19
2.4.12 Buzzer Testing .................................................................................................. 19
2.4.13 GPIO Testing ..................................................................................................... 20
2.4.14 ADC Testing ...................................................................................................... 21
2.4.15 Button Testing ................................................................................................... 22
2.4.16 Keypad Testing ................................................................................................. 23
2.4.17 Screen Capture Testing ................................................................................... 24
2.4.18 Audio Testing ..................................................................................................... 24
2.4.19 Telnet Login Testing ......................................................................................... 24
2.4.20 Mounting NFS Network Filesystem ............................................................... 27

Embest Technology
Copyright © 2012-2013 Embest Technology SBC6845 User Manual
iii
iii
iii
iii
2.4.21 Transferring Files by Using SecureCRT ....................................................... 28
2.4.22 Transferring Files over Network ..................................................................... 29
2.4.23 Linux QT Demonstration ................................................................................. 31
Chapter
Chapter
Chapter
Chapter 3
3
3
3 Development
Development
Development
Development Environment
Environment
Environment
Environment and
and
and
and System
System
System
System Compilation
Compilation
Compilation
Compilation ...................................
...................................
...................................
................................... 32
32
32
32
3.1 Building a Cross Compilation Environment ............................................................... 32
3.2 System Compilation ...................................................................................................... 33
3.2.1 Uncompressing Files ......................................................................................... 33
3.2.2 Making Bootstrap ................................................................................................ 34
3.2.3 Making U-boot ..................................................................................................... 34
3.2.4 Making Kernel ..................................................................................................... 34
3.2.5 Making Filesystem Image ................................................................................. 35
Chapter
Chapter
Chapter
Chapter 4
4
4
4 System
System
System
System Customization
Customization
Customization
Customization ..........................................................................................
..........................................................................................
..........................................................................................
.......................................................................................... 36
36
36
36
4.1 Kernel Customization .................................................................................................... 36
4.2 Filesystem Customization ............................................................................................ 37
4.3 Simple Driver Modules in Kernel ................................................................................. 37
4.3.1 Using Makefile to Associate Drivers with Kernel ........................................... 40
4.3.2 Compiling and Downloading Drivers ............................................................... 40
4.4 Brief Introduction to Applications ................................................................................. 41
4.4.1 Compiling and Running Applications ............................................................... 42
4.4.2 Common Functions ............................................................................................ 42
4.5 Linux Multi-Thread Programming ................................................................................ 43
4.6 Linux Network Programming ........................................................................................ 45
4.6.1 Compiling Server and Client ............................................................................. 48
Chapter
Chapter
Chapter
Chapter 5
5
5
5 Updating
Updating
Updating
Updating Linux
Linux
Linux
Linux System
System
System
System .........................................................................................
.........................................................................................
.........................................................................................
......................................................................................... 49
49
49
49
5.1 Image Mapping and Burning ........................................................................................ 49
5.2 Burning System Image Manually ................................................................................ 50
5.2.1 Preparations ........................................................................................................ 50
5.2.2 Burning Bootstrap File ....................................................................................... 53
5.2.3 Burning U-boot File ............................................................................................ 54
5.2.4 Burning Logo File ............................................................................................... 55
5.2.5 Burning uImage File ........................................................................................... 56
5.2.6 Burning Linux System ........................................................................................ 57
5.3 Burning System Image Automatically ......................................................................... 60

Embest Technology
Copyright © 2012-2013 Embest Technology SBC6845 User Manual
iv
iv
iv
iv
Technical
Technical
Technical
Technical Support
Support
Support
Support and
and
and
and Warranty
Warranty
Warranty
Warranty ............................................................................................
............................................................................................
............................................................................................
............................................................................................ 62
62
62
62

Embest Technology
Copyright © 2012-2013 Embest Technology SBC6845 User Manual
1
1
1
1
Chapter
Chapter
Chapter
Chapter 1
1
1
1 Product
Product
Product
Product Overview
Overview
Overview
Overview
1.1
1.1
1.1
1.1 Introduction
Introduction
Introduction
Introduction
SBC6845 is an ARM embedded single board computer designed by Shenzhen Embest
Technology Co., Ltd. It is a small-sized board based on Atmel
’
s industrial microprocessor
AT91SAM9G45 and featured with 128MB DDR2 SDRAM, 256MB NAND Flash and 4MB
Data Flash, as well as abundant interfaces including 5 RS232 serial interfaces (COM2 is
RS485), a CAN interface, an Ethernet interface, a high-speed USB host interface, a
SD/MMC card interface and an audio output interface.
SBC6845 is designed to satisfy the different requirements of various fields such as
industrial control, intelligent instrumentation, data acquisition and analysis, medical
products and network equipments.
1.2
1.2
1.2
1.2 Packing
Packing
Packing
Packing List
List
List
List
A
SBC6845 board
A
serial cable
A
network cable
A
USB cable
A
12V power adapter
A
LCD touch-screen (optional item, available in 4.3-inch 480*272 or 7-inch
800*480 )
A
CD-ROM
1.3
1.3
1.3
1.3 Product
Product
Product
Product Features
Features
Features
Features
Dimensions: 106.5mm x 94mm (6-layer PCB)
Operation temperature: -40 ~ + 85 ℃

Embest Technology
Copyright © 2012-2013 Embest Technology SBC6845 User Manual
2
2
2
2
Operating Humidity: 0% ~ 90%
Power Supply: 12V/1.25A
Processor: Atmel AT91SAM9G45
On-Board Memories:
64MB*2 DDR2 SDRAM
256MB NAND Flash
4MB Data Flash
Audio/Video Output Interfaces:
A
3.5mm jack
A
2*20-pin DIP interface for LCD touch-screen
A
buzzer
Data Transfer Interfaces:
5 serial interfaces
A
CAN 2.0 interface (isolated)
2 USB 2.0 interfaces
A
10/100Mb Ethernet interface
A
SD card slot (hot plugging)
Pins for SPI , I2C , PWM , ADC , Keypad and GPIO

Embest Technology
Copyright © 2012-2013 Embest Technology SBC6845 User Manual
3
3
3
3
1.4
1.4
1.4
1.4 Components
Components
Components
Components on
on
on
on SBC6845
SBC6845
SBC6845
SBC6845
USB Host
USB Host
USB Host
USB Host
Ethernet
Ethernet
Ethernet
Ethernet
Audio Out
Audio Out
Audio Out
Audio Out
Debug
Debug
Debug
Debug
Power
Power
Power
Power
Touch
Touch
Touch
Touch
Buzzer
Buzzer
Buzzer
Buzzer
LCD
LCD
LCD
LCD
LED
LED
LED
LED
Panel
Panel
Panel
Panel
Keypad
Keypad
Keypad
Keypad
16 GPIO
16 GPIO
16 GPIO
16 GPIO
SPI&IIC&PWM&ADC
SPI&IIC&PWM&ADC
SPI&IIC&PWM&ADC
SPI&IIC&PWM&ADC
DEBUG&COM0&COM1&COM2(RS485)&COM
DEBUG&COM0&COM1&COM2(RS485)&COM
DEBUG&COM0&COM1&COM2(RS485)&COM
DEBUG&COM0&COM1&COM2(RS485)&COM 3
3
3
3
Reset Key
Reset Key
Reset Key
Reset Key
CAN
CAN
CAN
CAN
RS485
RS485
RS485
RS485
User Key
User Key
User Key
User Key
Power
Power
Power
Power
AT91SAM9G45
AT91SAM9G45
AT91SAM9G45
AT91SAM9G45
DDR
DDR
DDR
DDR 2
2
2
2
DDR
DDR
DDR
DDR 2
2
2
2
NandFlash
NandFlash
NandFlash
NandFlash
Figure
Figure
Figure
Figure 1-1
1-1
1-1
1-1 Components on SBC6845

Embest Technology
Copyright © 2012-2013 Embest Technology SBC6845 User Manual
4
4
4
4
1.5
1.5
1.5
1.5 Hardware
Hardware
Hardware
Hardware Dimensions
Dimensions
Dimensions
Dimensions
Figure
Figure
Figure
Figure 1-2
1-2
1-2
1-2 Hardware Dimensions
1.6
1.6
1.6
1.6 BSP
BSP
BSP
BSP Package
Package
Package
Package in
in
in
in CD-ROM
CD-ROM
CD-ROM
CD-ROM
The CD-ROM provided along with SBC6845 contains a BSP package that helps
development the Linux system. U sers can make a custom system running on SBC6845
platform by utilizing the package. The table shown below lists out the contents of the
BSP attached with the corresponding descriptions.
Table
Table
Table
Table 1-1
1-1
1-1
1-1 BSP
BSP
BSP
BSP Package
Package
Package
Package
Categories
Categories
Categories
Categories Names
Names
Names
Names Descriptions
Descriptions
Descriptions
Descriptions
BIOS
BIOS
BIOS
BIOS
Bootstrap
DATA
FLASH
u-boot
DATA
FLASH

Embest Technology
Copyright © 2012-2013 Embest Technology SBC6845 User Manual
5
5
5
5
Categories
Categories
Categories
Categories Names
Names
Names
Names Descriptions
Descriptions
Descriptions
Descriptions
Supports downloading kernel and file system through SAM-BA and
network
Kernel
Kernel
Kernel
Kernel Linux-2.6.30 ROM/CRAM/EXT2/EXT3/FAT/NFS/JFFS2/YAFFS2 file systems
Device
Device
Device
Device
Drivers
Drivers
Drivers
Drivers
Serial Drivers for 4 serial interfaces and a debug interface built in CPU
RTC AT91SAM9G45 extension RTC driver
NET 10/100M Ethernet driver
Flash NAND FLASH and
DATA
FLASH drivers
LCD LCD driver supporting 480x272, 640x480, 800x480 and 800x600
Touch Screen Driver for touch-screen controller built in CPU
USB Host USB Host driver
Watchdog B uilt-in watchdog driver
SD Card SD card driver
CAN 总线 Driver for an extension CAN bus
RS-485 Driver for an extension RS-485 bus
LED Driver for 4 LED indicators
BEEP Buzzer driver
Sound AC97 Codec audio driver
Button Driver for 2 custom keys
Keypad Driver for 6x6 matrix keyboard
GPIO Driver for 16 GPIO
ADC Driver for 10bit ADC
Root
Root
Root
Root
Filesystem
Filesystem
Filesystem
Filesystem
YAFFS2 Readable and writable filesystem
Graphic
Graphic
Graphic
Graphic
Interface
Interface
Interface
Interface
Qt Version 4.4.2

Embest Technology
Copyright © 2012-2013 Embest Technology SBC6845 User Manual
6
6
6
6
Chapter
Chapter
Chapter
Chapter 2
2
2
2 System
System
System
System Boot-up
Boot-up
Boot-up
Boot-up and
and
and
and
Testing
Testing
Testing
Testing
2.1
2.1
2.1
2.1 System
System
System
System Boot-up
Boot-up
Boot-up
Boot-up
SBC6845 can support boot-up from Data Flash only.
A
default Linux system image has
been burned in Data Flash when it is manufactured. I f you need to update the image,
please refer to the contents of Chapter 5 Updating Linux System .
Before you power up the board, you need to set the video output resolution of the board
by applying a specific jumper configuration on SBC6845. The table shown below lists
different configurations of the jumpers.
Table
Table
Table
Table 2-1
2-1
2-1
2-1 Jumper
Jumper
Jumper
Jumper Configurations
Configurations
Configurations
Configurations
JP11
JP11
JP11
JP11 JP10
JP10
JP10
JP10 S
S
S
S izes
izes
izes
izes of
of
of
of LCD
LCD
LCD
LCD Resolutions
Resolutions
Resolutions
Resolutions of
of
of
of LCD
LCD
LCD
LCD
0 0 4.3 inches 480x272
0 1 5.6 inches 640x480
1 0 7.0 inches 800x480
1 1 10.4 inches 800x600
Additionally, you need to set up a HyperTerminal on your PC according to the serial
interface configuration window shown below.

Embest Technology
Copyright © 2012-2013 Embest Technology SBC6845 User Manual
7
7
7
7
Figure
Figure
Figure
Figure 2-2
2-2
2-2
2-2 Setting up HyperTerminal
Now you can connect the power supply to SBC6845 and see the boot-up information
displayed in HyperTerminal.
2.2
2.2
2.2
2.2 Example
Example
Example
Example Applications
Applications
Applications
Applications
T here are lots of example applications can be found under /home/app of the default
Linux system on SBC6845. Users can test or demonstrate the functions of board by
taking advantage of these programs. The diagram shown below can help you find them
more easily.

Embest Technology
Copyright © 2012-2013 Embest Technology SBC6845 User Manual
8
8
8
8
can_test_1000k
can_test_1000k
can_test_1000k
can_test_1000k
/home/app
/home/app
/home/app
/home/app
adc
adc
adc
adc
beep
beep
beep
beep
can
can
can
can
can_test_100k
can_test_100k
can_test_100k
can_test_100k
can_test_10k
can_test_10k
can_test_10k
can_test_10k
can_test_125k
can_test_125k
can_test_125k
can_test_125k
can_test_20k
can_test_20k
can_test_20k
can_test_20k
can_test_250k
can_test_250k
can_test_250k
can_test_250k
can_test_500k
can_test_500k
can_test_500k
can_test_500k
can_test_50k
can_test_50k
can_test_50k
can_test_50k
can_test_750k
can_test_750k
can_test_750k
can_test_750k
can_test_800k
can_test_800k
can_test_800k
can_test_800k
com
com
com
com
evtest
evtest
evtest
evtest
gpio
gpio
gpio
gpio
lcd
lcd
lcd
lcd
led
led
led
led
ADC testing
Buzzer testing
CAN testing over different frequencies
Serial interface and RS485 testing
Testing for buttons, keypad, touch-screen, etc.
GPIO testing
LCD testing
LED testing

Embest Technology
Copyright © 2012-2013 Embest Technology SBC6845 User Manual
9
9
9
9
2.3
2.3
2.3
2.3 Introduction
Introduction
Introduction
Introduction to
to
to
to API
API
API
API
Before you get started with testing, it
’
s necessary to learn something about the API
functions used by example applications. If you ’ d like to look into the details of how the
programs are working, please view the source code under \ Linux 2.6 Kit\01
SourceCode\application\ in the SBC6845
’
s CD-ROM.
The tables listed below are the API functions called by some of the example applications
we provided in the CD-ROM, as well as the descriptions attached to each function.
Table
Table
Table
Table 2-2
2-2
2-2
2-2 LED
LED
LED
LED API
API
API
API Function
Function
Function
Function
API
API
API
API Function
Function
Function
Function for
for
for
for LED
LED
LED
LED
LED_API
LED_API
LED_API
LED_API int
int
int
int led_ctrl
led_ctrl
led_ctrl
led_ctrl (char
(char
(char
(char *name,
*name,
*name,
*name, int
int
int
int onoff);
onoff);
onoff);
onoff);
Source
Source
Source
Source ledlib.h
Function
Function
Function
Function Turn on/off LED indicators
Parameters
Parameters
Parameters
Parameters
name (LED name, e.g. D6, D9 or D13)
on/off (0 for off, 1 for on)
Returned
Returned
Returned
Returned Value
Value
Value
Value 0 for success , otherwise failure
Example
Example
Example
Example led_ctrl ("D9", 1);
Table
Table
Table
Table 2-3
2-3
2-3
2-3 Buzzer
Buzzer
Buzzer
Buzzer API
API
API
API Function
Function
Function
Function
API
API
API
API Function
Function
Function
Function for
for
for
for Buzzer
Buzzer
Buzzer
Buzzer
BEEP_API
BEEP_API
BEEP_API
BEEP_API int
int
int
int beep_ctrl
beep_ctrl
beep_ctrl
beep_ctrl (char
(char
(char
(char *name,
*name,
*name,
*name, int
int
int
int onoff);
onoff);
onoff);
onoff);
Source
Source
Source
Source beeplib.h
Function
Function
Function
Function control buzzer to make sound or keep silent
Parameters
Parameters
Parameters
Parameters
name (buzzer name, normally there is only one buzzer which is called “ beep ” )
on /off (0 for off, 1 for on)
Returned
Returned
Returned
Returned Value
Value
Value
Value 0 for success , otherwise failure
Example
Example
Example
Example beep_ctrl ("beep", 1); beep_ctrl ("beep", 0);
Table
Table
Table
Table 2-4
2-4
2-4
2-4 Serial
Serial
Serial
Serial Interface
Interface
Interface
Interface API
API
API
API Function
Function
Function
Function

Embest Technology
Copyright © 2012-2013 Embest Technology SBC6845 User Manual
10
10
10
10
API
API
API
API Function
Function
Function
Function for
for
for
for Serial
Serial
Serial
Serial Interface
Interface
Interface
Interface
int
int
int
int OpenDev(char
OpenDev(char
OpenDev(char
OpenDev(char *Dev)
*Dev)
*Dev)
*Dev) ;
;
;
;
Source
Source
Source
Source com_example.c
Function
Function
Function
Function Enable serial devices and acquire descriptors
Parameter
Parameter
Parameter
Parameter dev ( character string of serial devices, e.g. “ /dev/ttySAC0 ” )
Returned
Returned
Returned
Returned Value
Value
Value
Value Value more than 0 is a serial file descriptor, less than 0 stands for failure
void
void
void
void set_speed(int
set_speed(int
set_speed(int
set_speed(int fd,
fd,
fd,
fd, int
int
int
int speed)
speed)
speed)
speed) ;
;
;
;
Source
Source
Source
Source com_example.c
Function
Function
Function
Function Configure bitrate of serial interfaces
Parameter
Parameter
Parameter
Parameter
fd (serial file descriptor)
speed (bitrate, e.g. 15200)
Returned
Returned
Returned
Returned Value
Value
Value
Value None
int
int
int
int set_Parity
set_Parity
set_Parity
set_Parity (int
(int
(int
(int fd,int
fd,int
fd,int
fd,int databits,int
databits,int
databits,int
databits,int stopbits,int
stopbits,int
stopbits,int
stopbits,int parity,int
parity,int
parity,int
parity,int flowctrl)
flowctrl)
flowctrl)
flowctrl) ;
;
;
;
Source
Source
Source
Source com_example.c
Function
Function
Function
Function Configure serial interface data bits, stop bits, parity check and data flow control
Parameters
Parameters
Parameters
Parameters
fd (serial file descriptor)
databits (length of data bits)
stopbits (length of stop bits)
parity (check type, N for no check, O for odd check, E for even check)
flowctrl (switch of hardware data follow control, 1 for enable, 0 for disable)
Returned
Returned
Returned
Returned Value
Value
Value
Value 0 for success , otherwise failure
size_t
size_t
size_t
size_t read(int
read(int
read(int
read(int fd,
fd,
fd,
fd, const
const
const
const void
void
void
void *buf,
*buf,
*buf,
*buf, size_t
size_t
size_t
size_t nbytes)
nbytes)
nbytes)
nbytes) ;
;
;
;
Source
Source
Source
Source unistd.h
Function
Function
Function
Function C alled by system to acquire data received on serial interface
Parameters
Parameters
Parameters
Parameters
fd (serial file descriptor)
B uf (pointer to the received data)
nbytes (data length about to be read, Byte)
Returned
Returned
Returned
Returned Value
Value
Value
Value Value less than 0 stands for error, more than 0 stands for received data length (Byte)
size_t
size_t
size_t
size_t write(int
write(int
write(int
write(int fd,
fd,
fd,
fd, const
const
const
const void
void
void
void *buf,
*buf,
*buf,
*buf, size_t
size_t
size_t
size_t nbytes)
nbytes)
nbytes)
nbytes) ;
;
;
;
Source
Source
Source
Source unistd.h
Function
Function
Function
Function Called by system to send data through serial interfaces
Parameters
Parameters
Parameters
Parameters
fd (serial file descriptor)
buf (pointer to the data about to be sent)
n bytes (length of data about to be sent, Byte)

Embest Technology
Copyright © 2012-2013 Embest Technology SBC6845 User Manual
11
11
11
11
API
API
API
API Function
Function
Function
Function for
for
for
for Serial
Serial
Serial
Serial Interface
Interface
Interface
Interface
int
int
int
int OpenDev(char
OpenDev(char
OpenDev(char
OpenDev(char *Dev)
*Dev)
*Dev)
*Dev) ;
;
;
;
Returned
Returned
Returned
Returned Value
Value
Value
Value Value less than 0 stands for error, more than 0 stands for data length being sent (Byte)
int
int
int
int close(int
close(int
close(int
close(int fd)
fd)
fd)
fd) ;
;
;
;
Source
Source
Source
Source unistd.h
Function
Function
Function
Function Called by system to disable serial interface
Parameters
Parameters
Parameters
Parameters fd (serial file descriptor)
Returned
Returned
Returned
Returned Value
Value
Value
Value 0 for success, less than 0 stands for error
Table
Table
Table
Table 2-5
2-5
2-5
2-5 GPIO
GPIO
GPIO
GPIO API
API
API
API Function
Function
Function
Function
API
API
API
API Function
Function
Function
Function for
for
for
for GPIO
GPIO
GPIO
GPIO
GPIO_API
GPIO_API
GPIO_API
GPIO_API int
int
int
int init_gpio
init_gpio
init_gpio
init_gpio (void);
(void);
(void);
(void);
Source
Source
Source
Source gpiolib.h
Function
Function
Function
Function Initializing GPIO
Parameters
Parameters
Parameters
Parameters None
Returned
Returned
Returned
Returned Value
Value
Value
Value 0 for success, otherwise failure
GPIO_API
GPIO_API
GPIO_API
GPIO_API int
int
int
int remove_gpio
remove_gpio
remove_gpio
remove_gpio (void);
(void);
(void);
(void);
Source
Source
Source
Source gpiolib.h
Function
Function
Function
Function Release gpio
Parameters
Parameters
Parameters
Parameters None
Returned
Returned
Returned
Returned Value
Value
Value
Value 0 for success, otherwise failure
GPIO_API
GPIO_API
GPIO_API
GPIO_API int
int
int
int set_gpio_output
set_gpio_output
set_gpio_output
set_gpio_output (char
(char
(char
(char *pin,
*pin,
*pin,
*pin, int
int
int
int value);
value);
value);
value);
Source
Source
Source
Source gpiolib.h
Function
Function
Function
Function Provide a logic level output on GPIO interfaces
Parameters
Parameters
Parameters
Parameters
p in (GPIO pin name, e.g. “ pb29 ”
v alue (0 for low level, 1 for high level)
Returned
Returned
Returned
Returned Value
Value
Value
Value 0 for success, otherwise failure
GPIO_API
GPIO_API
GPIO_API
GPIO_API int
int
int
int get_gpio_input
get_gpio_input
get_gpio_input
get_gpio_input (char
(char
(char
(char *pin);
*pin);
*pin);
*pin);
Source
Source
Source
Source unistd.h
Function
Function
Function
Function Acquire the logic level input on GPIO interfaces
Parameters
Parameters
Parameters
Parameters p in (GPIO pin name, e.g. “ pb29 ”
Returned
Returned
Returned
Returned Value
Value
Value
Value 0 or 1 for input level, other values for input failure

Embest Technology
Copyright © 2012-2013 Embest Technology SBC6845 User Manual
12
12
12
12
Table
Table
Table
Table 2-6
2-6
2-6
2-6 PWM
PWM
PWM
PWM API
API
API
API Function
Function
Function
Function
API
API
API
API Function
Function
Function
Function for
for
for
for PWM
PWM
PWM
PWM
PWM_API
PWM_API
PWM_API
PWM_API int
int
int
int pwm_ctrl
pwm_ctrl
pwm_ctrl
pwm_ctrl (char
(char
(char
(char *name,
*name,
*name,
*name, int
int
int
int ratio);
ratio);
ratio);
ratio);
Source
Source
Source
Source pwmlib.h
Function
Function
Function
Function Control the duty cycle of PWM output
Parameters
Parameters
Parameters
Parameters
name (pin name, e.g. “ PD26 ” )
r atio (integer between 0 ~255, duty cycle =ratio / 256)
Returned
Returned
Returned
Returned Value
Value
Value
Value 0 for success, otherwise error
2.4
2.4
2.4
2.4 Starting
Starting
Starting
Starting Testing
Testing
Testing
Testing
This section will show you how to use the example applications installed by default in the
system to accomplish the testing of SBC6845
’
s functions. After you finish the
configurations mentioned in 2.1
2.1
2.1
2.1 System
System
System
System Boot-up
Boot-up
Boot-up
Boot-up , you can run the applications as
shown in the following contents.
2.4.2
2.4.2
2.4.2
2.4.2 Touch-Screen
Touch-Screen
Touch-Screen
Touch-Screen Testing
Testing
Testing
Testing
1
1
1
1)Execute the following instruction to run touch-screen calibration program;
[root@SBC6845:/]#
[root@SBC6845:/]#
[root@SBC6845:/]#
[root@SBC6845:/]# ts_calibrate
ts_calibrate
ts_calibrate
ts_calibrate
Press the symbol “ + ” shown on touch-screen for 5 times to accomplish
screen calibration.
2
2
2
2)Execute the following instruction to test touch-screen;
[root@SBC6845:/]#
[root@SBC6845:/]#
[root@SBC6845:/]#
[root@SBC6845:/]# ts_test
ts_test
ts_test
ts_test
Select Drag
Drag
Drag
Drag or Draw
Draw
Draw
Draw to test dragging and drawing functions.
Press Ctrl+C
Ctrl+C
Ctrl+C
Ctrl+C on your PC
’
s keyboard to exit the example application.
2.4.3
2.4.3
2.4.3
2.4.3 LCD
LCD
LCD
LCD Color
Color
Color
Color Testing
Testing
Testing
Testing
By executing the following instruction, LCD will display each of three-primary color
respectively and then show them all together on the screen.

Embest Technology
Copyright © 2012-2013 Embest Technology SBC6845 User Manual
13
13
13
13
[root@SBC6845:/]#
[root@SBC6845:/]#
[root@SBC6845:/]#
[root@SBC6845:/]# /home/app/lcd
/home/app/lcd
/home/app/lcd
/home/app/lcd
2.4.4
2.4.4
2.4.4
2.4.4 LCD
LCD
LCD
LCD Backlight
Backlight
Backlight
Backlight Testing
Testing
Testing
Testing
1
1
1
1)Execute the following instruction to adjust backlight brightness; the
brightness value should be an integer between 1~10;
[root@SBC6845:/]#
[root@SBC6845:/]#
[root@SBC6845:/]#
[root@SBC6845:/]# bl_adjust
bl_adjust
bl_adjust
bl_adjust SET
SET
SET
SET 5
5
5
5
2
2
2
2)Execute the following instruction to turn off backlight;
[root@SBC6845:/]#
[root@SBC6845:/]#
[root@SBC6845:/]#
[root@SBC6845:/]# bl_adjust
bl_adjust
bl_adjust
bl_adjust OFF
OFF
OFF
OFF
3
3
3
3)Execute the following instruction to turn on backlight;
[root@SBC6845:/]#
[root@SBC6845:/]#
[root@SBC6845:/]#
[root@SBC6845:/]# bl_adjust
bl_adjust
bl_adjust
bl_adjust ON
ON
ON
ON
2.4.5
2.4.5
2.4.5
2.4.5 Ethernet
Ethernet
Ethernet
Ethernet Testing
Testing
Testing
Testing
1
1
1
1)Execute the following instruction to set an IP address for SBC6845;
[root@SBC6845:/]#
[root@SBC6845:/]#
[root@SBC6845:/]#
[root@SBC6845:/]# ifconfig
ifconfig
ifconfig
ifconfig eth0
eth0
eth0
eth0 192.192.192.200
192.192.192.200
192.192.192.200
192.192.192.200
2
2
2
2)Execute the following instruction to test network communication;
[root@SBC6845:/]#
[root@SBC6845:/]#
[root@SBC6845:/]#
[root@SBC6845:/]# ping
ping
ping
ping 192.192.192.105
192.192.192.105
192.192.192.105
192.192.192.105
Note:
Note:
Note:
Note:
The IP in the above instructions are just examples. Please set IP address according to
your network configurations and ensure that SBC6845 and your PC are set in the same
network segment.
The table shown below is the testing information in HyperTerminal window.
Table
Table
Table
Table 2-7
2-7
2-7
2-7 Ethernet
Ethernet
Ethernet
Ethernet Testing
Testing
Testing
Testing
PING 192.192.192.105 (192.192.192.105): 56 data bytes
64 bytes from 192.192.192.105: icmp_seq=0 ttl=64 time=0.5 ms
64 bytes from 192.192.192.105: icmp_seq=1 ttl=64 time=0.3 ms
64 bytes from 192.192.192.105: icmp_seq=2 ttl=64 time=0.3 ms
64 bytes from 192.192.192.105: icmp_seq=3 ttl=64 time=0.3 ms
64 bytes from 192.192.192.105: icmp_seq=4 ttl=64 time=0.3 ms
64 bytes from 192.192.192.105: icmp_seq=5 ttl=64 time=0.3 ms
64 bytes from 192.192.192.105: icmp_seq=6 ttl=64 time=0.3 ms

Embest Technology
Copyright © 2012-2013 Embest Technology SBC6845 User Manual
14
14
14
14
--- 192.192.192.105 ping statistics ---
7 packets transmitted, 7 packets received, 0% packet loss
round-trip min/avg/max = 0.3/0.3/0.5 ms
~ $
Press Ctrl+C
Ctrl+C
Ctrl+C
Ctrl+C on your PC
’
s keyboard to exit Ethernet testing.
2.4.6
2.4.6
2.4.6
2.4.6 Serial
Serial
Serial
Serial Interface
Interface
Interface
Interface Testing
Testing
Testing
Testing
SBC6845 has 5 serial interfaces - ttySAC0, ttySAC1, ttySAC2, ttySAC3 and ttySAC6.
ttySAC2 is defined as RS-485 and ttySAC6 is used for debugging. Please execute the
following instruction to test serial interfaces.
[root@SBC6845:/home/app]#
[root@SBC6845:/home/app]#
[root@SBC6845:/home/app]#
[root@SBC6845:/home/app]# ./com
./com
./com
./com -d
-d
-d
-d /dev/ttySAC1
/dev/ttySAC1
/dev/ttySAC1
/dev/ttySAC1 -s
-s
-s
-s 1234567890
1234567890
1234567890
1234567890 -b
-b
-b
-b 115200
115200
115200
115200 –
–
–
– f
f
f
f
Table
Table
Table
Table 2-8
2-8
2-8
2-8 Command
Command
Command
Command Parameters
Parameters
Parameters
Parameters
Parameters
Parameters
Parameters
Parameters Descriptions
Descriptions
Descriptions
Descriptions
-d Serial device node used to specify serial interfaces
-s Character string to be sent
-b Bitrate
-f Enable hardware data flow control
Note:
Note:
Note:
Note:
ttySAC1 requires hardware data flow control.
The internal pull-up resistor of serial interface is enabled by default by the driver in order
to ensure the quality and reliability of communication.
Please be aware of the SPACEs in the instruction; Missing of any space would cause
failure in executing instructions.
2.4.7
2.4.7
2.4.7
2.4.7 CAN
CAN
CAN
CAN Bus
Bus
Bus
Bus Testing
Testing
Testing
Testing
SBC6845 integrates only one CAN bus, and therefore it needs to work with another
SBC6845 or a CAN-enabled device to test the data transfer over CAN bus. The figure
shown below illustrates the connections between SBC6845 and a CAN-enabled device.
Please
Please
Please
Please be
be
be
be aware
aware
aware
aware that
that
that
that jumper
jumper
jumper
jumper JP13
JP13
JP13
JP13 is
is
is
is shorted.
shorted.
shorted.
shorted.

Embest Technology
Copyright © 2012-2013 Embest Technology SBC6845 User Manual
15
15
15
15
Figure
Figure
Figure
Figure 2-3
2-3
2-3
2-3 CAN Bus Connections
Please execute the following instructions;
[root@SBC6845:/]#
[root@SBC6845:/]#
[root@SBC6845:/]#
[root@SBC6845:/]# cd
cd
cd
cd /home/app/can/
/home/app/can/
/home/app/can/
/home/app/can/
[root@SBC6845:/home/app/can]#
[root@SBC6845:/home/app/can]#
[root@SBC6845:/home/app/can]#
[root@SBC6845:/home/app/can]# ./can_test_125k
./can_test_125k
./can_test_125k
./can_test_125k /dev/can0
/dev/can0
/dev/can0
/dev/can0
The HypterTerminal will display the testing information as shown in the following table.
Table
Table
Table
Table 2-9
2-9
2-9
2-9 CAN
CAN
CAN
CAN Testing
Testing
Testing
Testing Information
Information
Information
Information
/dev/can0 Work Rate: 125000bps
/dev/can0 work on normal mode.
Press "\q" to quit!
Input the message and press Enter to send!
The frame id=1...2031, and eid=id*2+1
CanTest> TestData
CanTest>
Header: id=1 srr=0 ide=0 eid=0 rtr=0 rb1=0 rb0=0 dlc=8
RECV: "TestData"
Press Ctrl+C
Ctrl+C
Ctrl+C
Ctrl+C on your PC
’
s keyboard to exit testing.
2.4.8
2.4.8
2.4.8
2.4.8 RS485
RS485
RS485
RS485 Bus
Bus
Bus
Bus Testing
Testing
Testing
Testing
RS485 interface is associated to the device /dev/ttySAC2. Similar to CAN bus testing,
two RS485-enabled devices are required to accomplish the testing as shown below.
Other manuals for SBC6845
1
Table of contents
Other Embest Single Board Computer manuals
Popular Single Board Computer manuals by other brands

Variscite
Variscite VAR-OM35CustomBoard v2.3 DIAGRAMS

Motorola
Motorola MVME177 Installation and use manual

VIA Technologies
VIA Technologies VAB-800 user manual

SBS Technologies
SBS Technologies V5C Technical manual

SMART Embedded Computing
SMART Embedded Computing MVME3100 quick start guide

Lanner electronics
Lanner electronics PC/104 Single Board Computer with STPC Atlas CPU, and VGA, LCD, LAN, SSD, on-board RAM, 4xCOM,... user manual