You are on page 1of 192

m

c
.
l
e

w
w
w

n
r
e
k
rd

a
.h

: 2011. 10. 14.

: ,
, ,
, ,
, ,
, ,
, ,
,

m
o

c
.
l
e

 Samsung S5P6450
S5P6450 ODROIDODROID-E PCB

n
r
e
k
rd

 Samsung S5P6450
S5P6450 ODROIDODROID-E

 Samsung S5P6450
S5P6450 ODROIDODROID-E WinCE 6.0
 Android Camera Porting

a
.h

 Linux Server on ARM

w
w
w

 Android Open Accessory


Accessory


m
o

c
.
l
e

w
w
w

n
r
e
k
rd

a
.h

c
.
l
e

m
o

 ?
?

n
r
e
k
rd


 (RAM / FLASH)

w
w
w

a
.h

 Application Processor

 S5P6450

?
?

m
o

 (WinCE,
(WinCE, Linux, Qt, QNX)

c
.
l
e

 Connectivity


3G/WiFi/Bluetooth/NFC/USB/MicroSD/Camera/OpenCV

n
r
e
k
rd

 User Interface / MM


OpengGL/SurfaceFligner/Stagefright




(SDK)

w
w
w


JAVA

a
.h

 /


Application Processor
 Cortex-A9 Dual core
 Exynos-4210/4220

 Cortex-A8

 Tegra-2

 ARMADA 600 Series

 EMMA Mobile

w
w
w

 i.MX53/51

 Sitara AM35/7/8

 OMAP-4

 i.MX6

c
.
l
e

n
r
e
k
rd

 MSM8960 (S4)

 Spear 13xx

m
o

 Exynos-3110 (S5PC110)/C100

a
.h

 Telechips/CoreLogic/ARMLogic

/WonderMedia(VIA)

 ARM11 / ARM9 ( , 3D !)

S5P6450

m
o


 ? ?

c
.
l
e

n
r
e
k
rd

 (RAM/FLASH)

 (USB 2.0 Host/Device, SDIO, UART, SPI, I2C, Static Bus )



 PMIC

a
.h





w
w
w


 NFC

 ZigBee

 3G / LTE
 GPS

(RAM / FLASH)
 RAM

m
o

c
.
l
e

 SDRAM  DDR  DDR2  DDR3 (PC )

 2010 SDRAM (2440 )

mDDR  LPDDR2 (2~3 LPDDR2 ?)

n
r
e
k
rd

SDRAM 256Mbit (x16) / $1 (12 ), SDRAM 512Mbit (x16) / 10

DDR2 512Mbit (x16) / $1, DDR2 1Gbit (x16) / $1.5, DDR3 1Gbit (x16) / $1.3

mDDR 512Mbit (x16) / $2, mDDR 1Gbit (x16) / $3, mDDR 2Gbit (x32) / $5

 FLASH

a
.h

 NOR : OS/App

w
w
w

 NAND


NAND ()  AP

 NAND  eMMC (FTL / )




iNAND/MoviNAND (//DDR-100Mhz-8bit[eMMC4.5])

 NAND  Micro-SD / SDHC / MMC




//

S5P6450
24xx ,
, TI Sitara AM1xxx ,
, Freescale i.MX2x

- PND e-book

m
o

c
.
l
e

- 5~7$ ARM9 200~400Mhz

n
r
e
k
rd

- POS / / PDA / /

Migration

Samsung S5P6450

a
.h

2~3
2~3
3D / UI

w
w
w

USB 2.0 High speed Host

800Mhz

S5P6450
Specification
-

w
w
w

X: No GPS, None Secure Booting


S: No GPS, Secure Booting
G: GPS, None Secure Booting
533/667/800Mhz

m
o

c
.
l
e

ARM1176JZF-S based CPU system and Memory Mapping Unit (MMU).


Manufactured with the 45nm process for low power and low cost.
Package is 409 pin FBGA type and dimension is 14.0 x 14.0 mm with 0.65mm pitch.
16KB I-cache and 16KB D-cache CPU memories.
64-/32-bit 166MHz AMBA 3.0 AXI bus structure.
32-bit Mobile DDR and DDR2 Interface.
Embedded 64kByte SRAM and 64kByte ROM on AXI.
8-bit 5 Megapixel (MP) capable Camera Interface
24-bit 3x I2S and 16-bit 3x PCM Interface
5xUART / 2xSPI / 2xI2C / 3xSDIO interface
On-chip USB 2.0 OTG - USB HOST 2.0
Hardware Rotator
Transport Stream Interface
GPS baseband (Option)
Security SubSystem (SSS)
Mali400 3D engine
13-ch/12bit ADC (TSADC)
MPEG2/4, H.263 Video decoder(D1)
Muxed RGB and Bus interface

a
.h

n
r
e
k
rd

m
o

c
.
l
e

w
w
w

n
r
e
k
rd

a
.h


 Hardware Structure

c
.
l
e

m
o

 High speed Return Path, Crosstalk ,,,ETC

n
r
e
k
rd

 Knee Frequency

 Calculation of Decap

 Characteristic Impedance of PCB

a
.h

 Strip line and Micro strip

w
w
w

 PCB Design recommend


 Lower Power DDR
 PCB Case Study
 PMIC Spec

Hardware Structure of ODROIDODROID-E

I2C

3M CAMERA

n
r
e
k
rd

24bpp RGB

4 LCD

Cam I/F

I2C

WIFI /BT

Ant
BCM4329

w
w
w
Boot

T-FLSH

PMIC

DC
JACK

a
.h
SDIO

RN5T614

1500mAH@ 3.7V

Battery

UART

BMA150

USB, UART, JTAG

S5P6450

SD/MMC

I2C

I2C

I2S

MAX17040

m
o

c
.
l
e

Touch

Motor
Driver

MAX98095
Codec

TTA20

LRA
MIC
HP
SPK

Defining High Speed

m
o

c
.
l
e

 Digital Signal Edge Rates are the determining factor




Higher clock frequencies mandate faster edge rates, thereby


inferring high speed signaling issues

Simply operating high speed ICs at a lower clock frequency


does not eliminate the high speed integrity issues

a
.h

n
r
e
k
rd

 Think signal bandwidth not clock frequency...




Digital Signal Bandwith the relationship between signal rise


time, and its bandwith

w
w
w

Digital Signaling Fundamentals

A function of dielectric constant, trace width, trace thickness,


and trace height above return plane(s)

n
r
c e
v = k
Er
d
r
a
.h

 PCB Trace propagation velocity

Microstrip (surface) layers: prop delay ~150 psec/inch

w
w
w


m
o

c
.
l
e

 PCB Trace characteristic impedance ( Z 0 )

Magnetic field propagating thru: FR4 blew, solder


mask,then air above

Internal stripline layers: prop delay ~165 psec/inch

Magnetic field propagating thru: FR4 above and blew

High frequency signal return paths

m
o

 Kirchhoff Current Law: Sum of the currents entering and

c
.
l
e

leaving a node is zero




Low frequency (sine wave < 10 MHz) return: path of least


resistance

High frequency return : path of least inductance

n
r
e
k
rd

The smallest physical loop area always provides lowest inductance

Return current density in reference plane falls off with the square of the
distance

w
w
w

a
.h

Signal Return Path Signal Layer Change

1. The(2) trace layers straddle

n
r
e
k
rd

the same reference plane

2. The(2) trace layers reference

different planes, both planes


at same potential, e,g. GND

a
.h

3. The(2) trace layers reference

different planes, planes at


different DC potential

w
w
w

 Implications to PCB stack

up and trace routing rules




Case 2 apply a GND


shoting via grid across
entire(x,y) PCB surface

m
o

c
.
l
e

 Three general cases:

Return path Common Design Issue


 Signal trace routing directly over a split (or other

m
o

c
.
l
e

discontinuity) in its reference plane




Closely spaced adjacent Vias anti-pad induced slots

Often creates mutual inductive crosstalk (noise margin)




n
r
e
k
rd

Case when many adjacent bus lines cross together

Can increase radiated EMI and lower radiated immunity threshold

Degrades rising and falling edge rates (timing margin)

w
w
w

a
.h

Signal Return Path Signal Layer Change

m
o

Case 3.) The (2) trace layers reference different planes each at a different DC potential.
The return current encounters the plane capacitance impedance thereby inducing a
voltage drop across this impedance. This impedance drops over time as the current
spreads out and traverses a larger capacitive area.
This return path impedance (Z) can be estimated as:
Z ~ 5 ohm x [plane separation (inches) / time (nsec)]
Simple stack-up shown not suitable for commuting very fast edge rate signaling (<<1
nsec). Deploy thin core PWR//GND construction to minimize the impedance and
correspondingly the voltage drop.

c
.
l
e

w
w
w

a
.h

n
r
e
k
rd

Frequency /time relation

m
o

 Basic facts and tools for the analysis of the edge of a clock


c
.
l
e

Rise time (Tr) = time to rise from 10% to 90% of the signal.

90%
10%

w
w
w

n
r
e
k
rd

a
.h
Tr

A slow
rising edge

A fast falling edge

Knee frequency

Fknee =

0.35

Tr

or

Tr

m
o

c
.
l
e

0.5

n
r
e
k
rd

 Tr is the 1010-90% edge rate of the signal


 This is the frequency at which most energy is blew
 EX) Tr =5ns, what is the equivalent frequency.

Fknee

a
.h

0.5
=
= 100MHz
5ns

w
w
w

Period/2=Tr

Period of the equivalent signal

Reflection
 Reflection ?
?


m
o

c
.
l
e

Device
Device Device
Device
Device Device
Device

.
.

n
r
e
k
rd

 Reflection

Overshoot/Undershoot Fast Rising/Falling Time, Reduction


Noise Margin
 (Harmonics)
(Harmonics)
(Harmonics)
Radiation/Conduction EMI Noise

w
w
w

Tr

Tf

a
.h

Overshoot
V
Undershoot
Tr

Tf

CROSSTALK

m
o

c
.
l
e

 (Capacitance Coupling)

n
r
e
k
rd

Inductance, Lm
Mutual Inductance,

Mutual Capacitance,
Capacitance, Cm
Zo

w
w
w

a
.h
Cm

Zo

Zo

far

far

Lm

near

Zs

Zo

Zo

near

Zs
Zo

CROSSTALK PCB

m
o

c
.
l
e

 Driver Aggressor

n
r
e
k
rd

 Buffer
 Shielding

 90

a
.h

w
w
w

 Rising Time
 Ground Plane Signal Layer

Calculation of Decoupling Capacitors

Q I dt
=
c=
dv
dv

m
o

c
.
l
e

n
r
e
k
rd

 The amount of current needed for switching an output from

low to high(I), the time required for the capacitor to charge


the supply line (dt), and the drop in the supply voltage that
can be tolerated (dV), must be known for computation of
decoupling capacitor value.

w
w
w

a
.h

 For example, consider a buffer with switching outputs. With


dV = 0.1V, dt = 3ns, and I = 352mA
C = [352mA x 3ns] / 0.1V > C = 0.01056uF

Decoupling Capacitors
 Low ESR and ESL capacitor Recommend
 Sizing Decap

m
o

c
.
l
e

 Selecting the Package for the Decap

n
r
e
k
rd

 The large value handles the lower frequencies and high

current issues while the smaller value handles the lower


frequencies
PACKAGE
0603

a
.h

ESL(pH)
400

w
w
w
1005

550

1608

700

2012

800

3216

1250

Package Series Inductances

Capacitor impedance vs. frequency

High Frequency Ceramic Capacitor

m
o

 NPO capacitors have the lowest ESR and best temperature

c
.
l
e

and voltage properties,


properties but are only available up to a few nF
 X7R capacitors have reasonable voltage and temperature
coefficients and are available from several nF to several uF
 X5R is similar to X7R, but with reduced reliability and are
being extended to 100uF
 Y5V dielectric is used to achieve high capacitance values,, but
has very poor voltage and temperature characteristics

w
w
w
NPO

1pF

CODE: 1R0

10pF

100

n
r
e
k
rd

a
.h
X7R

X5R

100pF

101

1nF

102

Y5V

10nF

103

100nF

1uF

10uF

104

105

106

100uF

107

Decoupling Capacitors Routing

m
o

 DO NOT have vias between DECAP and active device









c
.
l
e

Visualize the high frequency current flow!!


