Rapid BeagleBoard Prototyping with MATLAB and Simulink Leverage the power of BeagleBoard to develop and deploy practical embedded projects Dr Xuewu Dai Dr Fei Qin BIRMINGHAM - MUMBAI Rapid BeagleBoard Prototyping with MATLAB and Simulink Copyright © 2013 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: October 2013 Production Reference: 1211013 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-84969-604-3 www.packtpub.com Cover Image by Abhishek Pandey ([email protected]) Credits Authors Project Coordinator Dr Xuewu Dai Joel Goveya Dr Fei Qin Proofreader Sandra Hopper Reviewers Ezequiel Aceto Amit Pandurang Karpe Indexer Hemangini Bari Acquisition Editor Joanne Fitzpatrick Graphics Ronak Dhruv Commissioning Editor Mohammed Fahad Production Coordinator Conidon Miranda Technical Editors Menza Mathew Cover Work Conidon Miranda Rohit Kumar Singh About the Authors Dr Xuewu Dai graduated (BEng) in Electronic Engineering and received his MSc in Computer Science, both from the Southwest University, Chongqing, China, in 1999 and 2003, respectively, and completed his PhD study at the School of Electrical and Electronic Engineering, University of Manchester, in 2008. He joined the School of Electronic and Information Engineering, Southwest University, as a Lecturer Assistant in 2002 and did research projects at University College London and University of Oxford. As a researcher and R&D engineer in signal processing and dynamic system modeling, he has over 10 years' experience in MATLAB/Simulink simulation and embedded software development. More recently, he has been actively involved in wireless sensor actuator networks for various research and industrial projects (such as condition monitoring of aircraft engines, buildings, DFIG wind generators, CAN field-bus for SCADA, and optic sensors for water quality monitoring). I would like to thank my wife Liping and my parents for their love, and allowing me to realize my own potential. I would like to thank Joel Goveya and Mohammed Fahad at Packt Publishing for their guidance throughout this process, and Amit Karpe and Ezequiel Aceto for their reviews. Finally, I would also like to acknowledge the partial financial support from the NSFC under grant 61101135. Dr Fei Qin is currently an Assistant Professor in the Department of Electronic and Communications, University of Chinese Academy of Science, Beijing, China. He received his PhD degree from University College London, UK, in 2012. Prior to the start of his PhD, he was working for Crossbow Technology, Beijing Rep. Office as a Sr Application Engineer. He has been working on the development of embedded systems for many different products and applications for almost ten years, including wireless network, sensor, and radar systems. I would like to thank Dr Han, Zhengjun for his kindest advice on the motion detect algorithm, Joel Goveya and Mohammed Fahad at Packt Publishing for their support throughout this process, and Amit Karpe and Ezequiel Aceto for their reviews. About the Reviewers Ezequiel Aceto is a student at University of Buenos Aires (UBA), where he is attending Electronic Engineering and Computer Engineering. Also, he is a member of the Embedded Systems Labs at UBA. He has more than eight years' experience of programming for mobile platforms like RIM's Blackberry, Google's Android, Apples iOS, and J2ME-enabled phones. Nowadays he works as CTO and Senior Developer at Everypost (http:// everypost.me). Everypost is a mobile application that allows you to easily create multimedia content and post it simultaneously to your preferred social networks. His first approach to embedded systems was at the age of 15 with the small BASIC Stamp I. And since then, he has worked with all kinds of microcontrollers (8-, 16-, and 32-bit) and programming languages, including BASIC, Assembly, C, C++, Java, Python, and Objective C. He writes blog posts about embedded systems and mobile technologies at www. ezequielaceto.com.ar. Amit Pandurang Karpe works for FireEye Inc., a global information security company, as a support engineer supporting their Asia-Pacific customers. He lives in Singapore with his wife, Swatee, and son, Sparsh. He has been active in the open source community from his college days, especially in Pune, where he was able to organize various activities with the help of vibrant and thriving communities such as PLUG, TechPune, ITMilan, Embedded Nirvana, and so on. Currently he is working with the books "Getting Started with Cubieborad" and "Mastering Kali Linux for Advanced Penetration Testing". I would like to thank the open source community without whom I couldn't have succeeded. A special thanks to the visionaries behind "BeagleBoard Project", who believed in open source hardware and led by example. Many thanks also to the community members, who keep doing a great job, which makes BeagleBoard a success. I would like to thank the Packt Publication team, editors, project coordinator who keep doing the right things, so I can do my job to the best of my abilities. I would like thank Pune Linux Users Group (PLUG), Embedded Group, and VSS friends, because of whom I am able to work on this project. I would also like to thank all my gurus, who helped me, and guided me in this field—Dr Vijay Gokhale, Sunil Dhadve, Sudhanwa Jogalekar, Bharathi Subramanian, Mohammed Khasim, and Niyam Bhushan. Finally I would like to thank my family, my mother, my father, my brother, my son, and my wife, Swatee, without whose continuous support I could not have given my best efforts to this project. www.PacktPub.com Support files, eBooks, discount offers and more You might want to visit www.PacktPub.com for support files and downloads related to your book. Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks. TM http://PacktLib.PacktPub.com Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books. Why Subscribe? • Fully searchable across every book published by Packt • Copy and paste, print and bookmark content • On demand and accessible via web browser Free Access for Packt account holders If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access. Table of Contents Preface 1 Chapter 1: Introducing BeagleBoard 7 A quick overview of this book 7 BeagleBoard-xM 8 BeagleBoard for rapid prototyping 11 Summary 12 Chapter 2: Installing Linux on the BeagleBoard 13 Setting up the hardware 14 Compulsory hardware 14 Required hardware for rapid prototyping in this book 15 Connecting our components 15 Installing software and tools on a Windows 7 PC 16 Target and host PC systems 16 Finding the COM port for a RS232-USB adapter cable 17 Configuring the IP address of the host PC 18 Installing MATLAB and the BeagleBoard support package 20 What are MATLAB and Simulink 20 Why we use MATLAB/Simulink for rapid prototyping 21 Installing Ubuntu for BeagleBoard on a Windows 7 PC 23 Configuring BeagleBoard 24 First interaction with the BeagleBoard 25 Installing PuTTY on a Windows PC 26 Logging into BeagleBoard from a Windows PC 26 Logging in via a serial-USB connection 28 Using Win32 Disk Imager to create multiple microSD cards 29 Summary 30