Sensors for OMAP

From OMAPpedia

Revision as of 06:31, 24 June 2010 by Hemanthv (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


[edit] Sensors for OMAP

[edit] Goal

The goal of the project is to enable different sensors for OMAP, be it an internal accelerometer built into Zoom2/OMAP4 or other external sensors. This could be adding a driver for the sensor or extending the support from the UI framework.

[edit] Sensors on OMAP4 SDP and Blaze

OMAP4 based boards (SDP and Blaze) support several sensors like Accelerometer, Ambient Light sensor, Proximity Switch, Temperature sensor, Pressure sensor, Digital compass. Below wiki link provides details of driver support for each.

[edit] Accelerometers on OMAP Zoom2

This project is to enable the Accelerometer sensor (Bosch BMA150 Accelerometer Sensor Driver) in Zoom2 by adding a driver for it on LO kernel.

There are two accelerometers built into OMAP Zoom2: a MEMSIC and a Bosch

* MEMSIC Sensors - Accelerometer -
* Bosch Accelerometer -

[edit] Bosch Accelerometer

This sub-section describes how to get Bosch Accelerometer drivers and instructions on integrating them in L-O Kernel. The drivers were tested with L-O 2.6.31-rc5 kernel.

The source files for Bosch BMA150 drivers are located at:

To download the source files for the driver in either tar or zip format go to:

After downloading the drivers un-compress them and follow below instructions for copying them to appropriate location and compile them in to kernel. The below instructions assume that the L-O kernel is downloaded at <kernel-location> directory. They also assume the unzipped or untared version of the drivers are available at <bma150-download-dir> directory.

  cd <bma150-download-dir>
  cp bma150.c <kernel-location>/drivers/input/misc/.
  cp smb380.c <kernel-location>/drivers/input/misc/.
  cp smb380calib.c <kernel-location>/drivers/input/misc/.
  cp smb380calib.h <kernel-location>/drivers/input/misc/.
  cp smb380.h <kernel-location>/include/linux/.
  // Modify the Makefile in <kernel-location>/drivers/input/misc/ direcotry and add below line at the end //
     obj-$(CONFIG_BOSCH_BMA150)              += smb380.o smb380calib.o bma150_driver.o
  // Modify Kconfig file in <kernel-location>drivers/input/misc directory and add below code-segment before the last endif //
       config BOSCH_BMA150
       tristate "SMB380/BMA150 acceleration sensor support"
       depends on I2C=y
         If you say yes here you get support for Bosch Sensortec's 
         acceleration sensors SMB380/BMA150.
  // Modify the file omap_zoom2_defconfig in <kernel-location>/arch/arm/configs/ directory and add below line at the end //

After you followed the above instructions please do "make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm menuconfig" and enable BMA150 by drilling down to and selecting device drivers -> input device support -> Miscellaneous devices -> Bosch BMA150 Accelerometer. Save the config and rebuild the kernel by giving the command " make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm uImage"

[edit] External Sensors

Additional sensors can be attached to the OMAP Zoom platforms through the J43 expansion header. This can come in handy for testing a part's capability in a near-production environment, with a custom operating system and hardware similar to what you would find in a current consumer device. Here is a brief list of steps for integrating a new sensor into the Zoom:

Note that this list assumes familiarity with retrieving the kernel and bootloader source, cross-compiling the binaries, formatting an SD card and booting the Zoom platform as outlined in the Getting Started sections of this website.

Further details on the integration process can be found in this patchset on the Linux-OMAP Kernel:

--Chudson 22:37, 7 January 2010 (UTC)

[edit] Kionix KXTE9 Accelerometer

The first sensor I integrated into the OMAP Zoom platform was the Kionix KXTE9 digital tri-axis accelerometer. This part uses i2c and has built-in tilt position, wake-up, and back-to-sleep algorithms, which can trigger a user-configurable physical interrupt. I used Digi-key part number SAM8019-ND to interface with the J43 expansion header on the zoom, and connected the pins to a 14-pin header that was attached to a KXTE9 evaluation board via a ribbon cable. Here are the exact pin connections:

Signal OMAPZoom KXTE9 Eval
SCL J43-E6 J1-5
SDA J43-E7 J1-7
GPIO J43-E1 J1-11
Vdd J43-D3 J1-1
GND J43-E13 J1-8
IOVdd J43-C1 J1-6

To test the driver and hardware connections, I used Busybox on the ZoomI and ZoomII platforms. Mounting a Busybox filesystem allows you to boot into a custom Linux kernel and perform most of the same commands that you have available on your desktop distro. Before you get to this point, (if writing a custom driver) you will probably spend a lot of time compiling, configuring, recompiling, and rebooting your kernel to debug any problems with the driver or hardware connections. Once the kernel is scanning the appropriate communication bus, finding the external sensor, and binding the driver to it properly, you can use cd, ls, cat, echo, etc...if you're using sysfs, you can directly control your hardware from the serial terminal using these commands. Placing debug outputs into the driver code will allow straightforward confirmation that the sysfs attribute functions are being called and executed correctly as you are manipulating them through Busybox.

The KXTE9 product specification is available here:

KXTE9 Evaluation Boards are available here:

--Chudson 22:37, 7 January 2010 (UTC)

[edit] References

Zoom2 platform resources -

Zoom2 Board Schematics -

Accelerometer Fundamentals -

Accelerometer Data Retrieval -

Bosch Sensortec BMA150 Digital, triaxial acceleration sensor -

Odroid Entertainment device - Android based gaming device - Odroid uses Bosch BM150

Odroid Hardware Information -

BMA150 device driver source code -

Discussion on New style I2C driver for KXSD9 accelerometer -

Project using BMA150 -

Debugging Kernels - Console Server and KERN_ messages -

Usage on iPhone -

[edit] Future additions

Once the driver is in place, use cases can be enabled from UI framework on any supported distributions.

Personal tools