Ensure DECAP are on same layer as active component for
best results
Route vias into DECAP and then into the active component
The more vias the better
The wider the traces the better
The closer the better ( < 5mm)
Length to width not exceed 3:1

w
w
w

a
.h

n
r
e
k
rd

PCB traces as Transmission Lines

m
o

 Signal wavelength approaches component size

c
.
l
e

 Dielectric Loss (G)

n
r
e
k
rd

 Trace Copper Loss(R)

 Trace series inductance(L)


 Trace capacitance(C)

w
w
w

a
.h

R
L
G

Characteristic Impedance

( R + j L )
Z0 =
(G + jC )

m
o

c
.
l
e

n
r
e
k
rd

a
.h

Line impedance in terms of R,L,C and G

w
w
w

L
Z0 =
C

Line Impedance for Lossless line

Control impedance of PCB

 Topology

n
r
e
k
rd

 Dielectric constant of PCB material


 Dielectric height
 Conductor width

a
.h

 Conductor thickness (small effect)

 Impedance Control

w
w
w

 Delivering max power to load


 Maintaining signal intergrity

 Prevent excessive driver loading

m
o

c
.
l
e

 Impedance Determined By

I/F PCB Impedance

 Memory Port 0 Line 50 ohm

n
r
e
k
rd

 Memory Port 1
 mDDR(LPDDR)

m
o

c
.
l
e

 USB - Differential 90 ohm

1. DQS, DQM,DATA,ADDR, Control Signals Line 50 ohm

a
.h

2. Clock Differential 80 ohm

 MIPI Differential 100 ohm

w
w
w

 MMC/SD Line 50 ohm

Stripline Microstrip

Stripline

Copper Trace

w
w
w

a
.h

Copper Plane

c
.
l
e

n
r
e
k
rd

Cross Section of Above PCB

m
o

FR4 Dielectric MicroMicro-Strip

Signal (microstrip
(microstrip)
microstrip)
Ground/Power
Signal (stripline
(stripline)
stripline)
Signal (stripline
(stripline)
stripline)
Ground/Power
Signal (microstrip
(microstrip)
microstrip)

Micro Strip
Parallel Plate Assumptions +
 Large ground plane with zero
thickness
 To accurately predict micro-strip
impedance, you must calculate the
effective dielectric constant.

w
w
w

e =

F =

r + 1
2

r 1

2 1+

+ F 0.217(r 1)

WC

0 . 02 ( r 1 ) 1

T
D

TC

From Hall, Hall & McCall:

Valid when:
0.1 < WC/TD < 2.0 and 1 < er < 15

a
.h

12TD
WC

m
o

c
.
l
e
rn

e
k
rd

5.98TD
ln

r + 1.41 0.8WC + TC
87

Z0

WC

2
for

WC
<1
TD

for

WC
>1
TD

TC
WCTD

TD

Stripline

m
o

c
.
l
e
rn

 Same assumptions as used for

microstrip apply here

WC

e
k
rd

From Hall, Hall & McCall:

Symmetric (balanced) Stripline Case TD1 = TD2

4(TD1 + TD1)

Z 0 sym
ln

r 0.67 (0.8WC + TC )
60

w
w
w

a
.h

Valid when WC/(TD1+TD2) < 0.35 and TC/(TD1+TD2) < 0.25

Offset (unbalanced) Stripline Case TD1 > TD2

Z 0 sym(2 A, WC , TC , r ) Z 0 sym(2 B,WC , TC , r )


Z 0offset 2
Z 0 sym(2 A, WC , TC , r ) + Z 0 sym(2 B,WC , TC , r )

TD1

TC

TD2

S5P6450 PCB
 PCB (Layer Stack)

w
w
w

a
.h

n
r
e
k
rd

c
.
l
e

m
o

PCB


 3W rule

n
r
e
k
rd

 20H rule

m
o

c
.
l
e

 Clock Line EMI .


 .
 T .

a
.h

 Return Path .

 Clock Driver, OSC

w
w
w

 90

 GND Plane .


Line Via
Via
 Line

Antenna

m
o

c
.
l
e

 GND

n
r
e
k
rd

 Monopole GND
 plastic

a
.h

 Low-Q ,
 PCB track ,

w
w
w

 /4 Board

LPDDR DDR

 VDD VDDQ

n
r
e
k
rd

 Command

 Input/output
 2.5V -> 1.8V

a
.h

m
o

c
.
l
e

 Initialization

 Clocking(CAS latency)

 Temperature-compensated self refresh(TCSR)

w
w
w

 Partial-array self refresh(PASR)


 Deep power down(DPD)
 Clock stop mode

Lower Power DDRDDR-1

m
o

c
.
l
e

 Data (DQ)/ DQS Signals

Single ended nets


 Data Strobe(DQS) time delay .
 Byte lane(8 bit groups)
 50 ohm


w
w
w

n
r
e
k
rd

a
.h

For WRITE cycles, the DQS waveform would


be shifted a half pulse to the right, as
shown by green arrow and dotted edge

Lower Power DDRDDR-2

 Single ended nets

n
r
e
k
rd

 Memory Clock
 Clock Positive edge

 Memory Clock
 50 ohm

 Clock

w
w
w

a
.h

 Differential Signals
 80 ohm


m
o

c
.
l
e

 Address/Command/Control Signals

DDR Signaling SSTLSSTL-1.8

VOH(MIN)

n
r
e
k
rd

1.150V

1.025V

a
.h
0.9V

w
w
w
Transmitter

0.775V

VOL (MAX)
VSSQ

VIH AC

VIH DC

VI L DC
VIL AC

0.650V

Receiver

m
o

c
.
l
e

VDDQ (1.8V nominal)

LPDDR DC/AC operating conditions

c
.
l
e

m
o

w
w
w

a
.h

n
r
e
k
rd

PCB Case Study(S5P6450) : ODROIDODROID-E4/7






0.4 /0.2mm(LAND/ DRILL)


(Clearance)
0.1mm / 0.075mm
PCB
0.8mm

6 Layers
S5P6450 - 0.65mm Pitch BGA PAD
NSMD PAD : 0.25mm / 0.26mm
(LAND/ Solder MASK)
Dog-bones Fan out
MLB(Multi Layer Board)

w
w
w



n
r
e
k
rd

a
.h

m
o

c
.
l
e

 VIA

PCB Case Study(SP5C100) : ODROID

PTH,IVH 0.45 /0.2mm

n
r
e
k
rd

BVH 0.5/0.1mm

 (Clearance)

0.1mm / 0.075mm
 PCB
1mm

Buildup 12 Layers
 SP5C100 - 0.5mm Pitch BGA PAD 521 pin
NSMD PAD : 0.25mm / 0.3mm

w
w
w

a
.h

m
o

c
.
l
e

 VIA

PCB Case Study(SP5C110) : ODROIDODROID-S/T/7






PTH,IVH 0.45 /0.2mm


BVH 1-2 0.275/0.1mm
BVH 1-3 0.285/0.1mm
(Clearance)
0.1mm / 0.075mm
PCB
0.8mm

Buildup 8 Layers D type


SP5C110 - 0.5mm Pitch BGA PAD - 596pin
NSMD PAD : 0.275mm / 0.375mm
(LAND/ Solder MASK)

w
w
w

n
r
e
k
rd

a
.h

m
o

c
.
l
e

 VIA

PCB Case Study(Exynos4210) : ODROIDODROID-A

m
o

 VIA






PTH,IVH 0.45 /0.2mm


BVH 1-2 0.25/0.1mm
BVH 1-3 0.25/0.1mm
(Clearance)
0.1mm / 0.075mm
PCB
0.8mm

Buildup 10 Layers D type


Exynos4210 - 0.45mm Pitch BGA PAD - 756pin
SMD PAD : 0.25mm / 0.23mm

w
w
w

a
.h

n
r
e
k
rd

c
.
l
e

PMICPMIC-1(Ricoh RN5T614E)
 High Efficiency Step-down DC/DC Converters
1.

c
.
l
e

Core)
2.

m
o

