Application Note AN_350 FT800_on_Raspberry_Pi Version 1.0 Issue Date: 2015-02-09 This application note demonstrates a way of interfacing the FT800 to a Raspberry Pi. The FT800 is connected to the USB port of the Raspberry Pi via an MPSSE interface. An application running on the Raspberry Pi communicates with the FT800 through the FTDI Linux D2xx driver. This application note provides a simple example of developing C code to control the FT800, and the principles demonstrated can then be used to produce more complex applications Use of FTDI devices in life support and/or safety applications is entirely at the user’s risk, and the user agrees to defend, indemnify and hold FTDI harmless from any and all damages, claims, suits or expense resulting from such use. Future Technology Devices International Limited (FTDI) Unit 1, 2 Seaward Place, Glasgow G41 1HH, United Kingdom Tel.: +44 (0) 141 429 2777 Fax: + 44 (0) 141 429 2758 Web Site: http://ftdichip.com Copyright © 2015 Future Technology Devices International Limited Application Note AN_350 FT800_on_Raspberry_Pi Version 1.0 Document Reference No.: FT_001129 Clearance No.: FTDI# 439 Table of Contents 1 Introduction .................................................................................................................................... 2 1.1 Scope ..................................................................................................................................... 2 1.2 Software Required ................................................................................................................. 2 1.3 Hardware Required ............................................................................................................... 2 2 Hardware Block Diagram and Connection ...................................................................................... 3 3 Software .......................................................................................................................................... 4 4 3.1 Software Layer Diagram ........................................................................................................ 4 3.2 Sample code (main program is in SampleApp.c) ................................................................... 4 3.3 FT_CoPro_Cmds.h ................................................................................................................. 5 Running the Example ...................................................................................................................... 6 4.1 D2XX Linux Driver installation for Raspberry Pi..................................................................... 6 4.2 Run the FT800 Raspberry Sample Code ................................................................................ 6 5 Test Results ..................................................................................................................................... 7 6 Conclusion ....................................................................................................................................... 8 7 Contact Information........................................................................................................................ 9 Appendix A – References ...................................................................................................................... 10 Document References....................................................................................................................... 10 Acronyms and Abbreviations ............................................................................................................ 10 Appendix B – List of Figures .................................................................................................................. 11 List of Figures .................................................................................................................................... 11 Appendix C – Revision History .............................................................................................................. 12 Product Page Document Feedback 1 Copyright © 2015 Future Technology Devices International Limited Application Note AN_350 FT800_on_Raspberry_Pi Version 1.0 Document Reference No.: FT_001129 Clearance No.: FTDI# 439 1 Introduction This application note documents how to connect a small display to a single board computer (SBC). It uses a Raspberry Pi (RPi) as the SBC and a VM800BU as the FT800 driven small display module. The VM800BU was chosen specifically as it has a USB interface, thus freeing up the RPi SPI ports for other functions. Project source code may be downloaded from this link. The sample project can work for any SBC with Linux OS and VM800BU and will 4 coloured circles as shown in section 5 to demonstrate the connectivity. 1.1 Scope This application can be used for most kinds of SBC with a USB host port and is not limited to the Raspberry Pi. However, the Raspberry Pi was chosen for this demonstration due to the widely available hardware platform and OS images. This document describes how to connect and run an FT800 demo program on a Raspberry Pi system. Creating and configuring a Raspberry Pi board image is beyond the scope of this application note. 1.2 Software Required This sample application requires the following software resources: Raspberry PIDORA (users may use other Linux OS for their systems) FTDI Linux D2XX driver for ARM processors (version 1.1.12 or later). Available from the FTDI drivers page 1.3 Hardware Required Raspberry Pi B+ board (or other SBC systems) with a TF card (4G bytes or more) VM800BU module (see note) USB A to Micro B cable (suggest FTDI accessory VA-FC-1M-BKW or VA-FC-1M-BLW) Note: The VM800BU already includes an on-board USB-SPI interface and is recommended. However a VM800B or VM800C may be connected via an additional USB to SPI bridge such as the C232HM DDHSL-0 cable or VA800A-SPI module or directly to the RPi SPI port. Product Page Document Feedback 2 Copyright © 2015 Future Technology Devices International Limited Application Note AN_350 FT800_on_Raspberry_Pi Version 1.0 Document Reference No.: FT_001129 Clearance No.: FTDI# 439 2 Hardware Block Diagram and Connection This section summarizes the hardware connections used. A VM800BU is shown connected via the USB A to Micro B cable. Figure 2.1 Hardware Block Diagram Product Page Document Feedback 3 Copyright © 2015 Future Technology Devices International Limited Application Note AN_350 FT800_on_Raspberry_Pi Version 1.0 Document Reference No.: FT_001129 Clearance No.: FTDI# 439 3 Software 3.1 Software Layer Diagram The software consists of several different layers, as shown below. The SampleApp.c file is where the actual FT800 application would be created. Users should modify the SampleApp.c file to create different displays. All the Co-processor Engine commands are provided in the project. Refer to Section 3.3 FT_CoPro_Cmds.h for more detail information. Figure 3.1 Software Layer Diagram 3.2 Sample code (main program is in SampleApp.c) The syntax of the sample code is very similar to the FT800 Programmers Guide. Please refer to the following figure for more detail. This is based on the code shown in section 2.5.3 of the FT800 Programmers Guide. Figure 3.2 shows how to draw points with varying radius from 5 pixels to 13 pixels with different colors. Figure 3.2 The real drawing commands of the Sample Code Product Page Document Feedback 4 Copyright © 2015 Future Technology Devices International Limited Application Note AN_350 FT800_on_Raspberry_Pi Version 1.0 Document Reference No.: FT_001129 Clearance No.: FTDI# 439 3.3 FT_CoPro_Cmds.h All available Co-Processor Engine commands are defined in FT_CoPro_Cmds.h Figure 3.3 Parts of Co-Processor Engine commands Product Page Document Feedback 5 Copyright © 2015 Future Technology Devices International Limited Application Note AN_350 FT800_on_Raspberry_Pi Version 1.0 Document Reference No.: FT_001129 Clearance No.: FTDI# 439 4 Running the Example In order to run the example, the FTDI D2xx driver must first be installed. Then, the sample application can be built and run. 4.1 D2XX Linux Driver installation for Raspberry Pi Download D2XX Linux ARM driver (Suitable for Raspberry Pi version 1.1.12 in this application note) tar xvf libftd2xx1.1.12.tar.gz (decompress the D2XX driver) su (switch to root user) cd /release/build/arm926 cp libftd2xx.so.1.1.12 /usr/local/lib ln -sf /usr/local/lib/libftd2xx.so. 1.1.12 /usr/local/lib/libftd2xx.so (Creates a symbolic link to the shared object) 4.2 Run the FT800 Raspberry Sample Code Download the FT800 Raspberry Pi sample code (FT800RPi.tar.gz) tar xvf FT800RPi.tar.gz cd /FT800 Raspberry Pi/Build/Linux/ make rmmod ftdi_sio (remove VCP driver) LD_LIBRARY_PATH=/usr/local/lib ./FT800RPi (run the application) Product Page Document Feedback 6 Copyright © 2015 Future Technology Devices International Limited Application Note AN_350 FT800_on_Raspberry_Pi Version 1.0 Document Reference No.: FT_001129 Clearance No.: FTDI# 439 5 Test Results The image below shows the display produced by the sample code. The resulting display is the same as that shown in section 2.5.3 of the FT800 Programmers Guide. Figure 5.1 Test image displayed on screen Product Page Document Feedback 7 Copyright © 2015 Future Technology Devices International Limited Application Note AN_350 FT800_on_Raspberry_Pi Version 1.0 Document Reference No.: FT_001129 Clearance No.: FTDI# 439 6 Conclusion This application note has demonstrated the way in which a Single Board Computer can be interfaced to the FT800. There are many cases where a Single Board Computer may be used within a product and may require a small display with the possibility of touch and sound functionality, and the FT800 provides a good solution for this. The example uses the Raspberry Pi due to its wide availability and range of resources. The OS images are available from the Raspberry Pi website and debugging can be carried out without additional JTAG interfaces etc. using the monitor attached to the Raspberry Pi. However, the FT800 can be interfaced to many other Single Board Computers. Product Page Document Feedback 8 Copyright © 2015 Future Technology Devices International Limited Application Note AN_350 FT800_on_Raspberry_Pi Version 1.0 Document Reference No.: FT_001129 Clearance No.: FTDI# 439 7 Contact Information Head Office – Glasgow, UK Branch Office – Tigard, Oregon, USA Future Technology Devices International Limited Unit 1, 2 Seaward Place, Centurion Business Park Glasgow G41 1HH United Kingdom Tel: +44 (0) 141 429 2777 Fax: +44 (0) 141 429 2758 Future Technology Devices International Limited (USA) 7130 SW Fir Loop Tigard, OR 97223-8160 USA Tel: +1 (503) 547 0988 Fax: +1 (503) 547 0987 E-mail (Sales) E-mail (Support) E-mail (General Enquiries) [email protected] [email protected] [email protected] E-Mail (Sales) E-Mail (Support) E-Mail (General Enquiries) [email protected] [email protected] [email protected] Branch Office – Taipei, Taiwan Branch Office – Shanghai, China Future Technology Devices International Limited (Taiwan) 2F, No. 516, Sec. 1, NeiHu Road Taipei 114 Taiwan , R.O.C. Tel: +886 (0) 2 8797 1330 Fax: +886 (0) 2 8751 9737 Future Technology Devices International Limited (China) Room 1103, No. 666 West Huaihai Road, Shanghai, 200052 China Tel: +86 21 62351596 Fax: +86 21 62351595 E-mail (Sales) E-mail (Support) E-mail (General Enquiries) E-mail (Sales) E-mail (Support) E-mail (General Enquiries) [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] Web Site http://ftdichip.com System and equipment manufacturers and designers are responsible to ensure that their systems, and any Future Technology Devices International Ltd (FTDI) devices incorporated in their systems, meet all applicable safety, regulatory and system-level performance requirements. All application-related information in this document (including application descriptions, suggested FTDI devices and other materials) is provided for reference only. While FTDI has taken care to assure it is accurate, this information is subject to customer confirmation, and FTDI disclaims all liability for system designs and for any applications assistance provided by FTDI. Use of FTDI devices in life support and/or safety applications is entirely at the user’s risk, and the user agrees to defend, indemnify and hold harmless FTDI from any and all damages, claims, suits or expense resulting from such use. This document is subject to change without notice. No freedom to use patents or other intellectual property rights is implied by the publication of this document. Neither the whole nor any part of the information contained in, or the product described in this document, may be adapted or reproduced in any material or electronic form without the prior written consent of the copyright holder. Future Technology Devices International Ltd, Unit 1, 2 Seaward Place, Centurion Business Park, Glasgow G41 1HH, United Kingdom. Scotland Registered Company Number: SC136640 Product Page Document Feedback 9 Copyright © 2015 Future Technology Devices International Limited Application Note AN_350 FT800_on_Raspberry_Pi Version 1.0 Document Reference No.: FT_001129 Clearance No.: FTDI# 439 Appendix A – References Document References EVE Product Page FT800 Datasheet FT800 Programmers Guide VM800BU Datasheet AN_240 EVE From the Ground Up EVE SampleApp Raspberry Pi Download Project source code Acronyms and Abbreviations Terms Description PIDORA Pidora is a Fedora Remix optimized for the Raspberry Pi computer. SBC A single-board computer (SBC) is a complete computer built on a single circuit board. SPI Serial Peripheral Interface TF Card USB Product Page Document Feedback A TF card stands for a Trans Flash card. Universal Serial Bus 10 Copyright © 2015 Future Technology Devices International Limited Application Note AN_350 FT800_on_Raspberry_Pi Version 1.0 Document Reference No.: FT_001129 Clearance No.: FTDI# 439 Appendix B – List of Figures List of Figures Figure 2.1 Hardware Block Diagram ...................................................................................... 3 Figure 3.1 Software Layer Diagram ....................................................................................... 4 Figure 3.2 The real drawing commands of the Sample Code ..................................................... 4 Figure 3.3 Parts of Co-Processor Engine commands ................................................................. 5 Figure 5.1 Test image displayed on screen ............................................................................. 7 Product Page Document Feedback 11 Copyright © 2015 Future Technology Devices International Limited Application Note AN_350 FT800_on_Raspberry_Pi Version 1.0 Document Reference No.: FT_001129 Clearance No.: FTDI# 439 Appendix C – Revision History Document Title: AN_350 FT800_on_Raspberry_Pi Document Reference No.: FT_001129 Clearance No.: FTDI# 439 Product Page: http://www.ftdichip.com/FTProducts.htm Document Feedback: Send Feedback Revision 1.0 Product Page Document Feedback Changes Initial release Date 2015-02-09 12 Copyright © 2015 Future Technology Devices International Limited