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