FriendlyARM Mini6410
FriendlyARM Mini6410
FriendlyARM Mini6410
Support
OSELAS.Training
OSELAS.Development
OSELAS.Services
Quickstart Manual
OSELAS.BSP( )
FriendlyARM mini6410
Pengutronix e. K.
Peiner Strae 68
31137 Hildesheim
+49 (0)51 21 / 20 69 17 0 (Fon)
+49 (0)51 21 / 20 69 17 55 55 (Fax)
info@pengutronix.de
2011 Pengutronix, Hildesheim Rev. 1611/495
Contents
I
1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
8
8
8
8
9
10
11
11
12
13
13
14
14
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
16
16
17
17
17
17
18
Special Notes
5.1 Available Kernel Releases . . . . . . . . . . . . . . .
5.2 Available Userland Configuration . . . . . . . . . . .
5.2.1 Some details about the configs/ptxconfig.qt
5.3 Framebuffer . . . . . . . . . . . . . . . . . . . . .
5.4 GPIO . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.1 GPIO Usage Example . . . . . . . . . . . . .
5.5 IC Master . . . . . . . . . . . . . . . . . . . . . .
5.5.1 IC Device AT24c04 . . . . . . . . . . . . . .
5.6 LEDs . . . . . . . . . . . . . . . . . . . . . . . . .
5.7 MMC/SD Card . . . . . . . . . . . . . . . . . . . .
5.8 SDIO Card . . . . . . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
23
23
23
23
24
24
24
25
25
25
26
27
Contents
5.9 Network . . . . . . . . . . . . . . . . . . . . . . .
5.10 Touchscreen . . . . . . . . . . . . . . . . . . . . .
5.10.1 If the Touchscreen does not work . . . . . . .
5.10.2 If the Touchscreen does not work as expected
5.11 LCD Backlight . . . . . . . . . . . . . . . . . . . . .
5.12 ADC . . . . . . . . . . . . . . . . . . . . . . . . .
5.13 Keypad . . . . . . . . . . . . . . . . . . . . . . . .
5.14 Get the latest BSP Release for the Mini6410 . . . . .
5.15 Be Part of the Mini6410 BSP Development . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
6 Document Revisions
7
Getting help
7.1 Mailing Lists . . . . . . . . . . . . . . . .
7.1.1
About PTXdist in Particular . . . . .
7.1.2 About Embedded Linux in General .
7.2 About Working on the Linux Kernel . . . .
7.3 Chat/IRC . . . . . . . . . . . . . . . . . .
7.4 FriendlyARM mini6410 specific Mailing List .
7.5 Commercial Support . . . . . . . . . . . .
27
27
27
28
29
29
29
30
30
31
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
32
32
32
32
32
32
33
33
Part I
To run different functions, this command must be extended by parameters to define the function we want to run.
If we are unsure what parameter must be given to obtain a special function, we run it with the parameter help.
$ ptxdist help
This will output all possible parameters and subcommands and their meaning.
As the list we see is very long, lets explain the major parameters usually needed for daily usage:
menu This starts a dialog based frontend for those who do not like typing commands. It will gain us access to the
most common parameters to configure and build a PTXdist project. Note: it needs dialog to be installed
to make is work. It will fail if this tool is not installed on your host. menuconfig can be used instead in this
case.
menuconfig Starts the Kconfig based project configurator for the current selected userland configuration. This
menu will give us access to various userland components the root filesystem of our target should consist
of.
platformconfig Starts the Kconfig based platform configurator. This menu lets us set up all target specific settings. Major parts are:
All these commands depending on various files a PTXdist based project provides. So, running the commands
make only sense in directories that contain a PTXdist based project. Otherwise, PTXdist gets confused and then
it tries to confuse the user with funny error messages.
The PTXdist packet has to be extracted into some temporary directory in order to be built before the installation,
for example the local/ directory in the users home. If this directory does not exist, we have to create it and
change into it:
$ cd
$ mkdir local
$ cd local
If everything goes well, we now have a PTXdist-2011.10.1 directory, so we can change into it:
$ cd ptxdist-2011.10.1
$ ls -lF
total 508
-rw-r--r-- 1 jb user
-rw-r--r-- 1 jb user
-rw-r--r-- 1 jb user
-rw-r--r-- 1 jb user
-rw-r--r-- 1 jb user
-rw-r--r-- 1 jb user
-rw-r--r-- 1 jb user
-rwxr-xr-x 1 jb user
drwxr-xr-x 2 jb user
drwxr-xr-x 10 jb user
-rwxr-xr-x 1 jb user
-rw-r--r-- 1 jb user
drwxr-xr-x 10 jb user
drwxr-xr-x 221 jb user
drwxr-xr-x 2 jb user
drwxr-xr-x 4 jb user
drwxr-xr-x 6 jb user
drwxr-xr-x 8 jb user
drwxr-xr-x 2 jb user
18361
3914
115540
57
2531
4252
63516
28
72
296
212213
12515
248
7440
1240
112
52248
912
512
Sep
Sep
Sep
Sep
Sep
Sep
Sep
Sep
Sep
Sep
Sep
Sep
Sep
Sep
Sep
Sep
Sep
Sep
Sep
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
12:40
12:40
12:40
12:40
12:40
12:40
12:40
12:40
12:40
12:40
17:10
12:40
12:40
12:40
12:40
12:40
12:40
12:40
12:40
COPYING
CREDITS
ChangeLog
INSTALL
Makefile.in
README
TODO
autogen.sh
bin
config
configure
configure.ac
generic
patches
platforms
plugins
rules
scripts
tests
2.2.3 Prerequisites
Before PTXdist can be installed it has to be checked if all necessary programs are installed on the development
host. The configure script will stop if it discovers that something is missing.
The PTXdist installation is based on GNU autotools, so the first thing to be done now is to configure the packet:
$ ./configure
This will check your system for required components PTXdist relies on. If all required components are found the
output ends with:
[...]
checking whether /usr/bin/patch will work... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating scripts/ptxdist_version.sh
config.status: creating rules/ptxdist-version.in
ptxdist version 2011.10.1 configured.
Using /usr/local for installation prefix.
Report bugs to ptxdist@pengutronix.de
Without further arguments PTXdist is configured to be installed into /usr/local, which is the standard location
for user installed programs. To change the installation path to anything non-standard, we use the --prefix argument to the configure script. The --help option offers more information about what else can be changed for
the installation process.
The installation paths are configured in a way that several PTXdist versions can be installed in parallel. So if an
old version of PTXdist is already installed there is no need to remove it.
One of the most important tasks for the configure script is to find out if all the programs PTXdist depends on are
already present on the development host. The script will stop with an error message in case something is missing.
If this happens, the missing tools have to be installed from the distribution befor re-running the configure script.
When the configure script is finished successfully, we can now run
$ make
All program parts are being compiled, and if there are no errors we can now install PTXdist into its final location.
In order to write to /usr/local, this step has to be performed as user root:
$ sudo make install
[enter password]
[...]
If we dont have root access to the machine it is also possible to install PTXdist into some other directory with
the --prefix option. We need to take care that the bin/ directory below the new installation dir is added to our
$PATH environment variable (for example by exporting it in /.bashrc).
The installation is now done, so the temporary folder may now be removed:
$ cd ../../
$ rm -fr local
10
Due to PTXdist is working with sources only, it needs various source archives from the world wide web. If these
archives are not present on our host, PTXdist starts the wget command to download them on demand.
Proxy Setup
To do so, an internet access is required. If this access is managed by a proxy wget command must be adviced to
use it. PTXdist can be configured to advice the wget command automatically: Navigate to entry Proxies and enter
the required addresses and ports to access the proxy in the form:
<protocol>://<address>:<port>
Source Archive Location
Whenever PTXdist downloads source archives it stores these archives in a project local manner. This is the default
behaviour. If we are working with more than one PTXdist based project, every project would download its own
required archives in this case. To share all source archives between all projects, PTXdist can be configured to
share only one archive directory for all projects it handles: Navigate to menu entry Source Directory and enter the
path to the directory where PTXdist should store archives to share between its projects.
Generic Project Location
If we already installed the generic projects we should also configure PTXdist to know this location. If we already
did so, we can use the command ptxdist projects to get a list of available projects and ptxdist clone to get a
local working copy of a shared generic project.
Navigate to menu entry Project Searchpath and enter the path to projects that can be used in such a way. Here
we can configure more than one path, each part can be delemited by a colon. For example for PTXdists generic
projects and our own previous projects like this:
/usr/local/lib/ptxdist-2011.10.1/projects:/office/my_projects/ptxdist
Leave the menu and store the configuration. PTXdist is now ready for use.
2.3 Toolchains
Before we can start building our first userland we need a cross toolchain. On Linux, toolchains are no monolithic
beasts. Most parts of what we need to cross compile code for the embedded target comes from the GNU Compiler
Collection, gcc. The gcc packet includes the compiler frontend, gcc, plus several backend tools (cc1, g++, ld etc.)
11
To build the same binary for the ARM architecture we have to use the cross compiler instead of the native one:
$ arm-softfloat-linux-gnu-gcc test.c -o test
Also part of what we consider to be the toolchain is the runtime library (libc, dynamic linker). All programs
running on the embedded system are linked against the libc, which also offers the interface from user space
functions to the kernel.
The compiler and libc are very tightly coupled components: the second stage compiler, which is used to build
normal user space code, is being built against the libc itself. For example, if the target does not contain a hardware
floating point unit, but the toolchain generates floating point code, it will fail. This is also the case when the
toolchain builds code for i686 CPUs, whereas the target is i586.
So in order to make things working consistently it is necessary that the runtime libc is identical with the libc the
compiler was built against.
PTXdist doesnt contain a pre-built binary toolchain. Remember that its not a distribution but a development
tool. But it can be used to build a toolchain for our target. Building the toolchain usually has only to be done
once. It may be a good idea to do that over night, because it may take several hours, depending on the target
architecture and development host power.
12
If this command does not output anything, this toolchain was not built with the --with-sysroot option and
cannot be used with PTXdist.
13
arm-1136jfs-linux-gnueabi_gcc-4.5.2_glibc-2.13_binutils-2.21_kernel-2.6.36-sanitized
So the steps to build this toolchain are:
In order to build any of the OSELAS.Toolchains, the host must provide the tool fakeroot. Otherwise the message bash: fakeroot: command not found will occur and the build stops.
$ tar xf OSELAS.Toolchain-2011.03.1.tar.bz2
$ cd OSELAS.Toolchain-2011.03.1
$ ptxdist select ptxconfigs/
arm-1136jfs-linux-gnueabi_gcc-4.5.2_glibc-2.13_binutils-2.21_kernel-2.6.36-sanitized.ptxconfig
$ ptxdist go
At this stage we have to go to our boss and tell him that its probably time to go home for the day. Even on
reasonably fast machines the time to build an OSELAS.Toolchain is something like around 30 minutes up to a
few hours.
Measured times on different machines:
Single Pentium 2.5 GHz, 2 GiB RAM: about 2 hours
Turion ML-34, 2 GiB RAM: about 1 hour 30 minutes
Dual Athlon 2.1 GHz, 2 GiB RAM: about 1 hour 20 minutes
Dual Quad-Core-Pentium 1.8 GHz, 8 GiB RAM: about 25 minutes
24 Xeon cores 2.54 GHz, 96 GiB RAM: about 22 minutes
Another possibility is to read the next chapters of this manual, to find out how to start a new project.
When the OSELAS.Toolchain project build is finished, PTXdist is ready for prime time and we can continue with
our first project.
ptxdist clean
rm selected_ptxconfig
ptxdist select ptxconfigs/any_other_toolchain_def.ptxconfig
ptxdist go
All toolchains will be installed side by side architecture dependent into directory
14
/opt/OSELAS.Toolchain-2011.03.1/architecture_part.
Different toolchains for the same architecture will be installed side by side version dependent into directory
/opt/OSELAS.Toolchain-2011.03.1/architecture_part/version_part.
15
PTXdist is project centric, so now after changing into the new directory we have access to all valid components.
total 36
-rw-r--r--rw-r--r--rw-r--r-drwxr-xr-x
drwxr-xr-x
drwxr-xr-x
drwxr-xr-x
drwxr-xr-x
drwxr-xr-x
1
1
1
3
3
3
3
2
2
jbe
jbe
jbe
jbe
jbe
jbe
jbe
jbe
jbe
ptx
ptx
ptx
ptx
ptx
ptx
ptx
ptx
ptx
1393
797
177
4096
4096
4096
4096
4096
4096
Nov
Nov
Nov
Nov
Nov
Nov
Nov
Nov
Nov
1
1
1
1
1
1
1
1
1
14:25
14:25
14:25
14:25
14:25
14:25
14:25
14:25
14:25
Changelog
FAQ
README
configs
documentation
local_src
projectroot
protocol
rules
16
Note: If you have installed the OSELAS.Toolchain() at its default location, PTXdist should already have detected
the proper toolchain while selecting the platform. In this case it will output:
found and using toolchain:
/opt/OSELAS.Toolchain-2011.03/arm-1136jfs-linux-gnueabi/
gcc-4.5.2-glibc-2.13-binutils-2.21-kernel-2.6.36-sanitized/bin
If it fails you can continue to select the toolchain manually as mentioned in the next section. If this autodetection
was successful, you can omit the step of the next section and continue to build the BSP.
PTXdist does now automatically find out from the selected_ptxconfig and selected_platformconfig files which
packages belong to the project and starts compiling their targetinstall stages (that one that actually puts the compiled binaries into the root filesystem). While doing this, PTXdist finds out about all the dependencies between
the packages and builds them in the correct order.
17
PTXdist will then extract the content of priorly created *.ipk packages to a temporary directory and generate an
image out of it. PTXdist supports following image types:
hd.img: contains grub bootloader, kernel and root files in a ext2 partition. Mostly used for x86 target
systems.
root.jffs2: root files inside a jffs2 filesystem.
uRamdisk: a barebox/u-boot loadable Ramdisk
initrd.gz: a traditional initrd RAM disk to be used as initrdramfs by the kernel
root.ext2: root files inside a ext2 filesystem.
root.squashfs: root files inside a squashfs filesystem.
root.tgz: root files inside a plain gzip compressed tar ball.
root.ubi: root files inside a ubi volume.
The to be generated image types and addtional options can be defined with
$ ptxdist platformconfig
creation
options.
Only the content of the *.ipk packages will be used to generate the image. This means that files
which are put manually into the platform-mini6410/root/ will not be enclosed in the image. If
custom files are needed for the target, install them with PTXdist.
18
19
All changes on the SD card must be done as user root. Best way is to use the sudo command to
only do the special commands with root permissions. PTXdist itself rejects to work as root!
My host has no SD card socket, so Im using a USB based card reader. Thats why the devices nodes of the card
in the following examples are using SCSI names. Later on on the target the device node name will differ.
In my system the device node for the SD card in the card reader is /dev/sdd, while my system disk
is /dev/sda. If you are using autocompletion for file names, take care to not, not!, not!!!11F1!!
clobber your system disk! As the shown commands are running as user root no warnings will
occur!
Assumed here is, the SD card is already inserted into the USB card reader and occurs as /dev/sdd. Replace the
/dev/sdd with the name in your setup.
To write the binary blob run:
$ sudo platform-mini6410/sysroot-host/bin/mini6410-flasher /dev/sdd -b platform-mini6410/images/u-boot.
bin -k platform-mini6410/images/linuximage
Writing bootloader part BL1 and BL2... Done
Writing kernelimage... Done
Summary:
-----------------------------------------------------------------------------block dev:
/dev/sdd
full sector count:
990976
sector size:
512 bytes
card type:
SD
BL1 platform-mini6410/images/u-boot.bin 16 sectors beginning at sector 990958
BL2 platform-mini6410/images/u-boot.bin 512 sectors beginning at sector 990190
Kernel platform-mini6410/images/linuximage 11520 sectors beginning at sector 978670
Take care: Last partition must end in sector 978669!
Ready
Note: Samsung calls their ROM based bootloader in the S3C6410 CPU BL0. This BL0 code loads a BL1. As the
BL1 can only be up to 8 kiB in size, the BL1 codes finally loads the BL2. And the BL2 is the full blown bootloader
without any restriction in size.
The mini6410-flasher write the binary blob in the specific layout to the disk. And it presents one important
number: The sector number the last partition must end on the SD card. In the example shown here this sector
number is 978669. Its the result of using a 512 MiB SD card. We must ensure to note this number for our SD card,
as it differs from card to card. We need it in the next step.
The next step is to partion the SD card and to ensure the partitions/filesystems do not conflict with the binary
blob area.
In this example only one partition is created. Its sufficient to boot the Mini6410 from the SD card. If you want to
create more partitions keep always in mind, the last partition must end at the sector the mini6410-flasher tool
gives you!
We run now the tool to partion the SD card and it will greet us:
$ sudo /sbin/fdisk /dev/sdd
Command (m for help):
20
Using sectors as the unit simplifies partition generation. Now we create the first and only partition on this SD
card.
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First sector (61-990975, default 61):
Using default value 61
We can use the default here. But the next number is important:
Last sector, +sectors or +size{K,M,G} (61-990975, default 990975):
Here we must enter the number the tool mini6410-flasher has given us (adapt it to the number of your SD card):
Last sector, +sectors or +size{K,M,G} (61-990975, default 990975): 978669
Command (m for help): p
Disk /dev/sdd: 507 MB, 507379712 bytes
16 heads, 61 sectors/track, 1015 cylinders, total 990976 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
Disk identifier: 0xf3dfa864
Device Boot
Start
End
Blocks Id System
/dev/sdd1
61
978669
489304+ 83 Linux
Partition 1 does not end on cylinder boundary.
Command (m for help):
We can ignore the warning, since everyone is using sector numbers to read or write from or to a disk like media,
no-one is interested in cylinders anymore (beside the fact, an SD card has no cylinders, nor heads).
Last step is to write this new partition table to the SD card:
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
On my system I have now /dev/sdd and /dev/sdd1. The layout on this SD card is now from the beginning up to
sector 978669 used by a filesystem and from sector 978670 to the end used by the binary blob. Both can now
co-exist. Using the mini6410-flasher again on this SD card (to update the kernel for example) will not destroy
the filesystem. And any operation on the filesystem will not destroy the kernel nor the bootloader.
Lets bring in some life into the filesystem area. But first the filesystem itself:
21
22
5 Special Notes
5.1 Available Kernel Releases
The predifined Mini6410 platform configuration always uses the latest Linux kernel release. If users want to stay
with an older Linux kernel release, they are also available. Here is a list of currently available Linux kernel releases
in the OSELAS.BSP-Pengutronix-Mini6410-2011.11.0:
3.1, (experimental)
3.0, stable patch level 8 (default)
2.6.39, stable patch level 4
If we want to build the BSP with a non-default kernel release, we just run ptxdist platformconfig and change
the kernel setting prior to building. As PTXdist checks the MD5 sums of the archives, we also have to change the
MD5 sum of the corresponding kernel archive.
Note: The MD5 sums for the kernels are (used by PTXdist):
3.1: 8d43453f8159b2332ad410b19d86a931
3.0: 398e95866794def22b12dfbc15ce89c0
2.6.39: 1aab7a741abe08d42e8eccf20de61e05
23
5 Special Notes
The magic behind the autostart of this small Qt based application at system startup can be found in
projectroot/etc/init.d/startup.
Note: The small Qt demo is prepared to run on a landsscape 480 x 272 screen. If your screen differs from this
setup, dont expect a correct image.
5.3 Framebuffer
This driver gains access to the display via device node /dev/fb0. For this BSP the LCDN43-1020 (N43) display
with a resolution of 480x240 is supported.
A simple test of this feature can be run with:
# fbtest
NOTE: fbset cannot be used to change display resolution or colour depth. Depending on the framebuffer device
different kernel command line may be needed to do this. Please refer to your display driver manual for details.
5.4 GPIO
Like most modern System-on-Chip CPUs, the S3C6410 has numerous GPIO pins. Some of them are inaccessible for the userspace, as Linux drivers use them internally. Others are also used by drivers but are exposed to
userspace via sysfs. Finally, the remaining GPIOs can be requested for custom use by userspace, also via sysfs.
Refer to the in-kernel documentation Documentation/gpio.txt for complete details how to use the sysfs-interface
for manually exporting GPIOs.
The entry base contains information about the base GPIO number and ngpio contains all GPIOs provided by this
GPIO controller.
We use GPIO34 as an example to show the usage of a single GPIO pin.
# echo 34 > /sys/class/gpio/export
24
5 Special Notes
This way we export gpio34 for userspace usage. If the export was successful, we will find a new directory named
/sys/class/gpio/gpio34 afterwards. Within this directory we will be able to find the entries to access the functions of this GPIO. If we wish to set the direction and initial level of the GPIO, we can use the command:
# echo high > /sys/class/gpio34/direction
This way we export GPIO34 for userspace usage and define our GPIOs direction attribute to an output with initially
high level. We can change the value or direction of this GPIO by using the entries direction or value.
Note: This method is not very fast, so for quickly changing GPIOs it is still necessary to write a kernel driver. The
method shown works well, for example to influence an LED directly from userspace.
To unexport an already exported GPIO, write the corresponding gpio-number into /sys/class/gpio/export.
# echo 34 > /sys/class/gpio/unexport
The current usage of most of the pins can be read from the entry in /sys/kernel/debug/gpio.
5.5 IC Master
The S3C6410 processor based Mini6410 supports a dedicated IC controller onchip. The kernel supports this
controller as a master controller.
Additional IC device drivers can use the standard IC device API to gain access to their devices through this
master controller. For further information about the IC framework see Documentation/i2c in the kernel source
tree.
5.6 LEDs
The LEDs on the Mini6410 can be controlled via the LED-subsystem of the Linux kernel. It provides methods
for switching them on and off as well as using so-called triggers. For example, you could trigger the LED using a
timer. That enables us to make it blink with any frequency we want.
All LEDs can be found in the directory /sys/class/leds. Each one has its own subdirectory. We will use led4 for
the following examples.
For each directory, you have a file named brightness which can be read and written with a decimal value between
0 and 255. The first one means LED off, the latter maximum brightness. Inbetween values scale the brightness if
the LED supports that. If not, non-zero means just LED on.
25
5 Special Notes
LEDs can be connected to triggers. A list of available triggers we can get from the trigger entry
/sys/class/leds/led4# cat trigger
[none] nand-disk mmc0 mmc1 timer heartbeat backlight gpio
If the timer-trigger is activated you should see two additional files in the current directory, namely delay_on and
delay_off. You can read and write decimal values there, which will set the corresponding delay in milliseconds.
As an example:
/sys/class/leds/led4# echo 250 > delay_on
/sys/class/leds/led4# echo 750 > delay_off
will blink the LED being on for 250ms and off for 750 ms.
Replace timer with none to disable the trigger again. Or select a different one from the list read from the trigger
entry.
Refer to Documentation/leds/leds-class.txt in-kernel documentation for further details about this subsystem.
After inserting an MMC/SD card, the kernel will generate new device nodes in dev/. The full device can be reached
via its /dev/mmcblk0 device node, MMC/SD card partitions will occur in the following way:
/dev/mmcblk0pY
Y counts as the partition number starting from 1 to the max count of partitions on this device.
Note: These partition device nodes will only occur if the card contains a valid partition table (harddisk like
handling). If it does not contain one, the whole device can be used for a filesystem (floppy like handling). In
this case /dev/mmcblk0 must be used for formatting and mounting.
The partitions can be formatted with any kind of filesystem and also handled in a standard manner, e.g. the mount
and umount command work as expected.
26
5 Special Notes
5.9 Network
The Mini6410 module has a DM9000 ethernet chip onboard, which is being used to provide the eth0 network
interface. The interface offers a standard Linux network port which can be programmed using the BSD socket
interface.
5.10 Touchscreen
A simple test of this feature can be run with:
# ts_calibrate
Whenever we touch the screen this tool lists the values the driver reports.
27
5 Special Notes
# ls /sys/bus/platform/drivers
A samsung-ts must be listed in this directory. If not, the kernel must be re-configured to support this device.
Secondly, a functional touchscreen depends on is the registered touchscreen device. If it is registered, this can
be checked at run-time with this command:
# ls /sys/bus/platform/devices
A samsung-ts must be listed in this directory. If not, something is preventing the kernel from registering this
device.
These steps ensure the modified sources are re-compiled. Use this new kernel and do the tests with the touchscreen again.
To change the userland tslib this can be done at run-time of the Mini6410. Just modify the /etc/ts.conf.
28
5 Special Notes
module_raw input means the tslib uses the raw data from the Linuxs input system
module pthres pmin=1 means the minimal pressure must be 1 to count as a touchscreen event. Other
values do not make sense yet, as the driver does not support pressure measurement
module variance delta=30 FIXME
module dejitter delta=10 FIXME
module linear FIXME
After changing one of these entries a run of ts_test can show if the new settings are better than the previous
ones.
Some display units with touchscreen support for the Mini6410 are using a OneWire interface to
control the touchscreen. These kind of display units are not supported by this board support
package.
5.12 ADC
Getting the digital equivalent of one of the analogue input channels can be done by reading the corresponding
entries in the sysfs.
For example the analogue input channel 0 on the Mini6410 is connected to the potentiometer W1. By reading the
entry /sys/devices/platform/s3c64xx-adc/s3c-hwmon/in0_input we can watch the different digital values while
turning the potentiometer W1.
Note: The analogue input channels 4 ... 7 are occupied by the touchscreen feature and can only be used as simple
analogue inputs if the touchscreen feature is disabled.
5.13 Keypad
Using the up to 6 available key buttons on the Mini6410 in a reqular manner requires a working console in the
kernel. Here the list of the current key codes they generate when pressed:
29
5 Special Notes
K1, code F1
K2, code F2
K3, code F3
K4, code F4
K5, code F5
K6, code F6
K7, code F7
K8, code F8
If one wants to change the generated codes, she/he can change it in the platform code found in
arch/arm/mach-s3c64xx/mach-mini6410.c, specially in the array mini6410_buttons.
If the key buttons are working as expected, can also be checked without a working console with the following
command:
# evtest /dev/input/event0
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
Input device name: gpio-keys
Supported events:
Event type 0 (Sync)
Event type 1 (Key)
Event code 59 (F1)
Event code 60 (F2)
Event code 61 (F3)
Event code 62 (F4)
Event code 63 (F5)
Event code 64 (F6)
Event code 65 (F7)
Event code 66 (F8)
Testing ... (interrupt to exit)
http://www.oselas.org/oselas/bsp/index_en.html
http://git-public.pengutronix.de/git-public/OSELAS.BSP-Pengutronix-Mini6410.git
If you want to contribute to this project by sending patches, these patches should always be based on the master
branch of this repository.
30
6 Document Revisions
2011/07/12
2011/10/30
2011/10/30
Initial Revision
Add the how to boot the Mini6410 from SD card
Add the special notes how to use some features of the Mini6410
31
7 Getting help
Below is a list of locations where you can get help in case of trouble. For questions how to do something special
with PTXdist or general questions about Linux in the embedded world, try these.
http://www.pengutronix.de/mailinglists/index_en.html
on how to subscribe to this list. If you want to search through the mailing list archive, visit
http://www.mail-archive.com/
and search for the list ptxdist. Please note again that this mailing list is just related to the PTXdist as a software.
For questions regarding your specific BSP, see the following items.
http://www.pengutronix.de/mailinglists/index_de.html
on how to subscribe to this list. Note: You can also send mails in English.
http://www.kroah.com/lkn/
7.3 Chat/IRC
About PTXdist in particular
irc.freenode.net:6667
Create a connection to the irc.freenode.net:6667 server and enter the chatroom #ptxdist. This is an English
room to answer questions about PTXdist. Best time to meet somebody there is at European daytime.
32
7 Getting help
http://www.pengutronix.de/mailinglists/index_en.html
to subscribe to this mailing list.
Note: Please be aware that we cannot answer hardware only related questions on this list.
or by electronic mail:
sales@pengutronix.de
33