Creating-Custom-Drivers-for-APQ8060-Dragonboard-BSQUARE
Creating-Custom-Drivers-for-APQ8060-Dragonboard-BSQUARE
Creating-Custom-Drivers-for-APQ8060-Dragonboard-BSQUARE
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>Creating</strong> <strong>Custom</strong> <strong>Drivers</strong> <strong>for</strong> the<br />
Snapdragon® <strong>APQ8060</strong> DragonBoard<br />
Michael J. Chalupa<br />
Field Engineering Manager, <strong>BSQUARE</strong> Corporation
Welcome & Outline<br />
• Introduction of the <strong>APQ8060</strong> DragonBoard<br />
– <strong>BSQUARE</strong> distributes and supports<br />
• Developing custom device <strong>for</strong> Android on the<br />
Qualcomm APQ8069 DragonBoard<br />
– Example driver based on Kionix KXSD9-1026<br />
accelerometer<br />
– Driver development process <strong>for</strong> Android<br />
• Conclusion
Qualcomm <strong>APQ8060</strong> Development Board<br />
• APQ 8060 Development Board (AP Board)<br />
– Open board designed to be an easy-to-use<br />
plat<strong>for</strong>m with a Qualcomm <strong>APQ8060</strong> chipset<br />
(excluding the WAN radio chip)<br />
• Includes a large number of connectors to support<br />
expansion<br />
– Intended <strong>for</strong> developers to have early access to<br />
devices/boards <strong>for</strong> use in:<br />
• Application development<br />
• Testing<br />
• Optimization
Qualcomm <strong>APQ8060</strong> Development Board<br />
• <strong>APQ8060</strong> enables the Qualcomm Ecosystem of<br />
3 rd -party Software developers, Universities and<br />
Component Suppliers to have early access to:<br />
– Hardware<br />
• Sensors<br />
• Displays and Touch screens<br />
• Cameras<br />
– Software<br />
• Applications/Games<br />
• Games<br />
• Operating Systems
What’s in the <strong>APQ8060</strong> Development Board<br />
• <strong>APQ8060</strong> dual core processor<br />
• PMICs (PM8058+PM8901)<br />
• 1500mAH battery<br />
• Display (3.61” WVGA)<br />
• Multi-touch Capacitance Sense<br />
touch screen<br />
• Daughter Cards<br />
– BT/WiFi Radio card<br />
• Qualcomm WCN1314 WLAN<br />
• Qualcomm WCN2243 BT<br />
– Sensor Card<br />
• Pressure and Temperature<br />
• 3-axis accelerometer<br />
• 3-axis Gyro<br />
• Proximity and Ambient Light<br />
• 3-axis Compass<br />
• 5MP ‘main’ camera<br />
• 2MP camera <strong>for</strong> video telePMICs<br />
• Keypad<br />
• Connectors<br />
– 20pin JTAG card<br />
– DE-9F RS-232<br />
– Mini-B USB port<br />
– 2x SIM<br />
– 2X SDIO<br />
– RJ-45 Ethernet<br />
– 3.5mm TRS Stereo Audio<br />
• Test points<br />
– MIPI-CSI (camera)<br />
– MIPI-DSI (display)<br />
– GPIOs<br />
– Parallel bus (EBI2)<br />
• Wolfson (WM8903LGEFK/V)
Distributed & Supported only by <strong>BSQUARE</strong><br />
• Sales, Distribution and Support<br />
– Purchase at www.bsquare.com/qualcomm<br />
• Software updates<br />
• Support<br />
– 1 Hour of support included with purchase<br />
– Hardware and software support<br />
• Contact <strong>BSQUARE</strong> <strong>for</strong> assistance with<br />
additional services and support.<br />
– Email us at sales@bsquare.com.
Developing a <strong>Custom</strong> Driver <strong>for</strong> the<br />
<strong>APQ8060</strong> Development Environment<br />
• Development Environment:<br />
– Create a Development System based on:<br />
• Ubuntu 64bit version 10.04 or newer<br />
– Required by Gingerbread's prebuilt gcc 4.4.3 toolchain<br />
• Java 1.6 JDK<br />
• Minicom<br />
– Used <strong>for</strong> Serial Debug
Android Source Release<br />
• The Android Release available <strong>for</strong> the <strong>APQ8060</strong> is:<br />
– Android 2.3.3_r1 (Gingerbread)<br />
– Linux Kernel 2.6.35-7<br />
• The Android Source Code Release downloaded from :<br />
– http://www.codeaurora.org<br />
• Detailed instructions can be found at :<br />
– https://www.codeaurora.org/xwiki/bin/QAEP/<br />
• Get Source by using :<br />
– $repo init –u git://codeaurora.org/plat<strong>for</strong>m/manifest.git –b<br />
gingerbread_rel –m M8660AAABQNLYA109002.xml<br />
– $ repo sync
Building the Android Source Release<br />
• To build your source follow these instructions :<br />
– cd <br />
– source build/envsetup.sh<br />
– choosecombo 1 1 msm8660_surf eng<br />
• Where 1 = Device<br />
• Where 1 = Release<br />
– make -j4<br />
• You now have successfully built the Android<br />
Images <strong>for</strong> the 8060<br />
– Located at out/target/product/msm8660_surf/<br />
– cd out/target/product/msm8660_surf/
Installing the Android Image on the <strong>APQ8060</strong><br />
• To enable your system to recognize the<br />
DragonBoard you will need to add this line to the<br />
51-android.rules file<br />
– SUBSYSTEM=="usb",SYSFS{idVendor}=="05c6",<br />
MODE="0666”<br />
• If the file does not exists in this location<br />
/etc/udev/rules.d/51-android.rules you will need<br />
to create it.
Installing Android Image on the <strong>APQ8060</strong><br />
• Power on the DragonBoard<br />
• Connect USB to your DragonBoard<br />
– Test connection to DragonBoard<br />
• adb devices<br />
– You should see a device listed:<br />
• adb reboot bootloader
Installing Android Image on the <strong>APQ8060</strong><br />
• Follow these commands to install your Android<br />
Image<br />
– [Application boot-loader]<br />
• fastboot flash aboot emmc_appsboot.mbn<br />
– [Kernel]<br />
• fastboot flash boot boot.img<br />
– [System]<br />
• fastboot flash system system.img.ext<br />
– [Userdata]<br />
• fastboot flash userdata userdata.img.ext<br />
– [Persist(used <strong>for</strong> WIFI)]<br />
• fastboot flash persist persist.img.ext4
Running your Android Image<br />
• Once you have completed the download steps<br />
• Issue the “adb reboot” command or power cycle<br />
the board<br />
• The device will restart and bring up the new<br />
Android image<br />
• Now you are ready to start working on<br />
developing your custom device driver
<strong>Custom</strong> Device Driver Development on the<br />
DragonBoard<br />
• <strong>Custom</strong> Android driver develop is similar to<br />
Linux driver development<br />
• Need to acquire all necessary hardware and<br />
software technical details<br />
– Device Data Sheet<br />
– Schematics<br />
– Sample Driver Code (if available)
<strong>Custom</strong> Device Driver Development<br />
• Determine what type of driver you will be<br />
developing<br />
–Block<br />
– Character<br />
– Specific Interfaces<br />
• Display<br />
• Keyboard<br />
• Wifi<br />
• Camera, etc<br />
• Select a reference driver from the Open Source<br />
Community
<strong>Custom</strong> Device Driver Development<br />
• <strong>BSQUARE</strong> selected the Kionix KXSD9-1026<br />
accelerometer as our example device<br />
– New Accelerometer on the DragonBoard<br />
– A driver was not available <strong>for</strong> Android<br />
– Will be made available by Qualcomm <strong>for</strong> the DragonBoard<br />
• Selected the Bosch BMA150 accelerometer source<br />
from the Snapdragon 8x55 MDP source tree as our<br />
reference device driver<br />
• Start initial driver modifications leveraging the<br />
reference driver
<strong>Custom</strong> Device Driver Development<br />
• Find a Similar Device Driver available in an<br />
existing Android Release<br />
– Since we were making an accelerometer device we<br />
took the source from an accelerometer used in a<br />
similar product to use as a starting point<br />
• The BMA150<br />
• Taken from the MSM7x30 source<br />
• An I2C based device driver<br />
– In this new file, we changed all text of bma150 to<br />
kxds9 and appended the opening boiler plate
<strong>Custom</strong> Device Driver Development<br />
• Compare the datasheet <strong>for</strong> the original device<br />
(bma150) with the new device (kxsd9) and<br />
make the necessary changes<br />
• For example we needed to:<br />
– change all I2C register locations<br />
– expand the range of G <strong>for</strong>ces allowed<br />
– change and expand the bandwidth ranges
<strong>Custom</strong> Device Driver Development<br />
• By further examining the KXSD9 datasheet<br />
we determined the following changes were<br />
required:<br />
– The MSB and LSB values of the accelerometer<br />
data were in different order from an i2c block read<br />
versus the BMA150<br />
– The KXSD9 only has 1 bit <strong>for</strong> enable and disable<br />
• These types of changes are normal when<br />
leveraging exiting driver code <strong>for</strong> integration<br />
of new devices
Adding the new driver to the build<br />
• Added the following to /drivers/input/misc/Kconfig<br />
config KIONIX_KXSD9<br />
tristate "KXSD9 acceleration sensor support“<br />
depends on I2C=y<br />
help<br />
If you say yes here you get support <strong>for</strong> Kionix's<br />
acceleration sensor KXSD9<br />
• Added the following to /drivers/input/misc/Kconfig<br />
obj-$(CONFIG_KIONIX_KXSD9) += kxsd9.o<br />
• Added the following to our config file at<br />
/arch/arm/configs/msm8660_defconfig<br />
CONFIG_KIONIX_KXSD9=y
Adding the new driver to the build<br />
• Once you have modified all of the source<br />
code to support your device, the next step is<br />
to:<br />
– build the kernel with the new driver so that the<br />
new image has support <strong>for</strong> the new device<br />
• Next you have to enable the device in your<br />
board
Add the New Device to Your Board file<br />
• For our driver, we added the new device into<br />
our “board-8660.c file”<br />
– The Kionix device needed to have “power on” and<br />
“power off” functions<br />
• We leveraged the reference sensor “power on” and off<br />
code from board-7x30.c and made the following<br />
modifications<br />
– One regulator needed to be turned on<br />
– Voltage needed to be set to 2.85v<br />
– Neede a New regulator API vs. the code in the 7x30 file
Add the New Device to Your Board file<br />
– Created an i2c_board_info structure based on<br />
data from the datasheet and board schematic<br />
• I2c address is 0x18 – from datasheet<br />
• IRQ is tied to GPIO pin 57 – from schematic<br />
– Added a new “i2c_board_info” structure to the list<br />
of devices to initialize at start up<br />
• register_i2c_devices()<br />
– Now you are ready to boot the kernel and you<br />
should see KXSD9 initialization messages
<strong>BSQUARE</strong> Overview<br />
� Industry leader with a proven track record in providing production-ready software<br />
products, engineering services and licensing to smart device manufacturers.<br />
� <strong>BSQUARE</strong> licenses device software and provides software engineering services<br />
to OEMs, ODMs and enterprises creating medical embedded devices based on<br />
Windows Embedded, Windows Mobile and other operating systems.<br />
24<br />
6/<br />
2/<br />
20<br />
11
<strong>BSQUARE</strong> End-to-end Service Offerings<br />
• Device Consulting<br />
•System Software<br />
and Hardware<br />
Development<br />
• Application and<br />
Middleware<br />
Development<br />
• Quality Assurance<br />
and Testing<br />
• Program<br />
Management<br />
<strong>BSQUARE</strong><br />
Services<br />
• Windows<br />
Embedded CE BSP<br />
<strong>for</strong> TI OMAP<br />
• Snapdragon MDP<br />
• Adobe Flash Player<br />
ports<br />
•TestQuest Pro<br />
•TestQuest<br />
CountDown<br />
•HTML5 Rendering<br />
•Secure Digital<br />
Middleware<br />
<strong>BSQUARE</strong> IP<br />
Training and Technical Support<br />
©2010 <strong>BSQUARE</strong> Corporation. All rights reserved. <strong>BSQUARE</strong> is a registered trademark of <strong>BSQUARE</strong> Corporation.<br />
All other names, product names and trade names are trademarks or registered trademarks of their respective holders.<br />
• Windows ®<br />
Embedded:<br />
Embedded<br />
Standard, Compact,<br />
CE, Desktop, Server<br />
• Windows ® Mobile<br />
•McAfee ® Embedded<br />
Security<br />
• Adobe ® Flash ®<br />
• Datalight<br />
Third Party<br />
Products
<strong>BSQUARE</strong> Additional Services & Products<br />
• Application Development<br />
– The <strong>BSQUARE</strong> global application development team builds cross plat<strong>for</strong>m applications<br />
<strong>for</strong> devices running Android, Brew MP, Windows Mobile and Windows Phone operating<br />
systems.<br />
• Automated Testing Tools<br />
– Best‐in‐class test automation tools from <strong>BSQUARE</strong>, mobile and wireless device<br />
manufacturers and application developers can decrease test cycle time, increase test<br />
coverage, improve test accuracy, accelerate new products to market and ensure a<br />
quality end user experience.<br />
• User Interface Solutions<br />
– Create innovative user experiences <strong>for</strong> Android, Linux and Windows plat<strong>for</strong>ms with<br />
<strong>BSQUARE</strong> expertise in Adobe® Flash®, HTML5 Rendering Engine, <strong>Custom</strong> WebKit Ports<br />
and user interface development.<br />
• Support<br />
– <strong>BSQUARE</strong> offers extended support <strong>for</strong> software developers and device manufacturers<br />
using the Snapdragon Mobile Development Plat<strong>for</strong>m including phone, email and<br />
Knowledge Base.
<strong>BSQUARE</strong>: Enabling the Next Generation<br />
Smart. Connected. World.<br />
©2011 <strong>BSQUARE</strong> Corporation. All rights reserved. <strong>BSQUARE</strong> is a registered trademark of <strong>BSQUARE</strong> Corporation.<br />
All other names, product names and trade names are trademarks or registered trademarks of their respective holders.
Thank You!<br />
Michael Chalupa, Field Engineering Manager,<br />
<strong>BSQUARE</strong>