Sensors for OMAP
From OMAPpedia
Contents |
[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
* http://omapzoom.org/platform.html * MEMSIC Sensors - Accelerometer - http://www.memsic.com/products/MXC6202.htm * Bosch Accelerometer - http://www.bosch-sensortec.com/content/language1/downloads/BMA150_DataSheet_Rev.1.5_30May2008.pdf
[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: http://github.com/phukat/AccelDriver.
To download the source files for the driver in either tar or zip format go to: http://github.com/phukat/AccelDriver/archives/master.
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
cdcp bma150.c /drivers/input/misc/. cp smb380.c /drivers/input/misc/. cp smb380calib.c /drivers/input/misc/. cp smb380calib.h /drivers/input/misc/. cp smb380.h /include/linux/. // Modify the Makefile in /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 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 help If you say yes here you get support for Bosch Sensortec's acceleration sensors SMB380/BMA150. // Modify the file omap_zoom2_defconfig in /arch/arm/configs/ directory and add below line at the end // CONFIG_BOSCH_BMA150=y
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:
-
Hardware integration and pin connection
- Refer to the applicable Zoom Baseboard Schematic (available from LogicPD after kit registration)
-
Addition of driver source and header files to kernel source
- Driver.c goes into an appropriate drivers/ subdirectory
- Driver.h can go into include/linux or an appropriate subdirectory thereof
-
Modification of Makefile and Kconfig in the destination drivers/ directory
- Follow patterns from existing entries to create new ones
-
Pin mux configuration
- Refer to OMAP3430 datasheet (padconf table begins on page 768)
- Modify arch/arm/mach-omap2/mux.c and arch/arm/plat-omap/include/plat/mux.h appropriately
-
Modification of the board configuration file
- Initialize GPIO and communication protocol pins, any device-specific platform data, and bind the driver to the communication adapter
- arch/arm/mach-omap2/board-zoom-peripherals.c
- Kernel compilation and test
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:
http://patchwork.kernel.org/patch/59422/ http://patchwork.kernel.org/patch/59421/
--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:
http://www.kionix.com/accelerometers/accelerometer-KXTE9.html
KXTE9 Evaluation Boards are available here:
http://www.kionix.com/sensors/evaluation-kits.html
--Chudson 22:37, 7 January 2010 (UTC)
[edit] References
Zoom2 platform resources - http://omapzoom.org/resources.html
Zoom2 Board Schematics - https://gforge.ti.com/gf/project/omapzoom/frs/?action=FrsReleaseBrowse&frs_package_id=48
Accelerometer Fundamentals - http://wiki.openmoko.org/wiki/Technical:Accelerometer_Fundamentals
Accelerometer Data Retrieval - http://wiki.openmoko.org/wiki/Accelerometer_data_retrieval
Bosch Sensortec BMA150 Digital, triaxial acceleration sensor - http://www.bosch-sensortec.com/content/language1/downloads/Flyer_BMA150_november07.pdf
Odroid Entertainment device - Android based gaming device - Odroid uses Bosch BM150 http://www.hardkernel.com/ http://www.linuxfordevices.com/c/a/News/HardKernel-Odroid/
Odroid Hardware Information - http://dev.odroid.com/projects/odroid/wiki/HardwareInformation
BMA150 device driver source code - http://dev.odroid.com/projects/linux/src/drivers/input/misc
Discussion on New style I2C driver for KXSD9 accelerometer - http://osdir.com/ml/linux.drivers.i2c/2008-09/msg00080.html
Project using BMA150 - http://www.wpi.edu/Pubs/E-project/Available/E-project-102209-164024/unrestricted/Indoor_Navigation_System_for_Handheld_Devices.pdf
Debugging Kernels - Console Server and KERN_ messages - http://wil.cs.caltech.edu/mwiki/index.php?title=Console_server
Usage on iPhone - http://news.cnet.com/8301-13924_3-10251217-64.html
[edit] Future additions
Once the driver is in place, use cases can be enabled from UI framework on any supported distributions.