Friday, May 23, 2008

Implementation of a Digital Compass using HMC1053

HMC1053 is a 3-axes magnetic sensor manufactured by Honeywell. Our laboratory bought a couple of HCM1053 chips for certain project, and I was supposed to implement a digital compass using the chip.
I found an application note by Googling and made a board based on the reference schematic in the application note.
The board was nicely manufactured but when I tried to measure magnetic field I got some problems: The sensor outputs are too low. An amplifier, MAX4334, is used to amplify the magnetic sensor outputs with about 200 times gain and it seams to work correclty. After server hours of terrible hardware debugging, I eventually found that the Set/Reset strap required by HMC1053 does not work.

Thursday, May 22, 2008

Porting Android on the TI's Davinci DM644x Running Linux 2.6.20

Currently I am involved in a middleware development project for mobile multimedia platforms(more information about the project). We found that Google's Android is a good starting point for our project. So I have tried to port the Android on our hardware platform. Our hardware is
Processor: TI DM6441 (ARM926EJ-S 256MHz & C64x+ 513MHz)
SDRAM: 128MB
Flash: NAND 64MB
During googling I found a useful patch from Benno's blog. It is the diff between the vanilla Linux-2.6.23 and the Android kernel. The reason he chose 2.6.23 version is the Android kernel is also based on Linux-2.6.23. However, the Android kernel includes a couple of machine emulation-related things (e.g. QEMU and Goldfish) which is not needed by real hardware. Thankfully he got rid of these things from the diff and finally released this patch. This patch creates or modifies the following kernel source files.
arch/arm/kernel/process.c
arch/arm/kernel/signal.c

drivers/binder/LICENSE
drivers/binder/Makefile
drivers/binder/binder.c
drivers/binder/binder_defs.h
drivers/binder/binder_node.c
drivers/binder/binder_node.h
drivers/binder/binder_proc.c
drivers/binder/binder_proc.h
drivers/binder/binder_thread.c
drivers/binder/binder_thread.h
drivers/binder/binder_transaction.c
drivers/binder/binder_transaction.h
drivers/binder/iobuffer.c
drivers/binder/iobuffer.h
drivers/binder/tester.c

drivers/char/Kconfig

drivers/input/evdev.c

drivers/misc/Kconfig
drivers/misc/Makefile
drivers/misc/lowmemorykiller/Makefile
drivers/misc/lowmemorykiller/lowmemorykiller.c

drivers/usb/gadget/Makefile

fs/inotify_user.c

include/asm-arm/elf.h

include/linux/android_alarm.h
include/linux/android_gadget.h
include/linux/android_power.h
include/linux/binder_module.h
include/linux/binder_type_constants.h
include/linux/logger.h

init/Kconfig

kernel/futex.c
kernel/hrtimer.c
kernel/panic.c
kernel/power/console.c
kernel/pwoer/process.c
Although our team has been developing based on Linux-2.6.20, I decided to build the Android kernel using Linux-2.6.23 because I prefer doing works step-by-step.
By typing "android porting" into the Google search bar I could get two useful (and thankful) documents:"Android Porting on Real Target" and "Android on OMAP". These documents cover almost everything to port Android on the real target.
After the successful porting of Android on the Davinci EVM board running Linux-2.6.23, I eventually needed to pull down the kernel version to 2.6.20 since the real board which I have has been developed under 2.6.20 kernel. I decided to just apply the patch to the 2.6.20 kernel even though several problems were expected. When I did that, a couple of hunk failures occured.
patching file arch/arm/kernel/process.c
Hunk #1 succeeded at 377 (offset -19 lines).
patching file arch/arm/kernel/signal.c
Hunk #1 succeeded at 543 (offset 9 lines).
Hunk #2 succeeded at 660 (offset 2 lines).
patching file drivers/binder/LICENSE
patching file drivers/binder/Makefile
patching file drivers/binder/binder.c
patching file drivers/binder/binder_defs.h
patching file drivers/binder/binder_node.c
patching file drivers/binder/binder_node.h
patching file drivers/binder/binder_proc.c
patching file drivers/binder/binder_proc.h
patching file drivers/binder/binder_thread.c
patching file drivers/binder/binder_thread.h
patching file drivers/binder/binder_transaction.c
patching file drivers/binder/binder_transaction.h
patching file drivers/binder/iobuffer.c
patching file drivers/binder/iobuffer.h
patching file drivers/binder/tester.c
patching file drivers/char/Kconfig
Hunk #1 FAILED at 1062.
1 out of 1 hunk FAILED -- saving rejects to file drivers/char/Kconfig.rej
patching file drivers/input/evdev.c
Hunk #1 succeeded at 21 with fuzz 1 (offset 1 line).
Hunk #2 succeeded at 42 (offset -1 lines).
Hunk #3 FAILED at 67.
Hunk #4 FAILED at 82.
Hunk #5 FAILED at 146.
Hunk #6 FAILED at 176.
Hunk #7 FAILED at 347.
5 out of 7 hunks FAILED -- saving rejects to file drivers/input/evdev.c.rej
patching file drivers/misc/Kconfig
Hunk #1 succeeded at 25 with fuzz 2 (offset -177 lines).
patching file drivers/misc/Makefile
Hunk #1 FAILED at 15.
1 out of 1 hunk FAILED -- saving rejects to file drivers/misc/Makefile.rej
patching file drivers/misc/lowmemorykiller/Makefile
patching file drivers/misc/lowmemorykiller/lowmemorykiller.c
patching file drivers/usb/gadget/Makefile
Hunk #1 succeeded at 20 (offset -8 lines).
patching file fs/inotify_user.c
Hunk #6 succeeded at 602 (offset -8 lines).
patching file include/asm-arm/elf.h
Hunk #1 succeeded at 80 (offset 20 lines).
patching file include/linux/android_alarm.h
patching file include/linux/android_gadget.h
patching file include/linux/android_power.h
patching file include/linux/binder_module.h
patching file include/linux/binder_type_constants.h
patching file include/linux/logger.h
patching file init/Kconfig
Hunk #1 succeeded at 316 (offset -34 lines).
2 out of 2 hunks FAILED -- saving rejects to file kernel/futex.c.rej
patching file kernel/hrtimer.c
Hunk #1 FAILED at 1125.
1 out of 1 hunk FAILED -- saving rejects to file kernel/hrtimer.c.rej
patching file kernel/panic.c
patching file kernel/power/console.c
Hunk #1 succeeded at 44 (offset -8 lines).
patching file kernel/power/process.c
Hunk #1 succeeded at 14 (offset 1 line).
Hunk #2 FAILED at 153.
1 out of 2 hunks FAILED -- saving rejects to file kernel/power/process.c.rej
I tried to resolve above Hunk failures but I could not fix 'kernel/futex.c', 'kernel/hrtimer.c' and 'kernel/power/process.c'. Anyway, compilation was successful!
Currently, however, I have a display problem. When I execute Android 'runtime' I can see ANDROID string, red cycle eye, but no more (no background). I think that this problem is related to the framebuffer and the resolution is in progress.