Home

AN_374 FT90x UART to SPI Bridge

image

Contents

1. n 9 Document References seco uass vau vev eve uuEEE ER RERERENR ERREEEVEFENSUEFEEEEENEKES 9 Acronyms and ADDFGVIAEIORS sessio acc os Rang Voca aci aca wo CR RR C 9 Appendix B List of Tables amp Figures 10 LISt OF TaDIiGS cisiesvivisietrivbb erivbbye Urb vbbrCUPEvbEEEUPEFPEECUPPFEEEEUPLVEEESUP PVP 10 LISE TFS uisopipEROOEVETADUENIKDODCEUDOELCUE REDE KIURAIORRR UE UE VIVI NRI aD MA 10 Appendix C Revision History eee 11 1 Product Page Document Feedback Copyright 2015 Future Technology Devices International Limited iM Application Note FTDI AN_374 FT90x UART to SPI Bridge Chip Version 1 0 Document Reference No FT 001170 Clearance No FIDI 448 1 Introduction This Application Note describes and explains the FT90x UART to SPI Bridge The FT90x UART to SPI Bridge allows the SPI Master device on the FT90x chip to be controlled via commands issued over a UART 1 1 Overview This document describes the design and implementation of the FT90x UART to SPI Bridge The FT90x UART to SPI Bridge allows a user to transmit and receive bytes over the SPI Master This document is intended to demonstrate the bridging capabilities of the FT90x family of microcontrollers 1 2 License Copyright 2015 Future Technology Devices International Ltd This source code the Software is provided by Future Technology Devices International Limited
2. FTDI subject to the license terms set out http www ftdichip com FTSourceCodeLicenceTerms htm the License Terms You must read the License Terms before downloading or using the Software By installing or using the Software you agree to the License Terms If you do not agree to the License Terms then do not download or use the Software Without prejudice to the License Terms here is a summary of some of the key terms of the License Terms and in the event of any conflict between this summary and the License Terms then the text of the License Terms will prevail The Software is provided as is There are no warranties or similar in relation to the quality of the Software You use it at your own risk The Software should not be used in or for any medical device system or appliance There are exclusions of FTDI liability for certain types of loss such as special loss or damage incidental loss or damage indirect or consequential loss or damage loss of income loss of business loss of profits loss of revenue loss of contracts business interruption loss of the use of money or anticipated savings loss of information loss of opportunity loss of goodwill or reputation and or loss of damage to or corruption of data There is a monetary cap on FTDT s liability The Software may have subsequently been amended by another user and then distributed by that other user Adapted Software If so that user may have additional license te
3. FTDI Chip N y Application Note AN 374 FT90x UART to SPI Bridge Version 1 0 Issue Date 2015 10 06 This note describes the implementation and usage of the FT90x UART to SPI Master bridge 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 y 7 Application Note FTDI AN_374 FT90x UART to SPI Bridge Chip Version 1 0 Document Reference No FT 001170 Clearance No FIDI 448 a Table of Contents L IntFOOUCUOD 22 2223224223992 82002892 48 824 RR SIE SRRARASEUMKIIM STE 2 LL OVerVIB vere 2 1 2 LICENCO ones exxa ex Rea xRRERRRARRRERRERRRRERREERRRERRRERERERRRERRRRRRRRRRRRERRREE EA 2 2 Proud 3 3 Inplementdtroliosscasrpes vene np wann anna RERO RE EN 4 3 1 SENG 4 Siz TOSTE LOG AN 5 4 Usmg ME GUL menn 6 4 1 Selecting a Serial Port uunnnnnnnnnnnnnnnnnnnnnnnnnnunnnnnnnnunnuvnnnnnne 6 4 2 Transferring Data 4 6 4 3 Troubleshootng scorrere 7 5 Contact Information s ss 8 Appendix A References
4. and Hexadecimal numbers need to be separated by spaces and only numbers from 0 to 255 FF are usable 7 Product Page Document Feedback Copyright 2015 Future Technology Devices International Limited Application Note FTDI AN_374 FT90x UART to SPI Bridge Chie Version 1 0 Document Reference No FT 001170 Clearance No FIDI 448 5 Contact Information Head Office Glasgow UK Branch Office Tigard Oregon USA Future Technology Devices International Limited Future Technology Devices International Limited Unit 1 2 Seaward Place Centurion Business Park USA Glasgow G41 1HH 7130 SW Fir Loop United Kingdom Tigard OR 97223 8160 Tel 44 0 141 429 2777 USA Fax 44 0 141 429 2758 Tel 1 503 547 0988 Fax 1 503 547 0987 E mail Sales sales1 ftdichip com E mail Support supporti ftdichip com E Mail Sales us salesQftdichip com E mail General Enquiries admini ftdichip com E Mail Support us Support ftdichip com E Mail General Enquiries us admin ftdichip com Branch Office Taipei Taiwan Branch Office Shanghai China Future Technology Devices International Limited Future Technology Devices International Limited Taiwan China 2F No 516 Sec 1 NeiHu Road Room 1103 No 666 West Huaihai Road Taipei 114 Shanghai 200052 Taiwan R O C China Tel 886 0 2 8791 3570 Tel 86 21 62351596 Fax 886 0 2 8791 3576 Fax 86 21 62351595 E mail Sales tw sales1 ftdichip com E mail Sales cn
5. the UART to SPI Bridge can be used This application is located within ui exe with the accompanying source located at ui src In order to launch the application double click on the app jar file located within ui exe 4 1 Selecting a Serial Port When opening the GUI application the first window that appears will ask you to choose which serial port to use Application Note Product Page 2015 Future Technology Devices International Ltd Figure 3 Serial Port Selection Window Example Figure 3 Serial Port Selection Window Example shows an example of a Serial Port Selection Window Within it are these main controls 1 2A The Serial Port combo box Use this to select which serial port to use The Refresh button If the serial port you wish to use is not shown then it is currently in use by another application After freeing up the serial port you wish to use click this button to cause the GUI application to rescan for available serial ports The OK button Click this to confirm your selection and progress to the next screen Links Some links to the FT90x product page and a link to the application note corresponding to this application 4 2 Transferring Data After selecting a serial port the GUI will show the SPI Transfer Window shown in Figure 4 SPI Transfer Window Example Within this window are these main controls 1 eS Transmit Format This control selects which format the input in the Transmit Te
6. 374 FT90x UART to SPI Bridge Chie Version 1 0 Document Reference No FT 001170 Clearance No FTDIZ 448 The function setup location in main c will call setup uart and setup spi in order to set up the UART for 19200 baud and set up the SPI Master for channel SPI SSx defined at the top of main c SPI Mode 0 and a divider of 16 fclk 100MHz 16 16 667 MHz void setup Enable the UART Device setup uart UART DIVIDER 19200 BAUD Enable the SPI Device setup spi SPI SSx spi mode 0 16 Table 3 Code listing for setup 3 2 Transfer Logic The function loop located in main c is the main logic for transferring SPI data void loop static uint8 t bytes static uint8 t c uart read UARTO amp c if bytes 0 bytes C spi_open SPIM spi_channel else spi_write SPIM c spi_read SPIM amp c bytes if bytes 0 spi close SPIM spi channel uart write UARTO c Table 4 Code listing for loop This will implement the behavior shown in Figure 2 Timing Diagram for a SPI Transfer 5 Product Page Document Feedback Copyright 2015 Future Technology Devices International Limited y Application Note FTDI AN_374 FT90x UART to SPI Bridge Chip Version 1 0 Document Reference No FT 001170 Clearance No FIDI 448 4 Using the GUI A Java based GUI application is provided with this Application Note as an example of how
7. or IOC OC ascisqesbuxtebrduttbd n Ue Cad ioc erkba a a sacs tev ri dani 5 List of Figures Figure d DART t PN 3 Figure 2 Timing Diagram for a SPI Transfer s sssssasssassnssnnnnansnnsnnunannsnnnnnnssnnnnannnnnnnnnannnnann 3 Figure 3 Serial Port Selection Window Example cene nennen nnn nnn nnn nnn nn nnn 6 Figure 4 SPI Transfer Window Example sssssssssseee n nnnm annee nnns 7 10 Product Page Document Feedback Copyright 2015 Future Technology Devices International Limited Application Note FTDI AN_374 FT90x UART to SPI Bridge Chip Version 1 0 Document Reference No FT 001170 Clearance No FTDIZ 448 Appendix C Revision History Document Title AN 374 FT90x UART to SPI Bridge Document Reference No FT 001170 Clearance No FTDI 448 Product Page http www ftdichip com FTProducts htm Document Feedback Send Feedback Initial Release 2015 10 06 11 Product Page Document Feedback Copyright 2015 Future Technology Devices International Limited
8. re are located in the src directory 3 1 Setup The setup_uart function location in main c will set up UARTO and apply a given divider as well as set the UART for 8 data bits no parity and 1 stop bit void setup uart uinti16 t divider sys enable sys device uart0 gpio function 48 pad uart txd UARTO TXD gpio function 49 pad uart rxd UART RXD uart open UART Device 1 Prescaler 1 divider uart data bits 8 No Data Bits uart parity none Parity uart stop bits 1 No Stop Bits Table 1 Code listing for setup uart The setup spi function located in main c sets up the SPI Master device for a given channel mode and divider void setup spi uint8 t channel spi clock mode t mode uint16 t divider Enable the SPI Device sys enable sys device spi master gpio function 27 pad spim sck gpio function 28 pad spim sse gpio function 29 pad spim mosi gpio function 30 pad spim miso gpio function 31 pad spim io2 gpio function 32 pad spim io3 gpio function 33 pad spim ssi gpio function 34 pad spim ss2 gpio function 35 pad spim ss3 spi channel channel if 1 spi init SPIM spi dir master mode divider uart puts UARTO spi init ERROR r n Table 2 Code listing for setup spi 4 Product Page Document Feedback Copyright 2015 Future Technology Devices International Limited Application Note FTDI AN_
9. rms that apply to those amendments However FTDI has no liability in relation to those amendments 2 Product Page Document Feedback Copyright 2015 Future Technology Devices International Limited Application Note FTDI AN_374 FT90x UART to SPI Bridge Chip Version 1 0 Document Reference No FT 001170 Clearance No FIDI 448 2 Protocol The FT90x UART to SPI Bridge protocol is broken up into two parts the length and the payload The length is sent first as a single byte this indicates the number of payload bytes which will follow this An example of a packet is shown in Figure 1 UART to SPI Packet Format Figure 1 UART to SPI Packet Format Upon receiving the Length byte the SPI Master will assert the relevant SS Slave Select line low With every Data byte this byte will be sent out on SPI and the received byte will be sent back over the UART as shown in Figure 2 Timing Diagram for a SPI Transfer RXD Out 2 J M Out 3 _Out 4 je Figure 2 Timing Diagram for a SPI Transfer This format was chosen in order to facilitate multi byte transfers required by modern SPI devices 3 Product Page Document Feedback Copyright 2015 Future Technology Devices International Limited Application Note FTDI AN_374 FT90x UART to SPI Bridge Chip Version 1 0 Document Reference No FT 001170 Clearance No FIDI 448 3 Implementation All the source files for the FT90x firmwa
10. sales ftdichip com E mail Support tw supporti ftdichip com E mail Support cn support ftdichip com E mail General Enquiries tw admini ftdichip com E mail General Enquiries cn admin ftdichip com Web Site http ftdichip com Distributor and Sales Representatives Please visit the Sales Network page of the FTDI Web site for the contact details of our distributor s and sales representative s in your country 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 Nei
11. ther 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 8 Product Page Document Feedback Copyright 2015 Future Technology Devices International Limited Application Note FTDI AN_374 FT90x UART to SPI Bridge Chip Version 1 0 Document Reference No FT 001170 Clearance No FIDI 448 Appendix A References Document References FI900 901 902 903 Datasheet FI905 906 907 908 Datasheet FT900 User Manual FI900 code source Windows utility Acronyms and Abbreviations 9 Product Page Document Feedback Copyright 2015 Future Technology Devices International Limited Application Note FTDI AN_374 FT90x UART to SPI Bridge Chip Version 1 0 Document Reference No FT 001170 Clearance No FTDIZ 448 Appendix B List of Tables amp Figures List of Tables Table 1 Code listing for Setup Uart i223 eara Dekakas urrRrbbkR ExKdkk prar cibifrxixdag aaa daa Esc ERR EY akkar bid 4 Table 2 Code listing for setup SDN eee 4 Table 3 Code listing for setup sssssssssssssssssssssnssnesnssnennsnnssnssnennsenennsnnennssnesnrenennesneenesnennne 5 Table 4d Code STING T
12. xt Box 2 should be parsed as Transmit Text Box This is the data to be transmitted Each line represents a separate transfer Transmit Button Clicking this button will start the transfer Clear Button Clicking this button will clear the Transmit Text Box 2 Load Button Clicking this button will allow the user to load in a text file into the Transmit Text Box 2 Received Format This control selects which format the input in the Received Text Box 7 should be displayed as Changing this option will automatically update the Text Box without having to start another transfer 6 Product Page Document Feedback Copyright 2015 Future Technology Devices International Limited Application Note FTDI AN_374 FT90x UART to SPI Bridge Chip Version 1 0 Document Reference No FT 001170 Clearance No FTDIZ 448 7 Received Text Box This is the data received over SPI Each line represents a separate transfer 8 Status Bar This will display any errors or a copyright notice if no errors have occurred in this transfer FT90x UART to SPI Bridge Transmit Format Text j Using COMED Clear Format Text 2015 Future Technology Devices International Ltd Figure 4 SPI Transfer Window Example 4 3 Troubleshooting Q I get Error Unknown Number For input string at the bottom of the window when trying to transmit A You have either entered a number in the wrong format or it is too large Decimal

Download Pdf Manuals

image

Related Search

Related Contents

carnet naturaliste - Bretagne Vivante  USER`S MANUAL    24”, 30” and 36” Electric Radiant Cooktops Tables  FlexTest SE Controller Service  Guida all`opzione Disaster Recovery  Eglo BOLTANA  Capitolo 2 Uso dell`Editor etichetta  Atelier photo nature  Moyno® Metering/Dosing Pump :: Service Manual (Closed  

Copyright © All rights reserved.
Failed to retrieve file