DC/DC1: 1.20V (0.9V to 1.5V/12.5mV steps) @1200mA with RAMP control (For

n
r
e
k
rd

DC/DC2: 1.15V (0.9V to 1.5V/12.5mV steps and 1.8V) @1000mA with RAMP
control (For Logic)

3.

DC/DC3: 1.8V (1.8V to 3.3V by external resistors) @500mA (For Memory)

4.

DC/DC on/off control pin for DC/DC1 and DC/DC2

a
.h

 Low Drop Voltage Regulators

LDO1:3.0V (Always-on) @10mA

w
w
w

LDO2:1.2V (0.9V/1.0V/1.1V/1.2V/1.3V) @30mA

LDO3:1.2V (0.9V/1.0V/1.1V/1.2V/1.3V) @30mA

LDO4:3.3V (1.8V/2.5V/2.6V/2.8V/2.85V/3.0V/3.3V) @300mA

LDO5:1.8V (1.8V/2.5V/2.6V/2.8V/2.85V/3.0V/3.3V) @300mA

LDO6:2.6V (1.2V/1.8V/2.5V/2.6V/2.8V/2.85V/3.0V/3.3V) @150mA

LDO7:3.0V (1.2V/1.8V/2.5V/2.6V/2.8V/2.85V/3.0V/3.3V) @150mA

LDO8:3.3V (1.8V/2.5V/2.6V/2.8V/2.85V/3.0V/3.3V) @150mA

PMICPMIC-2(Ricoh RN5T614E)

m
o

 Li-ion Battery Charger

c
.
l
e

Support AC adapter charging


2. With the current limit protection and charge current control, the limited power can be
efficiently
3. supplied to the system and the battery.
4. The system can power on even when Li-ion Battery is low voltage or open.
5. The device can withstand up to 6.5V on VCHG pin. However, it can withstand high
voltage by
6. combining a high voltage protection IC (up to 28V by using BD6040 of ROHM).
7. Rapid timer and Trickle timer integrated.
8. Monitor for the battery thermistor built in.
9. No external MOSFET required.
10. If system loads over AC adapter current rating, the battery will supply the current to
the system.
11. Chip temperature detection circuit for over temperature protection integrated.
1.

w
w
w

1. Package

a
.h

n
r
e
k
rd

1. QFN48 pin 6x6mm

2. Low price about 1.2$

m
o

c
.
l
e

w
w
w

n
r
e
k
rd

a
.h

m
o

c
.
l
e

 (Uboot 1.3.4)

n
r
e
k
rd

 (2.3.35.7)

a
.h

 (Gingerbread 2.3.5)

w
w
w

U-Boot
ODROIDODROID-E Hardware

XOSCSEL

Frequency select

n
r
e
k
rd
0
1

XFXTSEL

XOSCSEL

UART2

S5P6450
DRAM
Controller

w
w
w
SD/MMC
Controller

iROM(BL0)
(64KB)

OM[3:0] = iROM
Boot

XFXTSEL

a
.h

NAND Controller

GPN[15:13] :
Booting
Device selection

DEBUG
Serial
Port

Oscillator pad select

SYS OSC(XXTO, XXTI)

USB OSC(XUSBXTI, XUSBXTO)

Clock source frequency select

12 Mhz
19.2 Mhz

OM[3:0
]

GPN[15:13
]

Booting Mode

Boot Device

DDR
256MB

Boot
Device

m
o

c
.
l
e

Oscillator pad select

0_111

000

SD/MMC(CH1 44-bit mode)

001

eMMC4.3(CH1 44-bit mode)

010

eMMC4.4(CH3 44-bit mode)

011

iROM

Reserved

100

Reserved

101

512B/Page, 88-bit ECC

110

Over 2KB/Page, 2424-bit ECC(2K,4K,8K)

111

Over 4KB/Page, 4848-bit ECC(4K,8K)

DEBUG Port

Memory

UART2

DDR (256MB)

U-Boot Source Tree

n
r
e
k
rd

/include

/board

/configs

/samsung

smdk6450.h
System clock
Debug Port
Default

w
w
w

/cpu

/s5p645x

/smdk6450

fastboot.c

lowlevel_init.s

usbdusbd-otgotg-hs.c

a
.h

A/M PLL

m
o

c
.
l
e

/uboot

USB PHY Clock


Clock frequency
Clock source

/s5p6450

cpu_init.s
DMC
DMC Memory control
DMC Timing control

/common

cmd_mmc_disk.c
Fastboot partition
SYSTEM (256MB)
DATA (512MB)
CACHE (256MB)

U-Boot Build

make clean


make smdk6450_config


\include\configs\smdk6450.h u-boot config .

make j10

w
w
w

u-boot.bin

n
r
e
k
rd

a
.h

m
o

c
.
l
e

object, config .

U-Boot Fusing - 1

m
o

c
.
l
e

 JTAG


H/W JTAG Port MDS(Trace32) .

MDS Tool Script H/W Clock

n
r
e
k
rd

Memory(DDR) .


Memory(DDR) Uboot.bin .

Uboot fusing.

w
w
w

a
.h

fastboot

movi write uboot 20008000

Host-PC


fastboot flash uboot uboot.bin

U-Boot Fusing - 2
T-Flash Map

c
.
l
e

(include/movi.h)
14K bytes
ST.
Sector

Partition Name

CACHE (Ext4)
DATA (Ext4)
SYSTEM (Ext4)

Lowlevel
Partition
(10MB)

a
.h

13377

Reserved

9281

Ramdisk

1089

Kernel

w
w
w

Size

n
r
e
k
rd

User Data (VFAT)


Normal
Partition

m
o

UBOOT BL1
BL1

u-boot.bin

u-boot_bl1.bin (14K 4 bytes)

256MB
512MB

Checksum(4bytes)

 BL1Checksum

Uboot/cpu/s5p645x/movi.c

256MB

2MB
4MB

65

BL2 (u-boot.bin)

512KB

33

UBOOT config

16KB

BL1 (u-boot_bl1.bin)

16KB

MBR

512B

void movi_write_bl1(ulong addr,member_t *image)


{
int i;
ulong checksum;
ulong src;
ulong tmp;
src = addr;
for(i = 0, checksum = 0;i < (14 * 1024) - 4;i++)
checksum += *(u8*)addr++;
tmp = *(ulong*)addr;
*(ulong*)addr = checksum;

 Bootloader fusing (Linux console)


sudo dd iflag=dsync oflag=dsync if=./u-boot_bl1.bin of=/dev/sdb seek=1
sudo dd iflag=dsync oflag=dsync if=./u-boot.bin of=/dev/sdb seek=65

movi_write(image[1].start_blk,image[1].used_blk,
src);
*(ulong*)addr = tmp;
}

U-Boot

c
.
l
e

m
o

w
w
w

a
.h

n
r
e
k
rd

U-Boot Debugging

Debug console

Check H/W

Main Clock .
Boot mode, Boot Device .
SD/MMC Port .
DRAM .
DRAM Bus .

Debug Message .

Main Clock .

w
w
w

c
.
l
e

n
r
e
k
rd

OK .

a
.h

m
o

Check S/W

Debug port .
BL1 checksum .

Memory Configuration .
A/M PLL .

Kernel Driver

ODROIDODROID-E Device
Keypad
(GPIO)

IIC

Vibrator
(AUDX1001)

IIC

w
w
w

Kernel Porting





SPI

HSHS-MMC/SD/SDIO

Touchscreen
(AIMS902)

Accelerometor
(BMA150)

n
r
e
k
rd
LCD I/F

GPIO

UART

S5P6450

a
.h

Device
Device Driver
Makefile Kconfig file
Platform device driver

IIC

CAM I/F

IIC

3M Camera
(S5K5CAGX)

m
o

c
.
l
e

LCD 480X800(WVGA)
(LMS397KF04)

WiFi / BT
(BCM4329)

IIC

Battery Monitor
(MAX17040)

IIC

Regulator
(RN5T614)

IIC
IIS

Sound Codec
(MAX98095)

Kernel Source Tree

/input
/touchscreen
/aim902.c
/aim902-i2c.c
/aim902-sysfs.c
/aim902update.c
/Kconfig
/Makefile

/video

n
r
e
k
rd

/samsung

/odroide_keypad.c
/Kconfig
/Makefile

w
w
w

/sound

/soc

/arch

/arm

/rn5t614.c
/Kconfig
/Makefile

/video

/s5k5cagx.
c
/Kconfig
/Makefile

/s3cfb_lms397kf04.c
/Kconfig
/Makefile

/keyboard

/regulator

/media

a
.h

/codec

/s3c24xx

/max98095.c
/max98095_mixer.
c
/Kconfig
/Makefile

/hkdk6450-max98095.c
/Kconfig
/Makefile

/mach-s5p6450

m
o

c
.
l
e

/drivers

/mach-hkdk6450.c
/Kconfig
/Makefile

/misc

/axxx1001.c
/Kconfig
/Makefile

/accelerometor

/yas_acc_kernel_driver.c
/yas_acc_driverbma150.c
/Kconfig
/Makefile

Kconfig , Makefile
 Kconfig file
config TOUCHSCREEN_TPS6507X
tristate "TPS6507x based touchscreens"
depends on I2C
help
Say Y here if you have a TPS6507x based touchscreen controller.
If unsure, say N.
To compile this driver as a module, choose M here: the module will be called tps6507x_ts.

n
r
e
k
rd

config TOUCHSCREEN_AIM902
bool "ODROID-E4 AIM902 based touchscreens"
depends on I2C
---help--Say Y here if you have a touchscreen interface using the AIM902 controller, and your board-specific initialization
code includes that.
This enables support for ODROTD-E WVGA(480X800) Touch panel

w
w
w

 Makefile

m
o

c
.
l
e

-- drivers/input/touchscreen/Kconfig --

a
.h

-- drivers/input/touchscreen/Makefile -obj-$(CONFIG_TOUCHSCREEN_W90X900) += w90p910_ts.o


obj-$(CONFIG_TOUCHSCREEN_AIM902) += aim902.o aim902-i2c.o aim902-sysfs.o aim902-update.o
obj-$(CONFIG_TOUCHSCREEN_TPS6507X) += tps6507x-ts.o

Platform device

m
o

-- /arch/arm/mach-s5p6450/mach-hkdk6450.c --

//---------------------------------------------------------------------------------------// I2C_5 GPIO interface (AIMS902 Touchscreen)


//---------------------------------------------------------------------------------------#define GPIO_I2C5_SDA S5P6450_GPD(6)
#define GPIO_I2C5_SCL S5P6450_GPD(7)

c
.
l
e

n
r
e
k
rd

static struct i2c_gpio_platform_data i2c5_platdata = {


.sda_pin = GPIO_I2C5_SDA, // gpio number
.scl_pin = GPIO_I2C5_SCL,
.udelay = 1,
.sda_is_open_drain = 0,
.scl_is_open_drain = 0,
.scl_is_output_only = 0
};
static struct
platform_device hkdk6450_i2c5 = {
.name
= "i2c-gpio",
.id = 5, // adapter number
.dev.platform_data = &i2c5_platdata,
};
static struct i2c_board_info i2c_devs5[] __initdata = {
#if defined(CONFIG_TOUCHSCREEN_AIM902)
{ I2C_BOARD_INFO("aim902", 0x28), },
#endif
};
//----------------------------------------------------------------------------------------

w
w
w

a
.h

static struct platform_device *hkdk6450_devices[] __initdata = {


&s3c_device_i2c0,
&s3c_device_i2c1,

#if defined(CONFIG_TOUCHSCREEN_AIM902)
&hkdk6450_i2c5,
#endif
}
//----------------------------------------------------------------------------------------

Kernel Build - 1


make distclean


make smdk6450_android_defconfig


config file .

w
w
w

n
r
e
k
rd

a
.h

m
o

c
.
l
e

object, config .

Kernel Build - 2


make menuconfig



w
w
w

n
r
e
k
rd

a
.h

m
o

c
.
l
e

Platform device driver .


device driver .

Kernel Build - 3


make j10


w
w
w

Kernel .config configs




n
r
e
k
rd

a
.h

cp .config arch/arm/configs/odroid_e_defconfig

Kernel Image output




arch/arm/boot/zImage .

m
o

c
.
l
e

Kernel image driver module (*.ko) .

Kernel Fusing


Uboot fastboot


n
r
e
k
rd

T-Flash Reader


Host PC :
sudo dd iflag=dsync oflag=dsync if=./zImage of=/dev/sdb seek=1089

w
w
w

a
.h

m
o

c
.
l
e

Host PC :
sudo fastboot flash kernel zImage

Android

/device

/odroide4

/hardkernel

BoardConfig.mk
build_android.sh
device.mk

/product

w
w
w
/common

/google

/sec

/conf

init.product.rc
init.rc
ueventd.product.rc
vold.fstab

e
k
rd

device_common.mk

a
.h

AndroidProduct.mk
odroide4.mk

/proprietary

m
o

c
.
l
e
rn

Android Device

/keychars

Android Porting

Device product
BoardConfig.mk
init.rc
device.mk
vold.fstab
WiFi / Bluetooth
Sensor / Carmera library

Key-layout file (kcm, kl


file)

/libcameraE4

Camera interface file

/libsensor

Sensor interface file

/bin

Touch Firmware
WiFi / BT Firmware

BoardConfig.mk - 1

c
.
l
e

m
o

#-------------------------------------------------------------------------# Sound option


#-------------------------------------------------------------------------BOARD_USES_GENERIC_AUDIO := false
BOARD_USES_LIBSECRIL_STUB := true
BOARD_NO_PAGE_FLIPPING := false
#-------------------------------------------------------------------------# bosh(bma150) accelerometer sensor
#-------------------------------------------------------------------------BOARD_HAVE_BMA150_SENSORS := true
#-------------------------------------------------------------------------# Wifi Config
#-------------------------------------------------------------------------WPA_BUILD_SUPPLICANT := true
CONFIG_CTRL_IFACE := y
BOARD_WPA_SUPPLICANT_DRIVER := WEXT
WPA_SUPPLICANT_VERSION
:= VER_0_6_X
BOARD_WLAN_DEVICE
:= bcm4329
WIFI_DRIVER_MODULE_PATH
:= "/system/lib/modules/bcm4329.ko
WIFI_DRIVER_MODULE_ARG
:= "iface_name=wlan firmware_path=/system/etc/firmware/fw_bcm4329.bin
nvram_path=/system/etc/firmware/nvram"
WIFI_DRIVER_MODULE_NAME
:= "bcm4329

w
w
w

a
.h

n
r
e
k
rd

BoardConfig.mk - 2

c
.
l
e

m
o

#-------------------------------------------------------------------------# Camera
#-------------------------------------------------------------------------USE_CAMERA_STUB := false
ifeq ($(USE_CAMERA_STUB),false)
BOARD_CAMERA_LIBRARIES := libhkcamera_odroide
endif
#-------------------------------------------------------------------------# Bluetooth config
#-------------------------------------------------------------------------BOARD_HAVE_BLUETOOTH := true
BOARD_HAVE_BLUETOOTH_BCM := true
#-------------------------------------------------------------------------# GPS
#-------------------------------------------------------------------------BOARD_HAVE_HARDWARE_GPS := false
#-------------------------------------------------------------------------# Chip H/W Config
#-------------------------------------------------------------------------BOARD_USES_OVERLAY := true
BOARD_USES_HW_DECODER := true
BOARD_USE_JPEG := false

w
w
w

a
.h

n
r
e
k
rd

init.rc - 1

w
w
w

m
o

c
.
l
e

write /dev/cpuctl/bg_non_interactive/cpu.shares 52
on fs
# mount mtd partitions
# Mount /system rw first to give the filesystem a chance to save a checkpoint
mount ext4 /dev/block/mmcblk0p2 /system
mount ext4 /dev/block/mmcblk0p3 /data wait nosuid nodev noatime
mount ext4 /dev/block/mmcblk0p4 /cache /cache nosuid nodevon post-fs
# once everything is setup, no need to modify /
mount rootfs rootfs / ro remount

on boot

chown system system /sys/kernel/ipv4/tcp_rmem_def


chown system system /sys/kernel/ipv4/tcp_rmem_max
chown root radio /proc/cmdline
#################################################
# Sensors interface node
#################################################
chown system input /sys/class/input/input0/enable
chown system input /sys/class/input/input0/delay
chown system input /sys/class/input/input0/wake

a
.h

n
r
e
k
rd

init.rc - 2

#
# bluetooth interface
#
chown bluetooth bluetooth /dev/s3c2410_serial0
chmod 0666
/dev/s3c2410_serial0
#
# bluetooth Mac address
#
chown bluetooth bluetooth /system/etc/bluetooth
chmod 755 /system/etc/bluetooth

a
.h

n
r
e
k
rd

# Define TCP buffer sizes for various networks


# ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax,
setprop net.tcp.buffersize.default 4096,87380,110208,4096,16384,110208
setprop net.tcp.buffersize.wifi 4095,87380,110208,4096,16384,110208
setprop net.tcp.buffersize.umts 4094,87380,110208,4096,16384,110208
setprop net.tcp.buffersize.edge 4093,26280,35040,4096,16384,35040
setprop net.tcp.buffersize.gprs 4092,8760,11680,4096,8760,11680

w
w
w

c
.
l
e

m
o

init.rc - 3

m
o

c
.
l
e

class_start default

service wpa_supplicant /system/bin/wpa_supplicant -Dwext -iwlan0 -c /data/misc/wifi/wpa_supplicant.conf dd


group system wifi inet
disabled
oneshot

n
r
e
k
rd

#===================================================================
# baudrate change 115200 to 921600(Bluetooth)
#===================================================================
service hciattach /system/bin/hciattach -n -f /system/etc/firmware/bcm4329.hcd /dev/s3c2410_serial0 bcmbt 921600
flow
user bluetooth
group bluetooth net_bt_admin misc
disabled

w
w
w

a
.h

service hfag /system/bin/sdptool add --channel=10 HFAG


user bluetooth
group bluetooth net_bt_admin
disabled
oneshot

device.mk - 1
include $(LOCAL_PATH)/BoardConfig.mk

m
o

c
.
l
e

# -------------------------------------------------------------------------# Prebuilt kl keymaps


# -------------------------------------------------------------------------PRODUCT_COPY_FILES += \
device/hardkernel/proprietary/keychars/hkc1xx-keypad.kl:system/usr/keylayout/hkc1xx-keypad.kl

n
r
e
k
rd

# -------------------------------------------------------------------------# Generated kcm keymaps


# -------------------------------------------------------------------------PRODUCT_PACKAGES := \
hkc1xx-keypad.kcm

a
.h

# -------------------------------------------------------------------------# These are the hardware-specific configuration files


# -------------------------------------------------------------------------PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/conf/init.rc:root/init.rc \
$(LOCAL_PATH)/conf/vold.fstab:system/etc/vold.fstab

w
w
w

device.mk - 2

m
o

# -------------------------------------------------------------------------# WIFI firmware


# -------------------------------------------------------------------------PRODUCT_COPY_FILES += \
device/hardkernel/proprietary/bin/fw_bcm4329.bin:system/etc/firmware/fw_bcm4329.bin \
device/hardkernel/proprietary/bin/nvram:system/etc/firmware/nvram \
device/hardkernel/proprietary/bin/bcm4329_e4.ko:system/lib/modules/bcm4329.ko \
device/hardkernel/proprietary/bin/bcm4329.hcd:system/etc/firmware/bcm4329.hcd

c
.
l
e

n
r
e
k
rd

# -------------------------------------------------------------------------# Init files


# -------------------------------------------------------------------------PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/conf/init.product.rc:root/init.odroide4.rc \
$(LOCAL_PATH)/conf/ueventd.product.rc:root/ueventd.odroide4.rc

w
w
w

a
.h

vold.fstab lib

vold.fstab
#######################
## Regular device mount
##
## Format: dev_mount <label> <mount_point> <part> <sysfs_path1...>
## label
- Label for the volume
## mount_point - Where the volume will be mounted
## part
- Partition # (1 based), or 'auto' for first usable partition.
## <sysfs_path> - List of sysfs paths to source devices
######################

n
r
e
k
rd

c
.
l
e

dev_mount sdcard /mnt/sdcard auto /devices/platform/s3c-sdhci.1/mmc_host/mmc1

WiFi / Bluetooth

w
w
w




a
.h

hardware/libhardware_legacy/wifi/wifi.c
system/bluetooth/bluedroid/bluetooth.c

Sensor / Carmera library





device/hardkernel/proprietary/libsensor/
device/hardkernel/proprietary/libcameraE4/

m
o

Android Build


m
o

make clean

c
.
l
e

object .

Android system build(build_android.sh )






/device/hardkernel/odroide4/build_android.sh Android root soft-link .


ln s ./device/hardkernel/odroide4/build_android.sh ./odroide4_build.sh
Android build, ramdisk-uboot.img .
System ramdisk file $PRODUCT_-img(odroide4-img) folder .

w
w
w

a
.h

n
r
e
k
rd

Android Fusing
 Android system file


sudo umount /dev/sdb*


sudo mkfs.ext4 /dev/sdb2

 all partition unmount


 system partition

n
r
e
k
rd

sudo mount /dev/sdb2 /media/sd


sudo cp a ./odroide4-img/system/* /media/sd
sudo umount /dev/sdb2

m
o

c
.
l
e

Host PC (T-Flash Reader):

a
.h

 Android ramdisk-uboot.img


Host PC (uboot fastboot) :

w
w
w

sudo fastboot flash ramdisk ramdisk-uboot.img

Host PC (T-Flash Reader) :


sudo dd iflag=dsync oflag=dsync if=./ramdisk-uboot.img of=/dev/sdb seek=9281

Android Booting

c
.
l
e

m
o

w
w
w

n
r
e
k
rd

a
.h

 Q&A


www.hardkernel.com .

m
o

c
.
l
e

w
w
w

n
r
e
k
rd

a
.h

n
r
e
k
rd

 WinCE Display Driver

m
o

c
.
l
e

 WinCE 6.0 Build

 Uboot Multi-Boot (/WinCE)

w
w
w

a
.h

Build tool BSP













m
o

ODROID-E(S5P6450) WinCE 6.0

Microsoft Visual Studio 2005


Microsoft Visual Studio 2005 Service Pack 1
Microsoft Windows Embedded CE 6.0 Platform builder
Microsoft Windows Embedded CE 6.0 Platform builder Service Pack 1
Microsoft Windows Embedded CE 6.0 R2
Microsoft Windows Embedded CE 6.0 R3
Microsoft Windows Embedded CE 6.0 Cumulative Product Update Rollup Package(2010/12/31)
Latest Microsoft Windows Embedded CE 6.0 Monthly Update(Recommended)

c
.
l
e

a
.h

BSP(SMDK6450_BSP)



BSP Copy
%WINCEROOT%\PLATFORM\SMDK6450
%WINCEROOT%\PLATFORM\COMMON

w
w
w

n
r
e
k
rd

ODROIDODROID-E OS Design -1




File -> New -> Project


Project Name ODROIDE
OK

w
w
w

a
.h

n
r
e
k
rd

c
.
l
e

m
o

ODROIDODROID-E OS Design -2


m
o

Board Support Packages (SMDK6450 )

c
.
l
e

w
w
w

a
.h

n
r
e
k
rd

ODROIDODROID-E OS Design -3


m
o

Design Templete (PDA Device)

c
.
l
e

w
w
w

a
.h

n
r
e
k
rd

ODROIDODROID-E OS Design -4


m
o

Design Templete (Mobile Handheld)

c
.
l
e

w
w
w

a
.h

n
r
e
k
rd

ODROIDODROID-E OS Design -5


m
o

Applications Media feature (Internet Explorer 6.0, Windows Media Audio/MP3)

c
.
l
e

w
w
w

a
.h

n
r
e
k
rd

ODROIDODROID-E OS Design -6



m
o

ODROIDE OS Design Visual Studio Solution Explorer .


Build Option Release .

c
.
l
e

w
w
w

a
.h

n
r
e
k
rd

Public Component -1


m
o

Catalog Item View (Core OS->CEBASE->File Systems and Data Store)

c
.
l
e

w
w
w

a
.h

n
r
e
k
rd

Public Component -2


m
o

Catalog Item View (Core OS->CEBASE->Graphics and Multimedia Technologies)

c
.
l
e

w
w
w

a
.h

n
r
e
k
rd

Public Component -3


m
o

Catalog Item View (Core OS->Device Drivers)

c
.
l
e

w
w
w

a
.h

n
r
e
k
rd

Public Component -4


m
o

Catalog Item View (Core OS->CEBASE->Applications and Services Development)

c
.
l
e

w
w
w

a
.h

n
r
e
k
rd

Project Build OptionOption-1






Visual Studio->Project->ODROIDE Properties...


ODROIDE Property Pages -> Configuration Properties -> Locale
Clear All -> ()

c
.
l
e

m
o

w
w
w

a
.h

n
r
e
k
rd

Project Build OptionOption-2






Visual Studio->Project->ODROIDE Properties...


ODROIDE Property Pages -> Configuration Properties -> Build Options
Enable KITL (no IMGNOKITL=1)

c
.
l
e

m
o

w
w
w

a
.h

n
r
e
k
rd

Build Solution



Visual Studio->File->Save All


Visual Studio->Build->Build solution

w
w
w

a
.h

n
r
e
k
rd

c
.
l
e

m
o

ODROIDODROID-E H/W
ODROIDODROID-E Hardware

XOSCSEL

Frequency select

n
r
e
k
rd
0
1

XFXTSEL

XOSCSEL

UART2

S5P6450
DRAM
Controller

w
w
w
SD/MMC
Controller

iROM(BL0)
(64KB)

OM[3:0] = iROM
Boot

XFXTSEL

a
.h

NAND Controller

GPN[15:13] :
Booting
Device selection

DEBUG
Serial
Port

Oscillator pad select

SYS OSC(XXTO, XXTI)

USB OSC(XUSBXTI, XUSBXTO)

Clock source frequency select

12 Mhz
19.2 Mhz

OM[3:0
]

GPN[15:13
]

Booting Mode

Boot Device

DDR
256MB

Boot
Device

m
o

c
.
l
e

Oscillator pad select

0_111

000

SD/MMC(CH1 44-bit mode)

001

eMMC4.3(CH1 44-bit mode)

010

eMMC4.4(CH3 44-bit mode)

011

iROM

Reserved

100

Reserved

101

512B/Page, 88-bit ECC

110

Over 2KB/Page, 2424-bit ECC(2K,4K,8K)

111

Over 4KB/Page, 4848-bit ECC(4K,8K)

DEBUG Port

Memory

UART2

DDR (256MB)

WinCE Source Tree

m
o

WINCE600\
WINCE600\PLATFORM\
PLATFORM\

COMMON\

c
.
l
e
rn

SMDK6450\

BSP Catalog Item


files

SRC\

SRC\SOC\

Architecture
SOC HW

w
w
w

OAL

CATALOG\

config.bib *.bib files


platform.reg *.reg files
dll files

S5P6450_SEC_V1

OAL\

e
k
rd

FILES\

a
.h

BOOTLOADER\

COMMON\

Booting Device
EBOOT

CESYSGEN\ - Build process Makefile

DRIVERS\
Public Driver

USB Driver
Download Tool
JTAG Script file

SDK\

ETC\

MPVD Driver
(Multi Purpose Video Decoder)

INC\

BSP Include file

KITL\

KITL

ODROIDODROID-E HW Clock, MEM config

\PLATFORM\COMMON\SRC\SOC\S5P6450_SEC_V1\OAL\INC\soc_cfg.h file

#define TARGET_CLK
CLK_800_166MHz

//#define TARGET_CLK
CLK_667_166MHz

//#define TARGET_CLK
CLK_533_133MHz

\PLATFORM\COMMON\SRC\SOC\S5P6450_SEC_V1\OAL\INC\S5P6450.inc file

TARGET_CLK
SETA CLK_800_166MHz

;TARGET_CLK
SETA CLK_667_166MHz

;TARGET_CLK
SETA CLK_533_133MHz

w
w
w

m
o

c
.
l
e

ODROID-E(S5P6450) Clock configuration

n
r
e
k
rd

a
.h

ODROID-E(S5P6450) MEM configuration




\PLATFORM\COMMON\SRC\SOC\S5P6450_SEC_V1\OAL\INC\soc_cfg.h file

#define DRAM_TYPE
LPDDR

//#define DRAM_TYPE
DDR2

\PLATFORM\COMMON\SRC\SOC\S5P6450_SEC_V1\OAL\INC\S5P6450.inc file

DRAM_TYPE
SETA LPDDR

;DRAM_TYPE
SETA DDR2

Debug Port, Booting device

\PLATFORM\SMDK6450\SMDK6450.bat file

@REM set BSP_DEBUGPORT=SERIAL_UART0

@REM set BSP_DEBUGPORT=SERIAL_UART1

set BSP_DEBUGPORT=SERIAL_UART2

@REM set BSP_DEBUGPORT=SERIAL_UART3

n
r
e
k
rd

\PLATFORM\SMDK6450\SRC\Inc\bsp_cfg.h

#define DEBUG_UART3 (3)

#define DEBUG_BAUDRATE (115200)

w
w
w

a
.h

ODROID-E(S5P6450) Booting Device Init (SD_BOOT, HSMMC1)




\PLATFORM\SMDK6450\SMDK6450.bat file

set BOOTLOADER_OPTION=SDBOOT





set
set
set
set

BSP_NONANDFS=1
BSP_NOHSMMC_CH0=1
BSP_NOHSMMC_CH1=
BSP_NOHSMMC_CH3=1

m
o

c
.
l
e

ODROID-E(S5P6450) Debug Serial init

ODROIDODROID-E HW

\PLATFORM\SMDK6450\SMDK6450.bat file

set BSP_NOI2C=

set BSP_NOSPI=1







m
o

c
.
l
e

ODROID-E(S5P6450) HW

n
r
e
k
rd

@REM ----- CAMERAFILTER Device Driver Configuration ------------@REM CAMERA FILTER/I2C Device Driver
set BSP_NOCAMERA=1

a
.h

@REM ----- GPS Driver Configuration ------------set BSP_NOGPS=1

w
w
w

ODROIDODROID-E Display Driver

ODROIDODROID-E Display HW Interface

c
.
l
e

n
r
e
k
rd

LCD I/F

S5P6450

w
w
w




a
.h

Backlight Driver
LCD Controller Init
LCD I/F Timing

SPI

PWM_1

m
o

Backlight
HW Driver

LCD I/F

LCD 480X800(WVGA)
(LMS397KF04)

Backlight

ODROIDODROID-E Backlight driver

\PLATFORM\SMDK6450\SRC\DRIVERS\BACKLIGHT\PDD\backlight_pdd.cpp file

PWM_1 Driver PWM_0

void BL_InitPWM() function
GPF14 pin_function PWM_0
- Timer0


n
r
e
k
rd

void BL_Set(BOOL bOn) function


PWM_0 On/Off
- HW Backlight driver enable/disable

w
w
w


m
o

c
.
l
e

ODROID-E(S5P6450) LCD Backlight driver

a
.h

void BL_SetBrightness(DWORD dwValue)


PWM_0 Frequency (Timer0 )
- PWM_0 Duty_rate

DWORD BacklightInit(LPCTSTR pContext, LPCVOID lpvBusContext, CEDEVICE_POWER_STATE


*pDeviceState)
- GPF14 Pull-up/down disabled

ODROIDODROID-E LCD driver -1




ODROID-E(S5P6450) LCD LMS397KF04 define










n
r
e
k
rd

#elif (SMDK6450_LCD_MODULE == LCD_MODULE_LMS397KF04)


#define LCD_WIDTH
480
#define LCD_HEIGHT
800
#define LCD_BPP
32 // rgb888 XRGB
#define LCD_TYPE
LCD_TYPE_PORTRAIT

a
.h

\PLATFORM\SMDK6450\SRC\DRIVERS\DISPLAY\INC\ldi.h file

typedef enum
{
LDI_LTE480WV_RGB,
// 4.8" WVGA 800*480 in SMDK6450
LDI_LMS397KF04_RGB,
// 3.97" WVGA 480*800 in ODROIDE
LDI_HT101HD1_RGB,
// 1376*768 in SMDK6450

w
w
w






static
static
static
static

void LDI_LMS397KF04_RGB_port_initialize(void);
LDI_ERROR LDI_LMS397KF04_RGB_power_on(void);
LDI_ERROR LDI_LMS397KF04_RGB_power_off(void);
LDI_ERROR LDI_LMS397KF04_RGB_initialize(void);

m
o

c
.
l
e

\PLATFORM\SMDK6450\SRC\INC\bsp_cfg.h file

#define LCD_MODULE_LTP700
(8) // Landscape 7" WVGA RGB24

#define LCD_MODULE_LMS397KF04 (9) // Portrait 3.97" WVGA RGB24

//#define SMDK6450_LCD_MODULE (LCD_MODULE_LTE480)

#define SMDK6450_LCD_MODULE (LCD_MODULE_LMS397KF04)

ODROIDODROID-E LCD driver -2

ODROID-E(S5P6450) LCD LMS397KF04 define






n
r
e
k
rd

\PLATFORM\SMDK6450\SRC\DRIVERS\DISPLAY\DISPLAY_DRV\display_main.cpp file

PMIC LDO(VDD_LCD) Enable

#if (SMDK6450_LCD_MODULE == LCD_MODULE_LTE480)
LDI_set_LCD_module_type(LDI_LTE480WV_RGB);

#elif (SMDK6450_LCD_MODULE == LCD_MODULE_LMS397KF04)
LDI_set_LCD_module_type(LDI_LMS397KF04_RGB);

w
w
w

c
.
l
e

m
o

\PLATFORM\SMDK6450\SRC\DRIVERS\DISPLAY\DISPLAY_DRV\sources file
\PLATFORM\SMDK6450\SRC\DRIVERS\DISPLAY\DISPLAY_DRV\i2c_pmic.h file add
\PLATFORM\SMDK6450\SRC\DRIVERS\DISPLAY\DISPLAY_DRV\i2c_pmic.cpp file add

PMIC(RN5T614) LDO(VDD_LCD) I2C Interface add

a
.h

\PLATFORM\SMDK6450\SRC\DRIVERS\DISPLAY\LDI_LIB\LDI\ldi.c file

SPI interface function add (GPIO Bit-Bang)

LCD
- static void LDI_LMS397KF04_RGB_port_initialize(void);
- static LDI_ERROR LDI_LMS397KF04_RGB_power_on(void);
- static LDI_ERROR LDI_LMS397KF04_RGB_power_off(void);
- static LDI_ERROR LDI_LMS397KF04_RGB_initialize(void);

LCD Interface Timing
- case LDI_LTE480WV_RGB:
- case LDI_LMS397KF04_RGB

Build OS Image & config.bib

Visual Studio->File->Save All


Visual Studio->Build->Build solution

New OS Image NK.NB0 Start Address

n
r
e
k
rd

\PLATFORM\SMDK6450\FILES\config.bib

#define NKSTART
80100000

#define NKLEN
01F00000 ; 31 MB


a
.h

CONFIG
ROMSTART = $(NKSTART)
ROMSIZE = $(NKLEN)

w
w
w

c
.
l
e

NK.NB0 Load Address 8010_0000

\PLATFORM\SMDK6450\SRC\INC\oemaddrtab_cfg.inc
g_oalAddressTable
DCD
0x80000000, 0x20000000, 128
; 128 MB DRAM

NK.NB0 Load Virtual Address 2010_0000

m
o

Download OS Image & Run




Target

w
w
w

m
o

c
.
l
e

Booting on Uboot
- dnw [Load address]

a
.h

n
r
e
k
rd

Download OS Image & Run




Host PC USB NK.NB0








c
.
l
e

m
o

USB : PLATFORM\SMDK6450\ETC\SMDK6450 USB Driver


PLATFORM\SMDK6450\ETC\DNW v0.60C\dnw.exe
USB NK.NB0 download
Dnw.exe->USB_Port->Transmit->Transmit -> File open dialog -> NK.NB0
NK.NB0 : OSDesigns\ODROID\ODROID\RelDir\SMDK6450_ARMV4I_Release\NK.NB0

w
w
w

a
.h

n
r
e
k
rd

Target
go 20100000
- WinCE OS Image Booting

WinCE OS Image Fusing

ST.
Sector

n
r
e
k
rd

Partition Name

User Data (VFAT)


CACHE (Ext4)

Normal
Partition

DATA (Ext4)

a
.h

SYSTEM (Ext4)

Size

256MB

ODROID-E
WinCE OS Image
(Size 32MB)

512MB
256MB

79313

Reserved

13377

WinCE OS Image

9281

Ramdisk

2MB

1089

Kernel

4MB

65

BL2

512KB

33

UBOOT config

16KB

BL1

16KB

MBR

512B

w
w
w

Lowlevel
Partition
(10MB)

m
o

c
.
l
e

T-Flash Memory Map

32MB




T-Flash raw-Image
Movi R/W command
Filesystem MBR
Bootcmd, ext_env
Multi-Boot

T-Flash Raw Image

T-Flash raw-image
$uboot$/include/movi.h file

#define PART_SIZE_WINCE (32 * 1024 * 1024)

$uboot$/common/cmd_movi.c file

int init_raw_area_table (block_dev_desc_t * dev_desc)
- wince 32MB

int do_movi(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
- movi write wince command
- mmc raw area write command

T-Flash Filesystem partition table




n
r
e
k
rd

a
.h

m
o

c
.
l
e

$uboot$/common/cmd_mmc_fdisk.c

Filesystem block start address : 0 64MB

w
w
w

Bootcmd , EXT_ENV


$uboot$/include/configs/smdk6450.h

dnw_ce : dnw 20100000;movi write wince 20100000

Android_boot : movi read kernel 20008000;movi read rootfs 20A00000 200000;bootm
20008000
20A00000

wince_boot : movi read wince 20100000;go 20100000

wince_dl : dnw 20100000;go 20100000

T-Flash Fusing & Standalone boot








Target Uboot Booting -> dnw 20100000


Host PC - dnw.exe NK.NB0

w
w
w

n
r
e
k
rd

c
.
l
e

a
.h

Target movi write wince 20100000


Target run wince_boot (EXT_ARGS)

m
o

Multi Boot

ODROID-E VolumeUp Key Multi-Boot

c
.
l
e

m
o

$uboot$/board/samsung/smdk6450/smdk6450.c file
/* --------------------------------------------------------- */
#define GPNCON (*(unsigned long *)(ELFIN_GPIO_BASE + GPNCON_OFFSET))
#define GPNDAT
(*(unsigned long *)(ELFIN_GPIO_BASE + GPNDAT_OFFSET))
#define GPNPUD
(*(unsigned long *)(ELFIN_GPIO_BASE + GPNPUD_OFFSET))

void check_bootmode(void)
{
char
run_cmd[100];
unsigned long data=0;

n
r
e
k
rd

a
.h

GPNCON = (GPNCON & ~(0x3<<2*0))|(0x0<<2*0); // GPN(0) Input config


GPNPUD = (GPNPUD & ~(0x3<<2*0))|(0x1<<2*0);
// GPN(0) Pull-Down
data = GPNDAT;

w
w
w

if((data>>0 & 0x1)){


memset(run_cmd, 0x00, sizeof(run_cmd));
sprintf(run_cmd, "run wince_boot");
run_command(run_cmd, 0);
}

}


int board_late_init(void) check_bootmode() call

m
o

c
.
l
e

w
w
w

n
r
e
k
rd

a
.h

c
.
l
e

n
r
e
k
rd

 framework

a
.h

m
o

 APP Touch-to-focus

w
w
w

Camera Module

m
o

c
.
l
e

 s5k5aafa

a
.h

1.3MPixel
 1280x1024
 Max 15 fpx @ SXGA


w
w
w

n
r
e
k
rd

 s5k5cagx

 s5k4eagx

 3MPixel

 5MPixel

 2048x1536

 2592x1944

 Full @15fps,

 Full @15fps

 VGA @30fps

 MIPI CSI2(dual lane)

 MIPI CSI2(single lane)

 JPEG

 JPEG

CMOS Image Sensor Block Diagram

m
o

c
.
l
e
rn

Image

w
w
w

AF
Module

e
k
rd

a
.h

I2C

Image
Data

Mclk

Exynos4210 Camera I/F

c
.
l
e

m
o

w
w
w

* Parallel(CCIR)
Parallel(CCIR) 2 port
* MIPI 2 port
(2 Lane, 4 Lane)

a
.h

n
r
e
k
rd

Camera Module Connector

m
o

c
.
l
e

w
w
w

a
.h

n
r
e
k
rd

Front

Rear

PCB Signal Routing


 ODROID-A Camera Signal line.

c
.
l
e
rn

CPU Module
Connector

w
w
w

e
k
rd

a
.h

No Skew data line!!

m
o

3M Rear
Cam

1.3M Front
Cam

Device Driver CIS(CMOS Image Sensor)


 driver/media/video/s5k5cagx.c, s5k5cagx.h


Camera Initialize  s5k5cagx_init()...


 internal clock setting
 firmware patch




Setting : output format, frame size, effects, iso,af,


focus management
Mode change: capture or streaming

w
w
w


n
r
e
I2C
k
rd

Camera setup


a
.h

V4L2 interface (ioctl)









c
.
l
e

VIDIOC_G_CTRL  s5k5cagx_g_ctr()
VIDIOC_S_CTRL  s5k5cagx_s_ctr()
VIDIOC_S_FMT  s5k5cagx_s_fmt()
VIDIOC_G_PARM  s5k5cagx_g_parm()
VIDIOC_S_PARM  s5k5cagx_s_parm()
...

m
o

Device Driver FIMC


 driver/media/video/samsung/fimc








V4L2 interface.
V4L2 device-subdev registration.
kernel/driver/media/video/v4l2*


Mclk, Camera Power On/Off
v4l2_subdev_call()  s5k5cagx_init()

w
w
w


fimc_output.c




size,rotation, format

fimc_overlay.c


a
.h

fimc_capture.c


n
r
e
k
rd

fimc_v4l2.c


video node (/dev/video0)


V4L2 interface

LCD

fimc_regs.c


H/W register control

m
o

c
.
l
e

fimc_dev.c

/dev/video0

FIMC

(Fully Interactive Mobile Camera


Interface )

Post Processor, Scaler, Rotator,


input/output DMA Driver

Device Driver FIMC block diagram

Fimc_Overlay

n
r
e
k
rd

open(/dev/video0)
V4L2
User App
or
Android

YUV422sp, Jpeg

w
w
w

a
.h

Fimc_Output

Scaler
Rotator
ColorSpace Conversion

YUV,RGB,JPEG,RAW

Fimc_Capture
V4L2
/dev/video0

m
o

c
.
l
e

RGB32

Cam

LCD
(dev/fb0)

Device Driver ODROID-A Platform


static struct i2c_board_info s5k5cagx_i2c_info = {
I2C_BOARD_INFO("S5K5CAGX", 0x3c),
.platform_data = &s5k5cagx_plat,
};
static struct s3c_platform_camera s5k5cagx = {
.id
= CAMERA_PAR_A,
.type
= CAM_TYPE_ITU,
fmt
= ITU_601_YCBCR422_8BIT,
.order422 = CAM_ORDER422_8BIT_YCBYCR,
.i2c_busnum = 1,
.info
= &s5k5cagx_i2c_info,
.pixelformat= V4L2_PIX_FMT_YUYV,
.srclk_name = "xusbxti",
.clk_name = "sclk_cam0",
.clk_rate
= 24000000,
.line_length = 480,
.width
= 640,
.height
= 480,
.window
={
.left = 0,
.top = 0,
.width = 640,
.height = 480,
},
/* Polarity */
.inv_pclk
= 0,
.inv_vsync = 1,
.inv_href
= 0,
.inv_hsync = 0,
.initialized = 0,
.cam_power = hkdkc210_cam0_power,
};

w
w
w

m
o

c
.
l
e

 Name, I2c address and bus number


 MClk  24Mhz

a
.h

n
r
e
k
rd


clock source(clock.c)

 Power On/Off

 RESET, STBYn

void cam0_s5k5cagx_reset(int power_up){...}


static int hkdkc210_cam0_power(int onoff){...}
/* Interface setting */
static struct s3c_platform_fimc fimc_plat = {
.default_cam = CAMERA_PAR_A,
.camera = {
s5k5cagx, // rear cam
&s5k5cagx
s5k5cagx
&s5k5aafa,
// front cam
},
.hw_ver = 0x51,
};

arch/arm/mach-s5pv310/mach-hkdkc210.c

V4L2 Interface
 fbcam.c, capture.c(http://v4l2spec.bytesex.org)

 V4L2 interface . ex) ret = ioctl(fp, VIDIOC_QUERYCAP, &cap);

n
r
e
k
rd

open(/dev/video0)
VIDIOC_QUERYCAP
VIDIOC_S_FMT

a
.h

VIDIOC_REQBUFS

VIDIOC_QUERYBUF

w
w
w


ON

OFF

VIDIOC_QBUF

Query device capabilities

V4L2_CAP_VIDEO_CAPTURE
V4L2_CAP_VIDEO_OUTPUT
V4L2_CAP_VIDEO_OVERLAY
V4L2_CAP_STREAMING

Width, Height, pixel format setting

VIDIOC_QBUF

VIDIOC_STREAMON
VIDIOC_DQBUF

VIDIOC_DQBUF

VIDIOC_STREAMOFF

close()

m
o

c
.
l
e

 LCD frame buffer

Exchange a
buffer with
the driver

Android Proprietary Camera Library

m
o

 android/frameworks/base/services/camera/libcameraservice
Reference codes
 Emulator : FakeCamera.cpp

c
.
l
e

n
r
e
k
rd

a
.h

Porting

 android/device/hardkernel/proprietary/libcamera

w
w
w

SecCameraHWInterface.cpp
 SecCameraHWInterface.h
 SecCamera.cpp
 SecCamera.h


open(/dev/video0)

libcamera.so

Android Camera Framework

m
o

c
.
l
e
rn

JNI

(Java Native Interface)

w
w
w

a
.h

e
k
rd

open()
close()
getCameraInfo()
setParameters()
TakePicture()
startPreview()
stopPreview()
...

Touch-to-focus?

m
o

 APP Preview Touch Focus .

n
r
e
k
rd

Focus X,Y

w
w
w

Touch event

JAVA Apps

c
.
l
e

a
.h

Libraries

CIS
Device Driver

Linux Kernel

Touch2Focus Parameters

m
o

 android/frameworks/base/core/java/android/hardware/Camera.java



Class Camera.Parameters
public class Parameters {
// Parameter keys to communicate with the camera driver.
private static final String KEY_PREVIEW_SIZE = "preview-size";
private static final String KEY_PREVIEW_FORMAT = "preview-format";
private static final String KEY_PREVIEW_FRAME_RATE = "preview-frame-rate";
...
private static final String KEY_FOCUS_LOCATION = "focus-location";
}

n
r
e
k
rd

c
.
l
e

a
.h

 android/frameworks/base/libs/camera/CameraParameters.cpp


namespace android {
// Parameter keys to communicate between camera application and driver.
const char CameraParameters::KEY_PREVIEW_SIZE[] = "preview-size";
const char CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES[] = "preview-size-values";
const char CameraParameters::KEY_PREVIEW_FORMAT[] = "preview-format";
const char CameraParameters::KEY_PREVIEW_FRAME_RATE[] = "preview-frame-rate";
...
const char CameraParameters::KEY_FOCUS_LOCATION[] = "focus-location";
}

w
w
w

$ make update-api

Touch2Focus Camera APP (JAVA)

m
o

 android/packages/apps/Camera/
android/packages/apps/Camera/src/com/android/camera/Camera.java
src/com/android/camera/Camera.java

c
.
l
e

private int touch_old_x;


private int touch_old_y;
@Override
public boolean onTouchEvent(MotionEvent event) {
int touchX = (int) event.getX(); // touch
int touchY = (int) event.getY();

n
r
e
k
rd

if((touch_old_x - touchX > 50) || (touch_old_x - touchX < -50)||


(touch_old_y - touchY > 50) || (touch_old_y - touchY < -50) ) {
touch_old_x=touchX;
touch_old_y=touchY;

100,200

a
.h

Camera.java
Parameters

SecCameraHWInterface.cpp
SecCamera.cpp

mParameters.setFocusLocation(touchX+","+ touchY);
mCameraDevice.setParameters(mParameters);

w
w
w

Log.v(TAG,"touch "+touchX + ", "+ touchY );

return true;
}

S5k5cagx.c

 android/frameworks/base/core/java/android/hardware/Camera.java
public void setFocusLocation(String value) {
set(KEY_FOCUS_LOCATION, value);
}

Parameter

Touch2Focus - Android Proprietary(C++)




m
o

android/device/hardkernel/proprietary/libcamera/SecCameraHWInterface.cpp

int CameraHardwareSec::get_focus_location(const CameraParameters& params){


int fx,fy;
Parameter
fx = fy = -1;

// Get the current string, if it doesn't exist, leave the -1x-1

c
.
l
e

n
r
e
k
rd

const char *p = params.get(CameraParameters::KEY_FOCUS_LOCATION);


if (p == 0) return -1;
parse_pair(p, &fx, &fy, ',');
mSecCamera->setFocusLocation(fx,fy);
return 0;

Camera.java

Parameters

a
.h

SecCameraHWInterface.cpp

SecCamera.cpp

android/device/hardkernel/proprietary/libcamera/SecCamera.cpp
int SecCamera::setFocusLocation(int lx, int ly){
int ret;
unsigned int val;
val = lx<<16 | ly;

w
w
w

V4L2 call
Device Driver

ret = fimc_v4l2_s_ctrl(m_cam_fd,
V4L2_CID_CAM_FOCUS_LOCATION, val);
fimc_v4l2_s_ctrl
return 0;

}
static int fimc_v4l2_s_ctrl (int fp, unsigned int id, unsigned int value)
{ ...
ctrl.value = value;
Kernel V4L2
ret = ioctl(fp, VIDIOC_S_CTRL, &ctrl);

Touch2Focus V4L2 (Kernel)

m
o

kernel/media/video/v4l2-ioctl.c

c
.
l
e

static long __video_do_ioctl(struct file *file, unsigned int cmd, void *arg) {
...
case VIDIOC_S_CTRL:
if (ops->vidioc_s_ctrl) {

n
r
e
k
rd

ret = ops->vidioc_s_ctrl(file, fh, p);


break;
}

kernel/media/video/samsung/fimc/fimc_v4l2.c

V4L2

static int fimc_s_ctrl(struct file *filp, void *fh, struct v4l2_control *c) {
if (ctrl->cap != NULL) {

a
.h

ret = fimc_s_ctrl_capture(ctrl, c);


} ...

w
w
w

kernel/media/video/samsung/fimc/fimc_capture.c

int fimc_s_ctrl_capture(void *fh, struct v4l2_control *c){


switch (c->id) { ...
default:

if (FIMC2 != ctrl->id)

ret = subdev_call(ctrl, core, s_ctrl, c);

break;
}
return ret;
}

subdev_call()
subdev_call()

S5k5cagx.c

Touch2Focus CIS Device driver

m
o

 Kernel/drivers\media\video /S5k5cagx.c

c
.
l
e

static int s5k5cagx_s_ctrl


s5k5cagx_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
...
switch (ctrl->id) {
case V4L2_CID_CAM_FOCUS_LOCATION:
CIS Write
int x1= ctrl->value >> 16;
int y1= ctrl->value & 0xffff
err=s5k5cagx_set_focus_location(sd,x1,x2); // set focus position to CIS
err=s5k5cagx_write_array(sd,
s5k5cagx_regs_focus[1],S5K5CAGX_FOCUS); // Change Mode to focus fixed
break;
...
}
...
}

w
w
w

a
.h

n
r
e
k
rd

static const struct v4l2_subdev_core_ops s5k5cagx_core_ops =


{
.init = s5k5cagx_init, /* initializing API */
.s_config = s5k5cagx_s_config,/* Fetch platform data */
.queryctrl = s5k5cagx_queryctrl,
.querymenu = s5k5cagx_querymenu,
.g_ctrl = s5k5cagx_g_ctrl,
.s_ctrl
s_ctrl = s5k5cagx_s_ctrl,
};

Camera.java

SecCameraHWInterface.cpp
SecCamera.cpp

S5k5cagx.c

m
o

c
.
l
e

w
w
w

n
r
e
k
rd

a
.h

m
o

c
.
l
e

11.10(Beta 2)
- ()
- rootstock command
- fdisk &
- wifi
- booting

a
.h

n
r
e
k
rd

WWW Service APM(Apache, Php, Mysql)

WWW Service

w
w
w


1. 11.10(Beta 2)

m
o

c
.
l
e

-
: uboot  Kernel  Ubuntu(Root File System)

n
r
e
k
rd

1) uboot : kernel
.

a
.h

uboot T-Flash Card (MBR) ,


uboot .

w
w
w

-() :
()
.

m
o

2) kernel : , , OS .
(2.6.35.7) VFAT /boot .
3) ubuntu(rootfs) : Root File System(EXT4)

c
.
l
e

n
r
e
k
rd

root file system /sbin/init (Process) [kthreadd]


. /sbin/init PID 1, [kthreadd] PID 2 ,
. fork() exec() system call kernel_thread()
daemonize() .
$ ps -ef

a
.h

UID PID PPID C STIME TTY


root

root

root

360

root
root

TIME

CMD

0 0

13:20

00:00:01

/sbin/init

0 0

13:20

00:00:00

[kthreadd]

1 0

13:20

00:00:00

udevd --daemon

586

360 0

13:20

00:00:00

udevd --daemon

791

2 0

13:20

00:00:00

[hd-audio0]

w
w
w

(11.10 oneiric beta2) .

kernel

w
w
w

n
r
e
k
rd

a
.h

m
o

c
.
l
e

uboot

rootstock command

m
o

- rootstock command(shell script)

c
.
l
e

: PC(Host system) rootstock ubuntu armel(ARM


Architecture) root file system .

n
r
e
k
rd

$ sudo rootstock --fqdn


--fqdn odroid --imagesize
--imagesize 4G --dist
--dist oneiric --login
--login
odroid --password
--password odroid --seed
--seed wget,nano,linuxwget,nano,linux-firmware,wirelessfirmware,wirelesstools,usbutils,btrfstools,usbutils,btrfs-tools,i2ctools,i2c-tools,wpasupplicant --components
--components "main universe
multiverse
multiverse
: Option

a
.h

--fqdn
--fqdn : Target system Hostname(/etc/hostname) odroid
.
.

--imagesize
--imagesize : Target filesystem

w
w
w

--dist
--dist : apt(Advanced Package Tool) source release version.
--login
--login : Login ID

--password
--password :

--seed
--seed :
--components(The
--components(The repository components are) :
Main - Officially supported software.

Restricted - Supported software that is not available under a completely free


free

license.
Universe - Community maintained software, i.e. not officially supported
software.

fdisk
- fdisk

w
w
w

n
r
e
k
rd

a
.h

$ sudo mkfs.vfat /dev/sdc2 n vfat


$ sudo mkswap /dev/sdc3
$ sudo mkfs.ext4 /dev/sdc4 L rootfs

m
o

c
.
l
e

: T-flash partition

Root file system


- root file system

w
w
w

a
.h

n
r
e
k
rd

c
.
l
e

m
o

Wifi - 1
- Network : wifi

m
o

c
.
l
e

: bcm4329 wireless lan power on


.  Wi-Fi on

n
r
e
k
rd

, .

kernel wifi on .

w
w
w

a
.h

[$KERNEL/arch/arm/mach-s5pv310/hkc1xx-sysfs.c]

Wifi - 2

m
o

c
.
l
e

$ sudo mkdir -p /system/etc/firmware

==> copy fw_bcm4329.bin, nvram files into /system/etc/firmware directory.

n
r
e
k
rd

$ sudo mkdir /lib/modules/2.6.35.7/kernel/lib

==> copy bcm4329.ko file into /lib/modules/2.6.35.7/kernel/lib/ directory.


$ sudo vi /lib/modules/2.6.35.7/modules.dep

a
.h

---------------------------------------kernel/lib/bcm4329.ko: <--<--- Add this line and save.

w
w
w

---------------------------------------$ sudo vi /etc/modules

---------------------------------------bcm4329 <--<--- Add this line and save.


---------------------------------------$ sudo vi /etc/network/interfaces

Wifi - 3
auto lo

auto eth0

n
r
e
k
rd

iface eth0 inet dhcp

address 192.168.0.204 <--<--- AP IP ADDRESS(static)


ADDRESS(static)
gateway 192.168.0.1
dnsdns-nameserver 192.168.0.1
netmask 255.255.255.0
wpawpa-driver wext

m
o

c
.
l
e

iface lo inet loopback

a
.h

wpawpa-ssid hardkernel2 <--<--- Your SSID

w
w
w

wpawpa-apap-scan 2
wpawpa-proto RSN

wpawpa-pairwise CCMP
wpawpa-group CCMP

wpawpa-keykey-mgmt WPAWPA-PSK
wpawpa-psk 81b2ae31a8dede0e05e446fbf6a243c71f865909c349bba1ecdca996e5e0417e
81b2ae31a8dede0e05e446fbf6a243c71f865909c349bba1ecdca996e5e0417e <--<--your WPA hex_key

Wifi - 4
: How to make a WPAWPA-PSK key.
network={

n
r
e
k
rd

Ssid="test
Ssid="test
="test
#psk="12345678
psk="12345678
="12345678

m
o

c
.
l
e

$ wpa_passphrase <your_essid><
your_essid><your_ascii_key
><your_ascii_key>
your_ascii_key>

psk=fe727aa8b64ac9b3f54c72432da14faed933ea511ecab1
5bbc6c52e7522f709a
9a
psk=fe727aa8b64ac9b3f54c72432da14faed933ea511ecab1 5bbc6c52e7522f70
<--- Copy this to wpawpa-psk !

w
w
w

a
.h

Booting - 1
- Booting

w
w
w

c
.
l
e

m
o

a
.h

n
r
e
k
rd

Booting - 2

w
w
w

m
o

c
.
l
e

- Booting

a
.h

n
r
e
k
rd

APM
2. WWW Service APM(Apache, Php, Mysql)
$ sudo aptapt-get update

m
o

c
.
l
e

n
r
e
k
rd

: .
.
- Apache

$ sudo aptapt-get install apache2

a
.h

- mysql mysql

$ sudo aptapt-get install libapache2libapache2-modmod-authauth-mysql

w
w
w

$ sudo aptapt-get install mysqlmysql-server mysqlmysql-client

- php5 mysql
$ sudo aptapt-get install php5php5-common php5 libapache2libapache2-modmod-

php5

$ sudo aptapt-get install php5php5-mysql

- sudo /etc/init.d/apache2 restart

WWW Service - 1
3. WWW Service

c
.
l
e

m
o

: apache configuration file DocumentRoot php


.

n
r
e
k
rd

- /etc/apache2/sites-available/default DocumentRoot /var/www.


$ cat /var/www/odroid.php
<p><br><center>
<font size=7 color=blue>
<?

w
w
w
?>

</font><p>
<?

a
.h

echo Hello World~~;


echo

phpinfo(); ?>

</center>

- here in the odroid;

WWW Service - 2
- WWW Service

w
w
w

a
.h

n
r
e
k
rd

c
.
l
e

m
o

m
o

c
.
l
e

w
w
w

n
r
e
k
rd

a
.h

: /

Android Open Accessory







USB Host / Device


Google ADK Reference
Open Accessory solution
ODROID-ADK
Thermal

a
.h

n
r
e
k
rd

w
w
w

Framework
 Gadget
 Open Accessory Library
 Thermal Printer Application


m
o

c
.
l
e

 /

Google Open Accessory


 Android Honeycomb 3.1 / Gingerbread 2.3.4
 USB Device port (100% ?)

n
r
e
k
rd

 MCU USB Host

 ( )
 (USB 2.0 HS)


w
w
w

a
.h

m
o

c
.
l
e

 ( )

Google ADK Reference


 Maxim MAX3421 USB Host controller
 Arduino compatible

n
r
e
k
rd

 Shield board (I/O test)

w
w
w

a
.h

m
o

c
.
l
e

 Atmel ATMEGA2560

Open Accessory solution

m
o

 MAX3421 USB Host controller + Atmel ATMEGA2560


, ($ ?)

 ( Arduino )

c
.
l
e

n
r
e
k
rd

 FTDI Vinculum-II (VNC2)

16-bit MCU core with built-in USB Host, 256KB Flash / 16KB RAM
($ ?)
 Firmware source / Application source
 I/O Bus Analog/I2C


w
w
w

a
.h

 Microchip PIC24/PIC32

16bit/32bit, , ,
 Firmware source / Application source
 I/O


ODROIDODROID-ADK

Temperature Sensor

Pressure(Altitude)
Pressure(Altitude)
Sensor

I/O Ports
PWM
ADC
I2C
GPIO

w
w
w

c
.
l
e

Lithium Polymer
Battery Charger

n
r
e
k
rd

PIC24F
16Bit/Lower Power

MCU

+
Embedded

USB Host

a
.h

m
o

LDO 3.3 Volt

5Volt output
StepStep-up DC/DC
Converter
(For USB Host )

LiLi-Polymer
Rechargeable
Battery

ODROIDODROID-ADK

 PIC24FJ64GB002

n
r
e
k
rd

 /

 USB ( BaB )
 /

 (I/O Kit )

w
w
w

a
.h

m
o

c
.
l
e

 (?) /

ODROIDODROID-ADK
ADK Thermal printer Interface

m
o

Firmware Library Architecture

c
.
l
e

Configuring the Library


USB_ApplicationEventHandler callbacks ( )
HardwareProfile.h ("HardwareProfile - PIC24FJ64GB002 HK.h" , UART , )
usb_config.h (USB : Host/Device, BULK , NAK , VBUS )
usb_config.c (VID/PID filter ,  )

n
r
e
k
rd

Initialization (ANDROID_ACCESSORY_INFORMATION myDeviceInfo)


myDeviceInfo)
static char description[] = "ODROID-ADK1";
static char manufacturer[] = "Hardkernel Co., Ltd.";
static char model[] = "ODROID Accessory Demo";
static char uri[] = "http://www.hardkernel.com";
static char version[] = "1.1";
static char serial[] = "N/A";

a
.h

USB/12Mbps

Keeping the Stack Running


main() while(1) USBTask()

Detecting a Connection/Disconnection to an Android Device


USB_ApplicationEventHandler() Callback device_attached == FALSE/TRUE

w
w
w

Sending Data
AndroidAppIsWriteComplete()
Check to see if the last write to the Android device was completed
AndroidAppWrite()
Sends data to the Android device specified by the passed in handle.
Receiving Data
AndroidAppIsReadComplete()
Check to see if the last read to the Android device was completed
AndroidAppRead()
Attempts to read information from the specified Android device

* Microchip's Accessory Framework for Android

384 x 24 matrix

UART / 9600bps

ODROIDODROID-ADK

m
o

Firmware source code download


SVN server ( )
http://dev.odroid.com/projects/accessory/src
1.
# svn checkout --username anonsvn http://dev.odroid.com/svn/accessory
* The password is 'anonsvn'
2. SDK eclipse

http://dev.odroid.com/projects/accessory/wiki/BaseProjectAndEclipseSetting

w
w
w

a
.h

Programmer (In
(In Circuit Emulator)
PICKIT3 (Program )
)
-US$ 45 ( 60,000)
-US$ 25 (Clone )
PICKIT2 (Program )
)
- US$ 35 /18

* Microchip
Microchip Development Tools Main Page

c
.
l
e

n
r
e
k
rd

Toolchain (Compiler)
1. MPLAB IDE (Windows)
-c30 gcc
2. MPLAB-X (Linux/Mac/Windows)
-ODROID-ADK/BaB import
-
- Android C30-coff.a Android C30-elf.a )
Lite /

ADB WiFi

USB

m
o

c
.
l
e

w
w
w

n
r
e
k
rd

a
.h

USB Basic
USB is an asymmetric protocol


Host

n
r
e
k
rd

c
.
l
e

Controls the entire bus


 Keeps track of all attached devices and hubs
(enumeration)
 Initiates communication with the device
 Is a power source


w
w
w

Devices

a
.h

m
o

Communicates only with the host through endpoints


 Describes its capabilities to the host during
enumeration
 Implements standard or vendor specific functions


USB Host and Accessory

m
o

ODROID USB Host Mode

c
.
l
e

w
w
w

a
.h

n
r
e
k
rd

USB Host and Accessory


Android phone USB
accessory(device) ...

m
o

n
r
e
k
rd

c
.
l
e

USB host mode android phone


?

w
w
w

a
.h

Android phone
device(Accessory) .

USB Host and Accessory

c
.
l
e

m
o

Odroid

w
w
w

n
r
e
k
rd

a
.h

ADK Board
PC(ADB or
Mass Storage)

Odroid

USB Host and Accessory


ODROID USB Accessory(Device)

c
.
l
e

m
o

w
w
w

a
.h

n
r
e
k
rd

Android Open Accessory Block diagram

c
.
l
e

m
o

w
w
w

a
.h

n
r
e
k
rd

Android Accessory Protocol

c
.
l
e

m
o

w
w
w

a
.h

n
r
e
k
rd

Android Accessory Protocol

c
.
l
e

m
o

w
w
w

a
.h

n
r
e
k
rd

Android Accessory Protocol


Android
Device

n
r
e
k
rd

USB vendor ID, product ID

a
.h

USB vendor ID, product ID

w
w
w

Accessoy mode try...

Request 51(Protocol Ver)


Protocol ver (1)

Request 52(Information)
Request 53(startup)

Establish communication

m
o

c
.
l
e

ADK Board

Device
Accessory mode

Check
vendor ID :
Google(0x18D1),
Product ID :
Accessory mode
(0x2D00)

Android Accessory Protocol


Establish communication with the
device

n
r
e
k
rd

If an Android device in accessory mode is


dected, query devices interface and endpoint
descriptor
 Find first bulk IN & OUT endpoints
 Set the devices configuration to 1
 Now ready for communication


w
w
w

c
.
l
e

a
.h

m
o

Gadget
kernel/include/linux/usb/f_accessory.h
kernel/drivers/usb/gadget/f_accessory.c

n
r
e
k
rd

c
.
l
e

m
o

/* Use Google Vendor ID when in accessory mode */


22 #define USB_ACCESSORY_VENDOR_ID 0x18D1
23
24
25 /* Product ID to use when in accessory mode */
26 #define USB_ACCESSORY_PRODUCT_ID 0x2D00
27
28 /* Product ID to use when in accessory mode and adb is
enabled */
29 #define USB_ACCESSORY_ADB_PRODUCT_ID 0x2D01
21

w
w
w

a
.h

Gadget

c
.
l
e

m
o

f_accessory.c
 Communicate with usb accessory designed for android device
 Define usb descriptor (interface, endpoint)
 Process android accessory protocol if accessory function is
disabled
(Android device side)


GET PROTOCOL

n
r
e
k
rd

a
.h

Provide protocol version for usb accessory


Currently version number is 1

w
w
w

SEND STRING

Receive strings from usb accessory


(Manufacture, Model, Description, Version, URI, Serial)

ACCESSORY_START

change Google accessory mode


enable accessory file interface

usb_accessory device file interface


UsbService use it to communicate with usb accessory

Gadget

m
o

c
.
l
e

kernel/drivers/usb/gadget/f_accessory.c

w
w
w

a
.h

n
r
e
k
rd

Android 2.3.4 porting

m
o

c
.
l
e

S5PC110, S5PV210 ODROID-7

n
r
e
k
rd

S5PC210(Exynos4210), S5PV310 ODROID-A

Kernel(Nexus S ), Android(git merge)

a
.h

kernel/arch/arm/configs/odroida_android_defconfig
kernel/arch/arm/plat-s5p/devs.c
kernel/drivers/usb/gadget/composite.c
kernel/drivers/usb/gadget/f_mass_storage.c
kernel/drivers/usb/gadget/f_accessory.c
kernel/include/linux/usb/f_accessory.h
kernel/include/linux/usb/composite.h

w
w
w

android-2.3.3 vs android-2.3.4

c
.
l
e

m
o

w
w
w

a
.h

n
r
e
k
rd

c
.
l
e

m
o

w
w
w

a
.h

n
r
e
k
rd

Android-2.3.3
UsbObserver.java uevent

c
.
l
e

n
r
e
k
rd

AndroidAndroid-2.3.4
UsbService.java uevent

m
o

frameworks/base/services/jni/com_android_server_UsbService.cpp

a
.h

31 #include <linux/usb/f_accessory.h>
32
33 #define DRIVER_NAME "/dev/usb_accessory"
34
35 namespace android

w
w
w

UsbManager class

accessory list return




n
r
e
k
rd

openAccessory()

m
o

c
.
l
e

 getAccessoryList()

ParcelFileDescriptor return

ParcelFileDescriptor.getFileDescriptor() in/output Stream

hasPermission()

requestPermission()

w
w
w

a
.h

n
r
e
k
rd

public static final String ACTION_USB_CONNECTED =


"android.hardware.action.USB_CONNECTED";

public static final String ACTION_USB_DISCONNECTED =


"android.hardware.action.USB_DISCONNECTED";

a
.h

m
o

c
.
l
e

AndroidAndroid-2.3.3
public class Usb {

public static final String ACTION_USB_STATE =


"android.hardware.action.USB_STATE";

w
w
w

public static final String USB_CONNECTED = "connected";

public static final String USB_FUNCTION_MASS_STORAGE = "mass_storage";


public static final String USB_FUNCTION_ADB = "adb";

UsbManager class
AndroidAndroid-2.3.4
public class UsbManager {
private static final String TAG = "UsbManager";

c
.
l
e

n
r
e
k
rd

public static final String ACTION_USB_STATE =


"android.hardware.usb.action.USB_STATE";

m
o

public static final String ACTION_USB_ACCESSORY_ATTACHED =


"android.hardware.usb.action.USB_ACCESSORY_ATTACHED";

a
.h

public static final String ACTION_USB_ACCESSORY_DETACHED =


"android.hardware.usb.action.USB_ACCESSORY_DETACHED";

w
w
w

public static final String USB_CONNECTED = "connected";


public static final String USB_CONFIGURATION = "configuration";
public static final String USB_FUNCTION_MASS_STORAGE = "mass_storage";
public static final String USB_FUNCTION_ADB = "adb";
public static final String USB_FUNCTION_ACCESSORY = "accessory";

USB Accessory APIs

com.android.hardware.usb.*

Require Android 3.1 (API 12) or later

n
r
e
k
rd

 Compatibility Library for Gingerbread


 com.android.future.usb.*

a
.h

 Link against com.android.future.usb.accessory.jar


 Support Gingerbread 2.3.4 and later

w
w
w

m
o

c
.
l
e

 New USB APIs in Android 3.1

USB Accessory APIs


2.3.4 app AndroidManifest.xml

<uses-library android:name="com.android.future.usb.accessory" />

n
r
e
k
rd

<activity android:name=".ThermalPrinterActivity"

a
.h

[2011-10-11 20:01:59 - ThermalPrinter]


Installing ThermalPrinter.apk...
[2011-10-11 20:02:01 - ThermalPrinter]
Installation error:
INSTALL_FAILED_MISSING_SHARED_LIBRARY
[2011-10-11 20:02:01 - ThermalPrinter]
Please check logcat output for more details.
[2011-10-11 20:02:01 - ThermalPrinter]
Launch canceled!

w
w
w

m
o

c
.
l
e

<application android:icon="@drawable/icon" android:label="@string/app_name">

Thermal Printer Application

c
.
l
e

m
o

w
w
w

a
.h

n
r
e
k
rd

Thermal Printer Application

http://dev.odroid.com/projects/accessory

n
r
e
k
rd

svn checkout username anonsvn


http://dev.odroid.com/svn/accessory/

Passwod : anonsvn

w
w
w

a
.h

m
o

c
.
l
e

Source repository

Thermal Printer Application

w
w
w

n
r
e
k
rd

a
.h

m
o

c
.
l
e

Android-2.3.4 API Level 10

Thermal Printer Application


AndroidManifest.xml

m
o

c
.
l
e

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hardkernel.adk" android:versionCode="1" android:versionName="1.0">
<uses-feature android:name="android.hardware.usb.accessory"/>
<uses-sdk android:minSdkVersion="10" />

n
r
e
k
rd

<application android:icon="@drawable/icon" android:label="@string/app_name">


<uses-library android:name="com.android.future.usb.accessory" />
<activity android:name=".ThermalPrinterActivity"
android:label="@string/app_name" android:screenOrientation="landscape">>
<intent-filter>
<action android:name="android.intent.action.MAIN" />

w
w
w

a
.h

<intent-filter>
<action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
</intent-filter>
<meta-data android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
android:resource="@xml/accessory_filter" />
</activity>

Thermal Printer Application


xml/accesory_filter.xml
xml/accesory_filter.xml

m
o

c
.
l
e

<?xml version="1.0" encoding="utf-8"?>

n
r
e
k
rd

<resources>
<usb-accessory manufacturer="Hardkernel Co., Ltd." model="Thermal Printer"/>
</resources>

main.c
195
196
197
198
199
200
201
202

static
static
static
static
static
static

char
char
char
char
char
char

a
.h

description[] = "ODROID-ADK1";
manufacturer[] = "Hardkernel Co., Ltd.";
model[] = "Thermal Printer";
uri[] = "http://www.hardkernel.com";
version[] = "1.1";
serial[] = "N/A";

w
w
w

Thermal Printer Application

<?xml version="1.0" encoding="utf-8"?>


<resources>
<string name="app_name">Thermal Printer</string>
</resources>

n
r
e
k
rd

USBAccessoryManager.java

private final BroadcastReceiver receiver = new BroadcastReceiver() {


@Override
public void onReceive(Context context, Intent intent) {
/* get the action for this event */
String action = intent.getAction();

w
w
w

a
.h

if(packageName.equals(action)) {
...

m
o

c
.
l
e

app_name model ...


Values/strings.xml
Values/strings.xml

c
.
l
e

m
o

w
w
w

a
.h

n
r
e
k
rd

Thermal Printer Application

c
.
l
e

n
r
e
k
rd

USBAccessoryManager::enable(this);

m
o

IntentFilter filter = new IntentFilter(packageName);


filter.addAction(UsbManager.ACTION_USB_ACCESSORY_ATTACHED);
filter.addAction(UsbManager.ACTION_USB_ACCESSORY_DETACHED);
context.registerReceiver(receiver, filter);

a
.h

UsbManager deviceManager = null;


UsbAccessory[] accessories = null;
UsbAccessory accessory = null;

w
w
w

deviceManager = (UsbManager)context.getSystemService("UsbAccessory");
accessories = deviceManager.getAccessoryList();
parcelFileDescriptor = deviceManager.openAccessory(accessory);
handler.obtainMessage(what,
new
USBAccessoryManagerMessage(USBAccessoryManagerMessage.MessageType.READY,
accessory)).sendToTarget();

Thermal Printer Application

m
o

c
.
l
e

n
r
e
k
rd

public class USBAccessoryManager {

outputStream = new FileOutputStream(parcelFileDescriptor.getFileDescriptor());

a
.h

public void write(byte[] data){


if(isConnected() == true) {
if(outputStream != null) {
try {

w
w
w
}

outputStream.write(data);

} catch (IOException e) {
}

Thermal Printer Application


public class USBAccessoryManager {
...
readThread = new ReadThread(parcelFileDescriptor);

n
r
e
k
rd

private FileInputStream inputStream;


private ParcelFileDescriptor myparcelFileDescriptor;

public ReadThread (ParcelFileDescriptor p) {


myparcelFileDescriptor = p;
inputStream = new FileInputStream(p.getFileDescriptor());

a
.h

...
@Override
public void run() {
byte[] buffer = new byte[1024]; // buffer store for the stream
int bytes; // bytes returned from read()

w
w
w

m
o

c
.
l
e

private class ReadThread extends Thread {

while(continueRunning) {
try {

bytes = inputStream.read(buffer);
byte[] data = new byte[bytes];
System.arraycopy(buffer, 0, data, 0, bytes);

...

handler.obtainMessage(what, bytes, -1,

new
USBAccessoryManagerMessage(USBAccessoryManagerMessage.MessageType.READ,
data)).sendToTarget();

Thermal Printer Application

c
.
l
e

n
r
e
k
rd

private Handler handler = new Handler() {


@Override
public void handleMessage(Message msg) {

a
.h

m
o

byte[] commandPacket = new byte[2];

w
w
w

switch(msg.what)
{
case USBAccessoryWhat:
switch(((USBAccessoryManagerMessage)msg.obj).type) {
case READ:
...
case READY:
setTitle("Device connected.");
mBtnPrint.setEnabled(true);

Thermal Printer Application

n
r
e
k
rd

Print

m
o

c
.
l
e

view.getDrawingCache();

Scan line
(384 pixel * 8 = 384 byte)

w
w
w

a
.h

read()
OK(define 1)

write()
1 + 384byte

385byte
USBAccessoryManager

UsbManager
1byte(0x01)

m
o

c
.
l
e

n
r
.
e
k
d
r
a
.h

.
.

w
www.hardkernel.com
w
w

You might also like