AN_360 FT900 Example Applications

Application Note
AN_360
FT90x Example Applications
Version 1.2
Issue Date: 2016-02-24
This note describes the example applications provided for the FT90x and
demonstrates the use of the FT90x Peripheral Driver Library.
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 © Future Technology Devices International Limited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
Table of Contents
1 Introduction ............................................................ 4
1.1 Overview.......................................................................... 4
2 Installation and Programming.................................. 5
2.1 FT90x Toolchain Installation ............................................. 5
2.2 Importing the Examples ................................................... 5
2.3 Building the FT900 Example Applications .......................... 5
2.4 Programming ................................................................... 5
3 Examples ................................................................ 7
3.1 ADC Examples .................................................................. 7
3.1.1
ADC Example 1 ...................................................................................................... 7
3.1.2
ADC Example 2 ...................................................................................................... 8
3.2 BCD Examples .................................................................. 9
3.2.1
BCD Example 1 ...................................................................................................... 9
3.3 Camera Examples ........................................................... 10
3.3.1
Camera Example 1 ............................................................................................... 10
3.4 CAN Examples ................................................................ 11
3.4.1
CAN Example 1 .................................................................................................... 11
3.4.2
CAN Example 2 .................................................................................................... 13
3.4.3
CAN Example 3 .................................................................................................... 13
3.5 D2XX Examples .............................................................. 15
3.5.1
D2XX Example 1 .................................................................................................. 15
3.6 DAC Examples ................................................................ 17
3.6.1
DAC Example 1 .................................................................................................... 17
3.6.2
DAC Example 2 .................................................................................................... 18
3.6.3
DAC Example 3 .................................................................................................... 18
3.7 DLOG Example ................................................................ 20
3.8 Ethernet Examples.......................................................... 23
3.8.1
Ethernet Example 1 .............................................................................................. 23
3.9 FreeRTOS Examples ........................................................ 25
3.9.1
Setup (common for all FreeRTOS projects) ........................................................... 25
1
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.9.2
FreeRTOS Example 1 ............................................................................................ 27
3.9.3
FreeRTOS Example 2 ............................................................................................ 28
3.9.4
FreeRTOS Example 3 ............................................................................................ 30
3.10
GPIO Examples ............................................................ 33
3.10.1
GPIO Example 1 ................................................................................................... 33
3.10.2
GPIO Example 2 ................................................................................................... 33
3.10.3
GPIO Example 3 ................................................................................................... 34
3.11
I2C Master Examples .................................................... 35
3.11.1
I2C Master Example 1 ........................................................................................... 35
3.11.2
I2C Master Example 2 ........................................................................................... 36
3.12
3.12.1
3.13
I2C Slave Examples....................................................... 38
I2C Slave Example 1 ............................................................................................. 38
I2S Examples................................................................ 40
3.13.1
I2S Example 1 ...................................................................................................... 40
3.13.2
I2S Example 2 ...................................................................................................... 40
3.14
PWM Examples............................................................. 42
3.14.1
PWM Example 1 ................................................................................................... 42
3.14.2
PWM Example 2 ................................................................................................... 42
3.14.3
PWM Example 3 ................................................................................................... 43
3.15
3.15.1
3.16
3.16.1
3.17
Real Time Clock Examples ............................................ 44
RTC Example 1..................................................................................................... 44
SD Host Examples ........................................................ 45
SD Host Example 1 .............................................................................................. 45
SPI Master Examples .................................................... 47
3.17.1
SPI Master Example 1 .......................................................................................... 47
3.17.2
SPI Master Example 2 .......................................................................................... 48
3.17.3
SPI Master Example 3 .......................................................................................... 50
3.18
3.18.1
3.19
SPI Slave Examples ...................................................... 52
SPI Slave Example 1 ............................................................................................ 52
Timer Examples............................................................ 54
3.19.1
Timer Example 1 .................................................................................................. 54
3.19.2
Timer Example 2 .................................................................................................. 54
3.19.3
Timer Example 3 .................................................................................................. 55
2
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
3.20
C learance N o.: FT DI# 4 5 1
UART Examples ............................................................ 57
3.20.1
UART Example 1................................................................................................... 57
3.20.2
UART Example 2................................................................................................... 57
3.20.3
UART Example 3................................................................................................... 58
3.21
USB Device Examples ................................................... 59
3.21.1
GPIO DFU Example............................................................................................... 59
3.21.2
USBD Example BOMS to SD Card ......................................................................... 61
3.21.3
USBD Example HID .............................................................................................. 62
3.21.4
USBD Example HID Bridge ................................................................................... 63
3.21.5
USBD Example CDCACM....................................................................................... 64
3.22
USB Host Examples ...................................................... 66
3.22.1
USBH_Example Hub ............................................................................................. 66
3.22.2
USBH Example HID .............................................................................................. 67
3.22.3
USBH Example CDCACM....................................................................................... 68
3.22.4
USBH Example BOMS ........................................................................................... 69
3.22.5
USBH Example File System................................................................................... 70
3.22.6
AOA Examples...................................................................................................... 73
3.23
3.23.1
Watchdog Timer Examples............................................ 80
Watchdog Example 1 ............................................................................................ 80
4 Contact Information .............................................. 81
Appendix A – References ........................................... 82
Document References ............................................................ 82
Acronyms and Abbreviations .................................................. 82
Appendix B – List of Tables & Figures ......................... 83
List of Tables ......................................................................... 83
List of Figures ........................................................................ 83
Appendix C – Revision History .................................... 84
3
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
1 Introduction
The FT90x Peripheral Driver Library (libft900) is a collection of ‘C’ language based functions that
abstract away from the bare metal and presents the programmer with an easy to use API which
will allow the programmer to develop applications quickly and easily.
Figure 1: FT90x Interface driver support shows the overall FT90x Interface driver support. This
document focuses on the Hardware Interface Driver layer to show examples of usage. All drivers
will be provided as source code for easy adaptation and modification.
Figure 1: FT90x Interface driver support
1.1 Overview
This document describes the construction and execution of the FT90x example programs and is
intended to educate end users in the programming of the FT90x using FTDI’s FT90x Driver
Libraries in order to lower developme nt time and deliver higher quality applications .
A number of examples are given for various FT90x Peripherals:

















Analogue to Digital Converter (ADC)
Camera Interface
CAN
Digital to Analogue Converter (DAC)
Ethernet
General Purpose I/O (GPIO)
I2C Master
I2C Slave
I2S
Pulse Width Modulation (PWM)
Real Time Clock
SD Host
SPI Master
SPI Slave
Timer
Universal Asynchronous Receiver Transmitter (UART)
Watchdog
4
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
2 Installation and Programming
2.1 FT90x Toolchain Installation
Please refer to AN_325 FT900 Toolchain Installation Guide for instruction on how to install the
FT90x GCC toolchain.
2.2 Importing the Examples
Within Eclipse, select File  Import  General  Existing Projects into Workspace. Browse to the
FT90x examples directory (C:\Users\Username\Documents\FTDI\FT90x\version\Examples). Select
and click OK. The projects should appear in the Project Explorer.
2.3 Building the FT900 Example Applications
To build the example applications:

Right click the Project and click ‘Build Project’.
OR

With the Project selected, click the Build Icon (
).
Note that you can also clean the project by right clicking on the project and selecting ‘Clean’.
2.4 Programming
For every example there will be a corresponding binary file (e.g. uart_example1.c will compile to
uart_example1.bin). Note that an .elf file is also created but this should not be used for
programming as this used for debugging purposes.
To program a specific application into the memory of an FT90x device, create an ‘External Tool
Configuration’ via the Run menu within Eclipse . Please see AN_325 FT900 Toolchain Installation
Guide for details.
Alternatively you can use FTDI’s free FT90x Programming Utility shown in Figure 2. This can be
accessed via the ‘FT900Prog GUI Launcher’ shortcut created on the desktop or under the ‘FTDI
Utilities’ menu in Eclipse.
5
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
Figure 2: FT90x Programming Utility
6
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3 Examples
Some of the examples require the user to connect a USB to Serial converter to UART0 as this port
is used to send and receive text. The terminal settings should be 19200 baud rate, unless
otherwise a specific baudrate is mentioned in the example. Rest of the settings is 8 data bits, no
parity and 1 stop bit. Flow control is not enabled.
Minimum UART0 connections are:


UART0_TXD/GPIO48: available via CN3 Pin 4 on FT90x EVM
UART0_RXD/GPIO49: available via CN3 Pin 6 on FT90x EVM
FTDI have a range of suitable cables available like the TTL-232R-3V3 available from
http://www.ftdichip.com/Products/Cables.htm.
The terminal program used in these tests was PuTTY. However, any VT100 compatible terminal
emulator can be used.
Additionally,
some
examples
require
the
use
of
a
Bus
(http://dangerousprototypes.com/docs/Bus_Pirate ) in order to provide stimulus.
Pirate
3.1 ADC Examples
3.1.1 ADC Example 1
3.1.1.1 Purpose
The purpose of adc_example1.c is to continuously poll the ADC for a new value and display it to
the user.
3.1.1.2 Setup
Connect as shown in Figure 3
1. Connect a voltage source to the GPIO6/CAM_XCLK/ADC1 pin which can be found on
connector CN3 Pin 30 of the FT90x EVM. This could be a potentiometer with the ends
connected to 3.3V and GND, with the wiper connected to GPIO6/CAM_XCLK/ADC1.
3.3V
GPIO6/CAM_XCLK/ADC1
POT1
100K
GND
Figure 3: Circuit Diagram for ADC Examples
Additionally, connect a USB to Serial converter to UART0 as this port is used to send debug text.
7
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.1.1.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to ADC Example 1...
Poll ADC 1 continuously.
--------------------------------------------------------------------ADC 1 = 0000
2. Apply a voltage between 0 and 3.3V to GPIO6/CAM_XCLK/ADC1. This should cause the
value to change. For example,
3.
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to ADC Example 1...
Poll ADC 1 continuously.
--------------------------------------------------------------------ADC 1 = 0123
Note that 1023 (0x3FF) is the maximum value since this is a 10 bit ADC.
3.1.2 ADC Example 2
3.1.2.1 Purpose
The purpose of adc_example2.c is to use an interrupt to update a variable with the latest reading
from the ADC and display it to the user.
3.1.2.2 Setup
Refer to 3.1.1.2 Setup Section.
3.1.2.3 Execution
Refer to 3.1.1.3 Execution Section.
8
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.2 BCD Examples
3.2.1 BCD Example 1
3.2.1.1 Purpose
The purpose of the example is to display the type of charging port that the FT900 device is
connected to. The various charging ports that BCD Device mode in FT900 can detect are
Standard Downstream Port (SDP), Dedicated Charging Port (DCP) and Charging Downstream Port
(CDP).
3.2.1.2 Setup
Connect a USB to Serial converter to UART0 as this port is used to send debug text. Connect the
FT900 USB device port to a SDP port of USB host, or connect to DCP ports of a USB power sources
like Wall Warts, auto adapters and power banks.
Note: The MM900EVx module should be powered via CN2 (JST connector) for the example to
operate correctly.
3.2.1.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to BCD Example...
Displays the charging port that the USB device is connected to ...
--------------------------------------------------------------------2. The type of charging port detected is displayed. When connected to USB host like laptops
or desktops, following is displayed
SDP mode found
Or as
DCP mode found
when connected to power sources like power bank or wall warts.
9
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.3 Camera Examples
3.3.1 Camera Example 1
3.3.1.1 Purpose
The purpose of this example is to demonstrate how to interface a n 8-bit camera with the FT90x.
The MM900EV2A / MM900EV3A come with an Omni vision OV9655 Color Camera.
3.3.1.2 Setup
Connect an Omni vision OV9655 or OV7670 camera to the camera interface of the FT90x if not
already connected to CN13 or CN14 on the FT90x EVM.
Connect a USB to Serial converter to UART0 as this port is used to send debug text.
3.3.1.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to Camera Example 1...
Get a frame from an OV7670 and print it out to the console.
--------------------------------------------------------------------2. A countdown should appear to allow the camera to auto adjust,
3...2...1...
3. The size of the resulting image will be displayed followed by an ASCII art output of the
captured frame,
36 by 62 ASCII Art
10
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.4 CAN Examples
3.4.1 CAN Example 1
3.4.1.1 Purpose
The purpose of this example is to transmit CAN messages between CAN0 and CAN1 and poll for
the response.
3.4.1.2 Setup
Connect CAN0 and CAN1 together through CAN transceivers (e.g., Microchip MCP2562) to allow for
each CAN interface to send messages to each other.
Note that the FT90x EVM hardware does not have CAN transceivers onboard so these need to be
externally connected.
Connect the following as shown in Figure 4
1. Connect GPIO18/CAN1_RXD (found via connector CN3 Pin 40 on the
RXD pin of IC1.
2. Connect GPIO17/CAM_D0/CAN1_TXD (found via connector CN3 Pin 38
to the TXD pin of IC1.
3. Connect GPIO16/CAM_D1/CAN0_RXD (found via connector CN3 Pin 37
to the RXD pin of IC2.
4. Connect GPIO15/CAM_D2/CAN0_TXD (found via connector CN3 Pin 36
to the TXD pin of IC2.
5. Connect the CANH pins of IC1 and IC2.
6. Connect the CANL pins of IC1 and IC2.
7. Connect the VIO pins of IC1 and IC2 to 3.3V.
8. Connect the VDD pins of IC1 and IC2 to 5V.
9. Connect the VSS and STBY pins of IC1 and IC2 to GND.
10. (Optionally) Connect a 120Ω Resistor between CANH and CANL
FT90x EVM) to the
on the FT90x EVM)
on the FT90x EVM)
on the FT90x EVM)
11
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
3.3V
GPIO17/CAM_D0/CAN1_TXD
GND
3.3V
5V
IC1
VIO
GPIO18/CAN1_RXD
VDD
RXD
CANH
TXD
CANL
VSS
STBY
MCP2562
5V
VDD
GPIO16/CAM_D1/CAN0_RXD
RXD
CANH
GPIO15/CAM_D2/CAN0_TXD
TXD
CANL
VSS
STBY
GND
MCP2562
R1(1)
120
GND
IC2
VIO
C learance N o.: FT DI# 4 5 1
GND
Note 1: Optional 120 Ohm Terminating Resistor
Figure 4: Circuit diagram for CAN Examples
Additionally, connect a USB to Serial converter to UART0 as this port is used to send debug text.
3.4.1.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to CAN Example 1...
Send and Receive messages between CAN0 and CAN1 and poll the response.
--------------------------------------------------------------------2. Messages should begin to be transmitted between CAN0 and CAN1,
CAN0
CAN1
CAN1
CAN0
TX->
RX<TX->
RX<-
ID=_____0x123
ID=_____0x123
ID=_____0x123
ID=_____0x123
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
{0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01}
{0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01}
Errors can occur when running this example. If an error occurs, a prompt will output the current
error code in a readable format. For example:
Error whilst Transmitting :
RX_WRN: Receive Warning. The number of receive errors is >= 96
TX_WRN: Transmit Warning. The number of transmit errors is >= 96
ACK_ERR: Acknowledge Error Occurred
FRM_ERR: Form Error Occurred
CRC_ERR: CRC Error Occurred
STF_ERR: Stuff Error Occurred
BIT_ERR: Bit Error Occurred
12
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.4.2 CAN Example 2
3.4.2.1 Purpose
The purpose of this example is to transmit CAN messages from CAN0 and show that they can be
filtered on CAN1.
3.4.2.2 Setup
Refer to 3.4.1.2 Setup Section.
3.4.2.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
----------------------------------------------------------------- ---Welcome to CAN Example 2...
Filter CAN messages arriving at CAN1.
--------------------------------------------------------------------2. Messages should begin to be transmitted between CAN0 and CAN1,
Transmitting
50 unwanted messages
Transmitting
1 wanted messages
There is 1 message available on CAN1
CAN1 RX-> ID=_____0x123
{0x48,0x45,0x4c,0x4f,0x57,0x52,0x4c,0x44}
3.4.3 CAN Example 3
3.4.3.1 Purpose
The purpose of this example is to show how CAN messages can be received and processed using
interrupts.
3.4.3.2 Setup
Refer to 3.4.1.2 Setup Section.
3.4.3.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to CAN Example 3...
Receive messages via an interrupt on CAN1.
--------------------------------------------------------------------2. Messages should begin to be transmitted between CAN0 and CAN1,
13
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
CAN0 TX-> ID=_____0x123
CAN1 RX<- ID=_____0x123
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
CAN0 TX-> ID=_____0x123
CAN1 RX<- ID=_____0x123
{0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
{0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
CAN0 TX-> ID=_____0x123
CAN1 RX<- ID=_____0x123
{0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00}
{0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00}
CAN0 TX-> ID=_____0x123
CAN1 RX<- ID=_____0x123
{0x03,0x02,0x01,0x00,0x00,0x00,0x00,0x00}
{0x03,0x02,0x01,0x00,0x00,0x00,0x00,0x00}
14
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.5 D2XX Examples
3.5.1 D2XX Example 1
3.5.1.1
Purpose
The purpose of this example is to demonstrate that FT900 device brings itself as a FTDI D2XX
device to the host PC and the data is sent back and forth on the D2XX channel, between a terminal
PC application and the User Firmware application.
3.5.1.2
Setup
Connect the FT900 development board programmed with D2XX_Example 1.bin to the host PC via
USB. Install the drivers required. The default VID and PID combination is included in FTDI driver
release 2.12.14 and greater. See Drivers and Installation Guides for further information.
Additionally, connect a USB to Serial converter to UART0 as this port is used to send debug text.
Open up terminal PC application program for UART0 with following port setting 19200 baud, no
parity, 8 data bits, and 1 stop bit.
3.5.1.3
Execution
1. A welcome message should appear like so,
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to D2XX Example 1...
Enter any text on the D2XX port, the same is echoed back on the same port…
--------------------------------------------------------------------D2xx_loopback_test1: D2XX_Init() called, Result: 0
D2xx_loopback_test1: D2XX_EVT_READY is received
D2xx_loopback_test1: D2XX_EVT_RESET is received
2. When the host D2XX drivers are installed and D2XX interfaces are detected. This should
cause the USB serial ports corresponding to the D2XX channels to appear.
3. Open the serial port corresponding to the D2XX channel in the terminal application. Enter
some text and the same text is received on the USB serial port.
15
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
Figure 5: D2XX Port opened in the PC Terminal application
The default settings can be changed using the FT900 Programming GUI Utility’s D2XX tab:
Figure 6: FT900 Programming Utility D2XX Tab
16
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.6 DAC Examples
3.6.1 DAC Example 1
3.6.1.1 Purpose
The purpose of this example is to demonstrate the DAC operating in a single shot mode.
3.6.1.2 Setup
Connect GPIO14/CAM_D3/DAC0 (found via connector CN3 Pin 35 on the FT90x EVM) to an
oscilloscope. Also connect GND.
Connect a USB to Serial converter to UART0 as this port is used to send debug text.
3.6.1.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to DAC Example 1...
Cycle through a series of values outputting them to the DAC in
single shot mode.
The values will be output on DAC0
-------------------------------------------------------------- ------2. An analogue wave should appear on GPIO14/CAM_D3/DAC0 as shown in Figure 7.
Figure 7: Output from dac_example1.c
17
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.6.2 DAC Example 2
3.6.2.1 Purpose
The purpose of this example is to demonstrate the DAC operating in a continuous mode, and
polling the DAC to see if new data is needed.
3.6.2.2 Setup
Refer to 3.6.1.2 Setup Section.
3.6.2.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to DAC Example 2...
Output a series of values in continuous mode by polling the DAC.
The values will be output on DAC0
--------------------------------------------------------------------2. A 24 kHz Sine wave should appear on GPIO14/CAM_D3/DAC0 as shown in Figure 8.
Figure 8: Output from dac_example2.c
3.6.3 DAC Example 3
3.6.3.1 Purpose
The purpose of this example is to demonstrate the DAC operating in a continuous mode, and using
an interrupt to supply new data.
3.6.3.2 Setup
Refer to 3.6.1.2 Setup Section.
18
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.6.3.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to DAC Example 3...
Output a series of values in continuous mode by interrupt.
The values will be output on DAC0
--------------------------------------------------------------------2. An analogue wave should appear on GPIO14/CAM_D3/DAC0 as shown in Figure 8.
19
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.7 DLOG Example
3.7.1.1
Purpose
This example program demonstrates use of the datalogger APIs. A 4KB sector is allocated as the
datalog partition. One sector has 16 pages and page 0 is reserved by the lib. Pages 1 to 15 are
available for use by the user. Once a page is programmed, that page may not be overwritten.
Pages may not be erased individually and the entire sector has to be erased. Therefore, users shall
ensure that pages are completely filled before programming into the datalogger. APIs are provided
to read, program and erase. Page management is left to the user application requirements.
3.7.1.2
Setup
Connect the FT900 development board programmed with DLOG_Example1.bin to the host PC via
USB.
Additionally, connect a USB to Serial converter to UART0 as this port is used to send debug text.
Open up terminal PC application program for UART0 with following port setting 19200 baud, no
parity, 8 data bits, and 1 stop bit.
3.7.1.3
Execution
1. A welcome message should appear like so,
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to the Datalogger Example ...
This example will erase the datalogger partition and fill all pages
from 1 to 14 (14 pages) with repeated values of 0x00 to 0x0D after it
will erase the sector again and end.
--------------------------------------------------------------------2. Details will appear showing the dlog partition address in flash, page size and the number of
pages in the sector used by dlogger.
__dlog_partition: 0003E000
dlog_init: passed, pgsz=0x100, pages=14
3. The example then erases each page from 1 to 14 and fills each page with the repeated
values of 1 to 14.
20
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
0x00:
0x10:
0x20:
0x30:
0x40:
0x50:
0x60:
0x70:
0x80:
0x90:
0xa0:
0xb0:
0xc0:
0xd0:
0xe0:
0xf0:
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
0x00:
0x10:
0x20:
0x30:
0x40:
0x50:
0x60:
0x70:
0x80:
0x90:
0xa0:
0xb0:
0xc0:
0xd0:
0xe0:
0xf0:
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
0x00:
0x10:
0x20:
…
…
…
0xd0:
0xe0:
0xf0:
02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
0x00:
0x10:
0x20:
0x30:
0x40:
0x50:
0x60:
0x70:
0x80:
0x90:
0xa0:
0xb0:
0xc0:
0xd0:
0xe0:
0xf0:
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
C learance N o.: FT DI# 4 5 1
0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c
0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c
0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
0d
21
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
4. Then the example erases all pages and ends .
program ended
22
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.8 Ethernet Examples
3.8.1 Ethernet Example 1
3.8.1.1 Purpose
The purpose of this example is to demonstrate the operating of the Ethernet module,
implementing ARP and ICMP Echo support in order to allow the user to “Ping” the device.
3.8.1.2 Setup
Connect a USB to Serial converter to UART0 as this port is used to send debug te xt.
Connect an Ethernet cable to the FT90x’s Ethernet Port, connecting the other end into a network
or directly into PC with a crossover cable or into an Ethernet Port which supports Auto MDI -X.
Alternatively, connect both a PC and an FT90x to an Ethernet switch or hub.
3.8.1.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to Ethernet Example 1...
Allow the user to "Ping" (ICMP Echo) to the device.
--------------------------------------------------------------------2. Details will appear showing the MAC address 1 and IP address of the device.
MAC address = 02:F7:D1:00:00:01
IP address = 192.168.1.55
3. The program will wait until the Ethernet cable is plugged in.
Please plug in your Ethernet cable
Ethernet Link Up
4. Standard network traffic will occur. The FT90x will report when ARP packets are received
on its Ethernet Interface and when it sends a response.
Got an ARP Packet
Sending Reply ARP
Got an ARP Packet
Sending Reply ARP
Got an ARP Packet
Sending Reply ARP
5. On a PC on the same network, “ping” the FT90x:
On Windows:
ping 192.168.1.55
On Linux:
1
This MAC Address is one within the Locally Administered address set and should not clash with any
Global MAC Address that is assigned to other hardware. If you are running more than one Ethernet
Example, make sure that they have different MAC Addresses (e.g. 02:F7:D1:00:00:02).
23
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
ping –c 4 192.168.1.55
6. The FT90x will report when ICMP packets arrive at the Ethernet Interface. The “ping”
program uses ICMP Echo and Echo Replies in order to determine if a device is present on
the network and the time it takes for that device to respond:
Got an ICMP Packet
Sending ICMP Echo Reply
Got an ICMP Packet
Sending ICMP Echo Reply
Got an ICMP Packet
Sending ICMP Echo Reply
Got an ICMP Packet
Sending ICMP Echo Reply
7. On a PC on the same network running the “ping” program, the program should be
reporting successful responses:
On Windows:
> ping 192.168.1.55
Pinging 192.168.1.55 with 32 bytes of data:
Reply from 192.168.1.55: bytes=32 time=23ms
Reply from 192.168.1.55: bytes=32 time=23ms
Reply from 192.168.1.55: bytes=32 time=23ms
Reply from 192.168.1.55: bytes=32 time=23ms
TTL=64
TTL=64
TTL=64
TTL=64
Ping statistics for 192.168.1.55:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 23ms, Maximum = 23ms, Average = 23ms
On Linux:
$ ping –c 4 192.168.1.55
PING 192.168.1.55 (192.168.1.55) 56(84) bytes of data.
64 bytes from 192.168.1.55: icmp_req=1 ttl=64 time=23.2
64 bytes from 192.168.1.55: icmp_req=2 ttl=64 time=23.1
64 bytes from 192.168.1.55: icmp_req=3 ttl=64 time=23.1
64 bytes from 192.168.1.55: icmp_req=4 ttl=64 time=23.1
--- 192.168.1.55 ping statistics --4 packets transmitted, 4 received, 0% packet loss, time
rtt min/avg/max/mdev = 23.176/23.188/23.208/0.152 ms
ms
ms
ms
ms
3004ms
A network analyzer tool like Wireshark (a free and open-source packet analyzer) can be used to
look at the raw network traffic travelling between the PC and the FT90 x, as shown in Figure 9.
24
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
Figure 9: Wireshark output for eth_example1.c
3.9 FreeRTOS Examples
FreeRTOS (http://www.freertos.org/) is a popular real-time operating system with a modified GPL
license allowing it to be used freely in commercial applications. It supports multiple scheduling
strategies for tasks like pre-emptive, cooperative and time -slicing. Queues, events, semaphores
and mutexes are also available for inter task communication and synchronization. On FT900 the
FreeRTOS port consumes about 9KB of Flash (under –Os optimization). More information on
FreeRTOS is available on the FreeRTOS website.
3.9.1 Setup (common for all FreeRTOS projects)
To use the FT900 FreeRTOS port in projects, some special configurations/includes in Eclipse are
required that are different from the usual example projects. These are already set in the example
projects but are summarized next.
To access these in Eclipse, go to Project  Properties  C/C++ Build  Settings.
1. Symbols FT32_PORT and FT32_PORT_HEAP=4.
The user can set FT32_PORT_HEAP to 1, 2 or 3 if he or she wishes to use
management strategies 1/2/3 available from FreeRTOS. Since strategy 4 is the
flexible, it has been selected for the default FT900 port. For more information on the
management
strategies
available
with
FreeRTOS
http://www.freertos.org/a00111.html
Heap
most
Heap
refer
25
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
2. Set the include paths to various directories under the FreeRTOS folder structure as shown
below. Key directories are:
FreeRTOS\Source - The source code for the FreeRTOS kernel.
FreeRTOS\Source\portable\GCC\FT32 - Files specific to FT900 port.
FreeRTOS\Demo\FT32_GCC – The crt0 (C runtime zero) and configuration file for the
port.
3. Select the –nostartfiles linker option.
The FreeRTOS port uses a custom crt0 available at FreeRTOS\Demo\FT32_GCC\crt0.S
26
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
4. Set
the
linker
options
to
"${ProjDirPath}/ld/freertos.ld"
use
the
custom
C learance N o.: FT DI# 4 5 1
linker
script:
-dT
The FreeRTOS port uses a custom linker script (available at ld/freertos.ld)
The linker script is available in the example project:
3.9.2 FreeRTOS Example 1
3.9.2.1 Purpose
The purpose of this example is to test the FreeRTOS port by running a series of tasks doing
mathematical operations that are interrupted by the pre -emptive scheduler. It also illustrates the
use of Queues for passing data from the interrupt context to tasks, along with context switching
from ISRs. The examples are ported from the demos available within the FreeRTOS distribution.
3.9.2.2 Setup
Connect the UART1 RX and TX lines togethe r to generate a loopback on UART1. These are pins
GPIO52 and GPIO53 (CN3 pins 7 and 9 on the MM900EVx).
Open a COM port on the PC to UART0 on the MM900 board to view the logs printed out from
FT900. The baud rate to be configured is 230400bps
27
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.9.2.3 Execution
1. A welcome message should appear like so:
Copyright 2014-2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to Free RTOS Test Example 1...
Communication tasks which will send and receive data over UART1 using FreeRTOS
Queues
Please ensure that UART1 RX and TX lines are connected to each other.
--------------------------------------------------------------------2. This message will be followed by lines indicating the successful creation of 8 IntMath and
Math tasks and the COMRx and Tx tasks like so:
C IntMath1 ec8 e40 acc
C IntMath2 1340 12b8 f44
C IntMath3 17b8 1730 13bc
C IntMath4 1c30 1ba8 1834
C IntMath5 20a8 2020 1cac
C IntMath6 2520 2498 2124
C IntMath7 2998 2910 259c
C IntMath8 2e10 2d88 2a14
C Math1 3688 3600 2e8c
C Math2 3f00 3e78 3704
C Math3 4778 46f0 3f7c
C Math4 4ff0 4f68 47f4
C Math5 5868 57e0 506c
C Math6 60e0 6058 58e4
C Math7 6958 68d0 615c
C Math8 71d0 7148 69d4
Setup of UART1 Complete !C COMTx 7904 787c 7508
C COMRx 7d7c 7cf4 7980
C Check 81f4 816c 7df8
C IDLE 866c 85e4 8270
C Tmr Svc 8be4 8b5c 87e8
COM Rx task started.
C MEM_CHECK 905c 8fd4 8c60
COM Tx task started.
3. Following this the logs will indicate the running of the memory check task (every 3
seconds) like so:
C
C
C
C
C
MEM_CHECK
MEM_CHECK
MEM_CHECK
MEM_CHECK
MEM_CHECK
c3f4
905c
905c
c3f4
905c
c36c
8fd4
8fd4
c36c
8fd4
bff8
8c60
8c60
bff8
8c60
4. Additional logs will be printed in case any of the running tests fails. If there are no logs
other than the creation of the MEM_CHECK task, it means that the tests are running
successfully.
3.9.3 FreeRTOS Example 2
3.9.3.1 Purpose
The purpose of this example is to test the FreeRTOS port by running a series of tasks that cover
the use of Semaphores, Queues, Events and Dynamic Prio rity assignment to tasks. The code is
ported from the demos available within the FreeRTOS distribution.
28
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.9.3.2 Setup
Open a COM port on the PC to UART0 on the MM900 board to view the logs printed out from
FT900. The baud rate to be configured is 230400bps.
3.9.3.3 Execution
1. A welcome message should appear like so:
Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to Free RTOS Test Example 2...
Test use of Semaphores, Queues, Events, Dynamic Priority Assignment
--------------------------------------------------------------------2. This message will be followed by lines indicating the successful creation of the various test
tasks like so:
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
PolSEM1 f88 f00 b8c
PolSEM2 1400 1378 1004
BlkSEM1 18f4 186c 14f8
BlkSEM2 1d6c 1ce4 1970
QConsNB 2258 21d0 1e5c
QProdNB 26d0 2648 22d4
CONT_INC 2bac 2b24 27b0
LIM_INC 3024 2f9c 2c28
C_CTRL 349c 3414 30a0
SUSP_SEND 3914 388c 3518
SUSP_RECV 3d8c 3d04 3990
1st_P_CHANGE 4204 417c 3e08
2nd_P_CHANGE 467c 45f4 4280
QConsB1 4b7c 4af4 4780
QProdB2 4ff4 4f6c 4bf8
QProdB3 54f4 546c 50f8
QConsB4 596c 58e4 5570
QProdB5 5e74 5dec 5a78
QConsB6 62ec 6264 5ef0
EvntCTRL 67d0 6748 63d4
Event0 6c48 6bc0 684c
Event1 70c0 7038 6cc4
Event2 7538 74b0 713c
Event3 79b0 7928 75b4
Check 7e28 7da0 7a2c
IDLE 82a0 8218 7ea4
Tmr Svc 8818 8790 841c
3. Following this the logs will indicate the running of the memory check task (every 3
seconds) like so:
C
C
C
C
C
C
C
MEM_CHECK
MEM_CHECK
MEM_CHECK
MEM_CHECK
MEM_CHECK
MEM_CHECK
MEM_CHECK
9108
8c90
9108
9108
8c90
9108
8c90
9080
8c08
9080
9080
8c08
9080
8c08
8d0c
8894
8d0c
8d0c
8894
8d0c
8894
4. Additional logs will be printed in case any of the running tests fails. If there are no logs
other than the creation of the MEM_CHECK task, it means that the tests are running
successfully.
29
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.9.4 FreeRTOS Example 3
3.9.4.1 Purpose
The purpose of this example is to give a simple illustration of time -slicing and pre-emptive
scheduling and using a mutex to synchronize access .
3.9.4.2 Setup
Open a COM port on the PC to UART0 on the MM900 board to view the logs printed out from
FT900. The baud rate to be configured is 230400bps.
The example contains 3 demos that can be compiled by changing the FRT_DEMO preprocessor
define switch to 1, 2 or 3, found in free_rtos_example3.c. The behavior of each demo is:
Demo 1 – Illustrates time-slicing by creating tasks of the same priority. FreeRTOS will try to give
all three of them equal execution time.
Demo 2 - 3 Tasks of different priorities (3, 2, 1) are created. The task with priority 2 runs
constantly, never yielding. The task with priority 3 (highest priority) prints its name and yields
every 500mS. The net result is that Task 2 runs co nstantly, while being interrupted by Task 1
every 500mS. Task 3 never gets to run.
Demo 3 - 4 Tasks are created with different priorities. Each of the tasks prints lines onto UART0.
Since the tasks have different priorities, preemption will occur and a mutex is used to synchronize
access to UART0, keeping the printed strings uninterrupted .
3.9.4.3 Execution
3.9.4.3.1 Dem o 1
1. A welcome message will appear like so:
Copyright 2014-2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to Free RTOS Test Example 3...
Demonstrate FreeRTOS Time-slicing
--------------------------------------------------------------------2. This message will be followed by lines indicating the successful creation of t he various test
tasks like so:
C
C
C
C
C
Task 1 15fc 1574 660
Task 2 2614 258c 1678
Task 3 362c 35a4 2690
IDLE 3aa4 3a1c 36a8
Tmr Svc 401c 3f94 3c20
3. Once the tasks have been created their names will be printed out equally on average like
so:
30
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
Task1
Task2
Task3
Task1
Task2
Task3
Task1
Task2
Task3
Task1
Task2
4. This indicates that all three tasks get an opportunity to run.
3.9.4.3.2 Dem o 2
1. A welcome message will appear like so:
Copyright 2014-2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to Free RTOS Test Example 3...
Demonstrate FreeRTOS Task Priority handling
--------------------------------------------------------------------2. This message will be followed by lines indicating the successful creation of the various test
tasks like so:
Demo 2
C Task 1 1610 1588 674
C Task 2 2628 25a0 168c
C Task 3 3640 35b8 26a4
C IDLE 3ab8 3a30 36bc
C Tmr Svc 4030 3fa8 3c34
3. Once the tasks have been created Task1 will be scheduled every 500mS and Task 2 will
run in the intervening time like so:
*Task1*
Task2
Task2
Task2
Task2
Task2
Task2
Task2
Task2
Task2
Task2
Task2
Task2
Task2
Task2
Task2
Task2
Task2
Task2
Task2
Task2
Task2
Task2
*Task1*
31
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
4. Task 3 is of priority 1 and never gets to run.
3.9.4.3.3 Dem o 3
1. A welcome message will appear like so:
Copyright 2014-2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to Free RTOS Test Example 3...
Demonstrate FreeRTOS mutex based synchronization
--------------------------------------------------------------------2. This message will be followed by lines indicating the successful creation of the various test
tasks like so:
Demo 3
C Print1 1b60 1ad8 bc4
C Print2 2b78 2af0 1bdc
C Print3 3b90 3b08 2bf4
C Print4 4ba8 4b20 3c0c
C IDLE 5020 4f98 4c24
C Tmr Svc 5598 5510 519c
3. Once the tasks have been created their names messages are printed out without breaks
like so:
Task
Task
Task
Task
Task
Task
Task
Task
Task
Task
Task
Task
Task
Task
Task
Task
Task
Task
Task
Task
3
4
2
1
3
1
4
4
2
1
2
4
4
3
2
2
1
4
2
3
##########################################
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----------------------------------------******************************************
##########################################
******************************************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----------------------------------------******************************************
-----------------------------------------~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##########################################
----------------------------------------------------------------------------------******************************************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----------------------------------------##########################################
4. This indicates that all three tasks get an opportunity to run.
32
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.10 GPIO Examples
3.10.1
GPIO Example 1
3.10.1.1 Purpose
The purpose of this example is to demonstrate using GPIO functions.
3.10.1.2 Setup
Connect a USB to Serial converter to UART0 as this port is used to send debug text.
Connect something to GPIO18/CAN1_RXD (found via connector CN3 Pin 40 on the FT90x EVM) to
monitor the state of the pin (e.g. an LED).
3.10.1.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to GPIO Example 1...
Toggle a pin on and off.
--------------------------------------------------------------------2. GPIO18/CAN1_RXD will toggle on and off every second.
3.10.2 GPIO Example 2
3.10.2.1 Purpose
The purpose of this example is to demonstrate using GPIO pins.
3.10.2.2 Setup
Connect a USB to Serial converter to UART0 as this port is used to send debug text.
Connect something to GPIO18/CAN1_RXD (found via connector CN3 Pin 40 on the FT90x EVM) to
change the state of the pin.
3.10.2.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to GPIO Example 2...
Read the value of a pin.
---------------------------------------------------------------------
33
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
2. The current state of GPIO18/CAN1_RXD will be reported:
Pin is High
3.10.3
GPIO Example 3
3.10.3.1 Purpose
The purpose of this example is to demonstrate using GPIO pins.
3.10.3.2 Setup
Connect a USB to Serial converter to UART0 as this port is used to send de bug text.
Connect something to GPIO18/CAN1_RXD (found via connector CN3 Pin 40 on the FT90x EVM) to
change the state of the pin.
3.10.3.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to GPIO Example 2...
Use interrupts to inform the user of a falling edge on a GPIO pin.
--------------------------------------------------------------------2. Changing the state of GPIO18/CAN1_RXD from High to Low will cause the pin to be
interrupted, which will display the message:
Pin Interrupted!
34
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.11 I2C Master Examples
I2C Master Example 1
3.11.1
3.11.1.1 Purpose
The purpose of this example is to demonstrate the use of the I 2C Master Peripheral and how to
transfer data to and from it.
3.11.1.2 Setup
This test uses a 24LC01 1Kbit EEPROM as an I 2C device.
Connect as shown in Figure 10
Connect the SCL pin of the 24LC01 to the GPIO46/I2C1_SCL found via connector CN3 Pin 25 on
the FT90x EVM.
1. Connect the SDA pin of the 24LC01 to the GPIO47/I2C1_SDA found via connector CN3 Pin
25 on the FT90x EVM.
2. Connect the WP, A0, A1, A2 and GND pins of the 24LC01 to Ground.
3.3V
R1
4k7
R2
4k7
3.3V
Vcc
WP
GPIO46/I2C1_SCL
SCL
A0
GPIO47/I2C1_SDA
SDA
A1
GND
A2
GND 24LC01
GND
Figure 10: Circuit Diagram for I2C Master Examples
Additionally, connect a USB to Serial converter to UART0 as this port is used to send debug text.
3.11.1.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to I2C Master Example 1...
Read and write to an I2C EEPROM (24LC01)
--------------------------------------------------------------------2. The program will start by dumping the contents of EEPROM:
35
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
Reading
0x0000:
0x0010:
0x0020:
0x0030:
0x0040:
0x0050:
0x0060:
0x0070:
all 128 bytes of EEPROM
FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
|
|
|
|
|
|
|
|
C learance N o.: FT DI# 4 5 1
................
................
................
................
................
................
................
................
3. The program will then set all locations in EEPROM to FF h then dump the contents of
EEPROM:
Setting
0x0000:
0x0010:
0x0020:
0x0030:
0x0040:
0x0050:
0x0060:
0x0070:
the EEPROM to 0xFF
FF FF FF FF FF FF FF
FF FF FF FF FF FF FF
FF FF FF FF FF FF FF
FF FF FF FF FF FF FF
FF FF FF FF FF FF FF
FF FF FF FF FF FF FF
FF FF FF FF FF FF FF
FF FF FF FF FF FF FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
|
|
|
|
|
|
|
|
................
................
................
................
................
................
................
................
4. The program will then set all even locations to 01 h then dump the contents of EEPROM:
Set all
0x0000:
0x0010:
0x0020:
0x0030:
0x0040:
0x0050:
0x0060:
0x0070:
even numbered locations
01 FF 01 FF 01 FF 01 FF
01 FF 01 FF 01 FF 01 FF
01 FF 01 FF 01 FF 01 FF
01 FF 01 FF 01 FF 01 FF
01 FF 01 FF 01 FF 01 FF
01 FF 01 FF 01 FF 01 FF
01 FF 01 FF 01 FF 01 FF
01 FF 01 FF 01 FF 01 FF
to
01
01
01
01
01
01
01
01
0x01
FF 01
FF 01
FF 01
FF 01
FF 01
FF 01
FF 01
FF 01
FF
FF
FF
FF
FF
FF
FF
FF
01
01
01
01
01
01
01
01
FF
FF
FF
FF
FF
FF
FF
FF
01
01
01
01
01
01
01
01
FF
FF
FF
FF
FF
FF
FF
FF
|
|
|
|
|
|
|
|
................
................
................
................
................
................
................
................
5. The program will then fill EEPROM with a block of example text and dump the contents of
EEPROM:
Filling
0x0000:
0x0010:
0x0020:
0x0030:
0x0040:
0x0050:
0x0060:
0x0070:
3.11.2
the EEPROM with example
4C 6F 72 65 6D 20 69 70
72 20 73 69 74 20 61 6D
65 63 74 65 74 75 72 20
6E 67 20 65 6C 69 74 2E
20 69 6E 74 65 72 64 75
69 74 20 61 6D 65 74 20
6C 76 69 6E 61 72 2C 20
65 72 65 20 6C 65 6F 20
text
73 75
65 74
61 64
20 41
6D 20
6C 6F
76 65
70 6F
6D
2C
69
6C
65
72
6C
73
20
20
70
69
72
65
20
75
64
63
69
71
6F
6D
70
65
6F
6F
73
75
73
20
6F
72
6C
6E
63
61
20
70
73
65
6F
73
69
6D
73
75
75
2E
|
|
|
|
|
|
|
|
Lorem ipsum dolo
r sit amet, cons
ectetur adipisci
ng elit. Aliquam
interdum eros s
it amet lorem pu
lvinar, vel posu
ere leo posuere.
I2C Master Example 2
3.11.2.1 Purpose
The purpose of this example is to demonstrate the use of the I 2C Master Peripheral and how to
transfer data to and from it.
3.11.2.2 Setup
This test uses the on-board MAC address EEPROM (24AA02E48T). No external setup is required.
36
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.11.2.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to I2C Master Example 2...
Read and write to the on-board MAC address EEPROM (24AA02E48T)
--------------------------------------------------------------------2. The program will start by reading the current content of the EEPROM:
Reading all 16 bytes of EEPROM
0x0000: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
| ................
3. The program will then write some new data to the EEPROM:
Setting the EEPROM to 0xBB
0x0000: BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB
| ................
37
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.12 I2C Slave Examples
I2C Slave Example 1
3.12.1
3.12.1.1 Purpose
The purpose of this example is to demonstrate the use of the I 2C Slave Peripheral and how to
transfer data to and from it.
3.12.1.2 Setup
This test is best carried out using a Bus Pirate which is an open hardware tool to program and
interface with communication buses, available to buy from multiple sources online.
Connect the following as shown in Figure 11
1. Connect the CLK pin of the Bus Pirate to the GPIO46/I2C1_SCL found via connector CN3
Pin 25 on the FT90x EVM.
2. Connect the MOSI pin of the Bus Pirate to the GPIO47/I2C1_SDA found via connector CN3
Pin 26 on the FT90x EVM.
3. Connect the GND pin of the Bus Pirate to the GND pin of the FT90x
FT90x
Bus Pirate
GPIO46/I2C1_SCL
CLK
GPIO47/I2C1_SDA
MOSI
GND
GND
Figure 11: Circuit Diagram for I2C Slave Examples
Additionally, connect a USB to Serial converter to UART0 as this port is used t o send debug text.
3.12.1.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to I2C Slave Example 1...
Have a block of memory act as registers on an I2C bus.
Read Address = 0x39, Write Address = 0x38
--------------------------------------------------------------------This is followed by instructions on screen for quick reference.
2. On the Bus Pirate, enter I2C mode:
>m4
(1)>3
38
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3. On the Bus Pirate, to write data to the FT90x I2C Slave, see the following commands and
return data:
I2C>[ 0x38
I2C START BIT
WRITE: 0x38 ACK
I2C>4
WRITE: 0x04 ACK
I2C>0xA5
WRITE: 0xA5 ACK
I2C>]
I2C STOP BIT
o
o
o
o
o
The ‘[‘ character will cause a start condition occur.
The write address is sent on the I 2C bus (38 h).
The address pointer is sent on the I 2C bus (4).
Data is written on the I2C bus which loads data in starting from the given address
pointer (i.e. Location 0 = 1, Location 1 = 2, Location 2 = 3, Location 3 = 4).
The ‘]’ character will cause a stop condition to occur.
4. On the Bus Pirate, to read data from the FT90x I2C Slave, execute the following
I2C>[ 0x38
I2C START BIT
WRITE: 0x38 ACK
I2C>4
WRITE: 0x04 ACK
I2C>[
I2C START BIT
I2C>0x39
WRITE: 0x39 ACK
I2C>r
READ: 0xA5
I2C>]
NACK
I2C STOP BIT
o
o
o
o
o
o
o
The ‘[‘ character will cause a start condition occur.
The write address is sent on the I 2C bus (38 h).
The address pointer is sent on the I 2C bus (4).
The ‘[‘ character will cause a restart condition to occur.
The read address is sent on the I 2C bus (39 h).
The ‘r’ character will cause a byte to be read from the slave device and return the
result.
The ‘]’ character will cause a stop condition to occur.
39
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.13 I2S Examples
I2S Example 1
3.13.1
3.13.1.1 Purpose
The purpose of this example is to demonstrate I 2S transmitting a block of data held in RAM to the
Wolfram Codec. The FT90x EVM is fitted with a Wolfram WM8731 Codec.
3.13.1.2 Setup
Connect a USB to Serial converter to UART0 as this port is used to send debug text.
Connect a set of speakers to CN10 and CN11 of the FT90x EVM, or connect a set of headphones to
CN9.
3.13.1.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to I2S Example 1...
Play a Fs/64 (44100/64 = 689) Hertz Sine Wave using a Wolfram WM8731.
--------------------------------------------------------------------2. A 689 Hz Sine wave will play on the output o f the Codec.
3.13.2
I2S Example 2
3.13.2.1 Purpose
The purpose of this example is to demonstrate the receiving and transmitting data over I 2S. The
FT90x EVM is fitted with a Wolfram WM8731 Codec.
3.13.2.2 Setup
Connect a USB to Serial converter to UART0 as this port is used to se nd debug text.
Connect a set of speakers to CN10 and CN11 of the FT90x EVM, or connect a set of headphones to
CN9.
3.13.2.3 Execution
1. A welcome message should appear like so:
40
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to I2S Example 2...
Play the microphone input from the WM8731 codec to the output.
--------------------------------------------------------------------2. Any sounds heard at the microphone input (P1 on FT90x EVM) will be output from the
Codec via the FT90x.
41
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.14 PWM Examples
3.14.1
PWM Example 1
3.14.1.1 Purpose
The purpose of this example is to demonstrate using the PWM module to output a fixed duty cycle.
3.14.1.2 Setup
Connect a USB to Serial converter to UART0 as this port is used to send debug text.
Connect the following signals to an oscilloscope for measurement:



GPIO56/PWM0 (CN3 Pin 13 on FT90x EVM)
GPIO57/PWM1(CN3 Pin 14 on FT90x EVM)
GPIO58/PWM2 (CN3 Pin 12 on FT90x EVM)
3.14.1.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to PWM Example 1...
Output a number of PWM levels on various pins:
* PWM0 will output 25% duty cycle
* PWM1 will output 50% duty cycle
* PWM2 will output 75% duty cycle
--------------------------------------------------------------------2. GPIO56/PWM0 should have a 25% duty cycle wave output on it, GPIO57/PWM1 should
have a 50% duty cycle wave output on it, and GPIO58/PWM2 should have a 75% duty
cycle wave output on it.
3.14.2
PWM Example 2
3.14.2.1 Purpose
The purpose of this example is to demonstrate using the PWM module to output a variable duty
cycle PWM wave. This example will exponentially fade PWM0 up and down in order to demonstrate
an LED fading.
3.14.2.2 Setup
Connect a USB to Serial converter to UART0 as this port is used to send debug text.
Optionally, connect an LED or oscilloscope to GPIO56/PWM0 (CN3 Pin 13 on FT90x EVM).
3.14.2.3 Execution
1. A welcome message should appear like so:
42
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to PWM Example 2...
Output a PWM signal to drive a fading LED on PWM0
The so called, breathing LED.
--------------------------------------------------------------------2. The output on GPIO56/PWM0 should vary between 100% and 0% duty cycle in an
exponential fashion.
3.14.3
PWM Example 3
3.14.3.1 Purpose
The purpose of this example is to demonstrate using the PWM module to output audio.
3.14.3.2 Setup
A low pass filter will be needed to remove the PWM carrier frequency from the output waveform.
Figure 12 shows the circuit needed to create a 10.047 kHz Lo w Pass Filter with optional stereo
volume control and DC offset removal.
(Optional) Volume and
DC offset removal
R1 720
R2 720
R3 720
GPIO56/PWM0
Left
C1
22n
GND
R4 720
C3 POT1
1k
22n
C2
22n
GND
R5 720
GND
C7
1u
GND
R6 720
Right
GPIO57/PWM1
C4
22n
GND
C6 POT2
1k
22n
C5
22n
GND
GND
GND
C8
1u
Ground
GND
Figure 12: PWM Low Pass Filter
Connect a USB to Serial converter to UART0 as this port is use d to send debug text.
Connect the following signals to an oscilloscope for measurement:


GPIO56/PWM0 (CN3 Pin 13 on FT90x EVM)
GPIO57/PWM1(CN3 Pin 14 on FT90x EVM)
3.14.3.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to PWM Example 3...
Output a sine wave on the PWM audio channel (PWM0 and PWM1)
----------------------------------------------------------- ---------2. GPIO56/PWM0 and GPIO57/PWM1 should be outputting PWM waves which represent the
Left and Right channels of a Sine wave.
43
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.15 Real Time Clock Examples
3.15.1
RTC Example 1
3.15.1.1 Purpose
The purpose of this example is to demonstrate the Real Time Clock Peripheral.
3.15.1.2 Setup
Connect a USB to Serial converter to UART0 as this port is used to send debug text.
3.15.1.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to RTC Example 1...
Display the current elapsed time using the RTC.
--------------------------------------------------------------------2. The program should display the current elapsed time:
Uptime
0 h
0 m
1 s
3.15.1.4 RTC Example 2Purpose
The purpose of this example is to demonstrate the Real Time Clock Peripheral. This example
demonstrates the time matching capability.
3.15.1.5 Setup
Connect a USB to Serial converter to UART0 as this port is used to send debug text.
3.15.1.6 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to RTC Example 2...
Display a message every two seconds via an RTC interrupt.
--------------------------------------------------------------------2. Every two seconds, the program should update the currently elapsed time:
2 seconds elapsed
44
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.16 SD Host Examples
3.16.1
SD Host Example 1
3.16.1.1 Purpose
The purpose of this example is to demonstrate the SD Host Peripheral.
3.16.1.2 Setup
Connect a USB to Serial converter to UART0 as this port is used to send debug text.
Insert a FAT32 formatted SD card (CN5 on the FT90x EVM).
3.16.1.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to SD Host Example 1...
Read and write some files using FatFS
------------------------------------------------- -------------------2. The program will prompt for an SD Card to be inserted:
Please Insert SD Card
3. After inserting an SD Card, the program will mount the file system:
SD Card Inserted
Mounted
4. The program will list the contents of the drive’s root directory:
ls(path = ""):
DD/MM/YYYY HH:MM
01/08/2014 10:57
01/08/2014 10:57
20/08/2014 10:32
20/08/2014 10:33
22/07/2014 13:51
...
17/07/2014 16:56
<DIR>
30/10/2014 16:09
28/10/2014 10:48
04/11/2014 13:16
42 File(s)
Size
333878
333878
0
0
207360
Filename
SCR01.BMP
SCR02.BMP
SCR03.BMP
SCR04.BMP
TMCAPP~1.EXE
0
114146
151328281
210
290935952
FT900
ETH_EX~1.PNG
V100~1.ZIP
GCCVARS.BAT
bytes
5. The program will write some data to a text file:
LOREM.TXT already exists. Deleting
Opening LOREM.TXT for writing
Wrote 1658 bytes
Closing LOREM.TXT
45
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
6. The program will read back the file:
Opening LOREM.TXT for reading
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi dictum mi eget
malesuada auctor. Cras tellus ligula, feugiat ac ante eu, tincidunt consectetur
mauris. Phasellus in mollis enim, dapibus venenatis est. Sed urna tellus, varius a
dui sed, scelerisque commodo lectus. In pretium lobortis tortor, semper ultricies
odio viverra a. Ut sit amet aliquam lectus. Phasellus non risus a nisl semper
vehicula a vitae lorem. Fusce suscipit, purus nec facilisis lacinia, lacus massa
aliquet augue, in feugiat neque nibh a lacus. Curabitur pharetra viverra massa
quis efficitur.
Mauris posuere nisl vel aliquam finibus. Aenean ac fringilla justo. Nulla eu
sollicitudin erat. Duis in ligula at quam pretium hendrerit. Fusce quis egestas
metus. In hac habitasse platea dictumst. Fusce tincidunt enim at tempus
ullamcorper. Aenean pellentesque condimentum sapien vel porta. In sollicitudin
tempor pulvinar. Pellentesque aliquet justo lacus, scelerisque feugiat augue
commodo viverra.
Etiam pulvinar quam a pulvinar aliquam. Cras rutrum qui s tortor ut ultrices.
Curabitur sit amet odio eros. Mauris auctor erat non risus interdum, at venenatis
urna interdum. Nam eget auctor risus, auctor fringilla leo. Quisque sit amet
ligula mattis, gravida tortor quis, ullamcorper odio. Nullam semper mauris at leo
aliquam, quis mollis tortor iaculis. Mauris ut tempor elit, sed sodales magna.
Donec non eros tortor. Donec lorem justo, vestibulum vitae sagittis ac, bibendum
vitae velit. Integer ante mi, tempus sodales consectetur vel, porta ac libero.
Maecenas dapibus orci at rhoncus bibendum. Nulla elementum lectus massa, non
varius lorem scelerisque sit amet.
Closing LOREM.TXT
46
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.17 SPI Master Examples
3.17.1
SPI Master Example 1
3.17.1.1 Purpose
The purpose of this example is to demonstrate the use of the SPI Master Peripheral an d how to
transfer data.
3.17.1.2 Setup
This example uses two FT90x EVM modules, one module as SPI master and other module as SPI
slave.
Connect as shown in Figure 13.
Connect the GPIO28/SPIM_SS0 (accessible via J2 Pin 2 on FT90x EVM) to GPIO37/SPIS0_SS
(accessible via CN7 Pin 1 on FT90x EVM) .
1. Connect the GPIO27/SPIM_SCK (accessible via J2 Pin 1 on FT90x EVM) to
GPIO36/SPIS0_SCK (accessible via CN7 Pin 2 on FT90x EVM).
2. Connect the GPIO29/SPIM_MOSI (accessible via J2 Pin 4 on FT90x EVM) to
GPIO38/SPIS0_MOSI (accessible via CN7 Pin 3 on FT90x EVM).
3. Connect the GPIO30/SPIM_MISO (accessible via J2 Pin 3 on FT90x EVM) to
GPIO39/SPIS0_MISO (accessible via CN7 Pin 4 on FT90x EVM).
GPIO28/SPIM_SS0
GPIO37/SPIS0_SS0
GPIO36/SPIS0_SCK
GPIO27/SPIM_SCK
GPIO29/SPIM_MOSI
GPIO38/SPIS0_MOSI
GPIO30/SPIM_MISO
GPIO39/SPIS0_MISO
Figure 13: Circuit Diagram for SPI Master Examples
Additionally, connect a USB to Serial converter to UART0 as this port is used to dumping the
exchange data.
3.17.1.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to SPI Master Example 1...
Loopback use case between two MM900EVxA module, FT900 (SPI Master) and FT900 (SPI
Slave)
--------------------------------------------------------------------2. The program will start exchanging the data between SPI master and SPI Slave.
47
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3. The program will start by dumping the contents of exchange:
Data
Data
Data
Data
Data
Data
Data
Data
Data
Data
Data
Data
Data
Data
Data
Data
Data
sent
sent
sent
sent
sent
sent
sent
sent
sent
sent
sent
sent
sent
sent
sent
sent
sent
3.17.2
and
and
and
and
and
and
and
and
and
and
and
and
and
and
and
and
and
received
received
received
received
received
received
received
received
received
received
received
received
received
received
received
received
received
70
78
80
88
90
98
a0
a8
b0
b8
c0
c8
d0
d8
e0
e8
f0
6e
76
7e
86
8e
96
9e
a6
ae
b6
be
c6
d9
d6
de
e6
ee
71
79
81
89
91
99
a1
a9
b1
b9
c1
c9
d1
d9
e1
e9
f1
6f
77
7f
87
8f
97
9f
a7
af
b7
bf
c7
ff
d7
df
e7
ef
72
7a
82
8a
92
9a
a2
aa
b2
ba
c2
ca
d2
da
e2
ea
f2
70
78
80
88
90
98
a0
a8
b0
b8
c0
ce
d0
d8
e0
e8
f0
73
7b
83
8b
93
9b
a3
ab
b3
bb
c3
cb
d3
db
e3
eb
f3
71
79
81
89
91
99
a1
a9
b1
b9
c1
4f
d1
d9
e1
e9
f1
74
7c
84
8c
94
9c
a4
ac
b4
bc
c4
cc
d4
dc
e4
ec
f4
72
7a
82
8a
92
9a
a2
aa
b2
ba
c2
fa
d2
da
e2
ea
f2
75
7d
85
8d
95
9d
a5
ad
b5
bd
c5
cd
d5
dd
e5
ed
f5
73
7b
83
8b
93
9b
a3
ab
b3
bb
c3
cb
d3
db
e3
eb
f3
76
7e
86
8e
96
9e
a6
ae
b6
be
c6
ce
d6
de
e6
ee
f6
74
7c
84
8c
94
9c
a4
ac
b4
bc
c4
cc
d4
dc
e4
ec
f4
77
7f
87
8f
97
9f
a7
af
b7
bf
c7
cf
d7
df
e7
ef
f7
75
7d
85
8d
95
9d
a5
ad
b5
bd
c5
cd
d5
dd
e5
ed
f5
SPI Master Example 2
3.17.2.1 Purpose
The purpose of this example is to demonstrate the use of the SPI Master Peripheral and how to
transfer data by using FIFOs to buffer the transfers.
3.17.2.2 Setup
This example uses an AT93C46D 1Kbit EEPROM as a SPI device.
Connect as shown in Figure 13
1. Connect the GPIO28/SPIM_SS0 (accessible via J2 Pin 2 on FT90x EVM) to the CS pin of the
AT93C46D.
2. Connect the GPIO27/SPIM_SCK (accessible via J2 Pin 1 on FT90x EVM) to the SK pin of the
AT93C46D.
3. Connect the GPIO29/SPIM_MOSI (accessible via J2 Pin 4 on FT90x EVM) to the DI pin of
the AT93C46D.
4. Connect the GPIO30/SPIM_MISO (accessible via J2 Pin 3 on FT90x EVM) to the DO pin of
the AT93C46D.
5. Connect the VCC pin of the AT93C46D to 3.3V.
6. Connect the ORG and GND pin of the AT93C46D to GND.
3.3V
GPIO28/SPIM_SS0
CS
VCC
GPIO27/SPIM_SCK
SK
NC
GPIO29/SPIM_MOSI
DI
ORG
GPIO30/SPIM_MISO
DO
GND
AT93C46D
GND
Figure 14: Circuit Diagram for SPI Master EEPROM Examples
Additionally, connect a USB to Serial converter to UART0 as this port is used to send debug text.
48
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.17.2.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to SPI Master Example 2...
Read and Write from a serial EEPROM (AT93C46D) using FIFOs to
Streamline transfers
--------------------------------------------------------------------2. The program will start by dumping the contents of EEPROM:
Reading
0x0000:
0x0010:
0x0020:
0x0030:
0x0040:
0x0050:
0x0060:
0x0070:
all 128 bytes of EEPROM
FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
|
|
|
|
|
|
|
|
................
................
............. ...
................
................
................
................
................
3. The program will then set all locations in EEPROM to FF h then dump the contents of
EEPROM:
Setting
0x0000:
0x0010:
0x0020:
0x0030:
0x0040:
0x0050:
0x0060:
0x0070:
the EEPROM to 0xFF
FF FF FF FF FF FF FF
FF FF FF FF FF FF FF
FF FF FF FF FF FF FF
FF FF FF FF FF FF FF
FF FF FF FF FF FF FF
FF FF FF FF FF FF FF
FF FF FF FF FF FF FF
FF FF FF FF FF FF FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
FF
|
|
|
|
|
|
|
|
................
................
................
................
................
................
..... ...........
................
4. The program will then set all even locations to 01 h then dump the contents of EEPROM:
Set all
0x0000:
0x0010:
0x0020:
0x0030:
0x0040:
0x0050:
0x0060:
0x0070:
even numbered locations
01 FF 01 FF 01 FF 01 FF
01 FF 01 FF 01 FF 01 FF
01 FF 01 FF 01 FF 01 FF
01 FF 01 FF 01 FF 01 FF
01 FF 01 FF 01 FF 01 FF
01 FF 01 FF 01 FF 01 FF
01 FF 01 FF 01 FF 01 FF
01 FF 01 FF 01 FF 01 FF
to
01
01
01
01
01
01
01
01
0x01
FF 01
FF 01
FF 01
FF 01
FF 01
FF 01
FF 01
FF 01
FF
FF
FF
FF
FF
FF
FF
FF
01
01
01
01
01
01
01
01
FF
FF
FF
FF
FF
FF
FF
FF
01
01
01
01
01
01
01
01
FF
FF
FF
FF
FF
FF
FF
FF
|
|
|
|
|
|
|
|
................
................
................
................
................
................
................
................
5. The program will then fill EEPROM with a block of example text and dump the contents of
EEPROM:
Filling
0x0000:
0x0010:
0x0020:
0x0030:
0x0040:
0x0050:
0x0060:
0x0070:
the EEPROM with example
4C 6F 72 65 6D 20 69 70
72 20 73 69 74 20 61 6D
65 63 74 65 74 75 72 20
6E 67 20 65 6C 69 74 2E
20 69 6E 74 65 72 64 75
69 74 20 61 6D 65 74 20
6C 76 69 6E 61 72 2C 20
65 72 65 20 6C 65 6F 20
text
73 75
65 74
61 64
20 41
6D 20
6C 6F
76 65
70 6F
6D
2C
69
6C
65
72
6C
73
20
20
70
69
72
65
20
75
64
63
69
71
6F
6D
70
65
6F
6F
73
75
73
20
6F
72
6C
6E
63
61
20
70
73
65
6F
73
69
6D
73
75
75
2E
|
|
|
|
|
|
|
|
Lorem ipsum dolo
r sit amet, cons
ectetur adipisci
ng elit. Aliquam
interdum eros s
it amet lorem pu
lvinar, vel posu
ere leo posuere.
49
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
3.17.3
C learance N o.: FT DI# 4 5 1
SPI Master Example 3
3.17.3.1 Purpose
The purpose of this example is to demonstrate the use of the SPI Master Peripheral and how to
transfer data in 4-bit mode.
3.17.3.2 Setup
This example uses a HD47780 compatible LCD in 4 bit mode shown in Figure 15.
1. Connect GPIO28/SPIM_SS0 (accessible via J2 Pin 2 on FT90x EVM) to the RS pin of the
LCD.
2. Connect GPIO27/SPIM_SCK (accessible via J2 Pin 1 on FT90x EVM) to the E pin of the LCD.
3. Connect GPIO28/SPIM_MOSI (accessible via J2 Pin 4 on FT90x EVM) to the DB4 pin of the
LCD.
4. Connect GPIO30/SPIM_MISO (accessible via J2 Pin 3 on FT90x EVM) to the DB5 pin of the
LCD.
5. Connect GPIO31/SPIM_IO2 (accessible via J2 Pin 6 on FT90x EVM) to the DB6 pin of the
LCD.
6. Connect GPIO32/SPIM_IO3 (accessible via J2 Pin 5 on FT90x EVM) to the DB7 pin of the
LCD.
7. Connect the VSS, R/W and LED– pins of the LCD to GND.
8. Connect the VCC pin of the LCD to 5V.
9. Connect a 100kΩ potentiometer between 5V and GND, with the wiper going to pin V0 of
the LCD.
10. Connect a Resistor between LED+ of the LCD and 5V (This Resistor is used to bias the LED
backlight in the LCD module, please refer to the LCD’s documentation to de termine this
value).
HD47780 LCD
GND
5V
VSS
VCC
POT1
100K
V0
RS
GND
GND
R/W
E
DB0
DB1
GPIO28/SPIM_SS0
DB2
GPIO27/SPIM_SCK
DB3
GPIO29/SPIM_MOSI
DB4
GPIO30/SPIM_MISO
DB5
GPIO31/SPIM_IO2
DB6
GPIO32/SPIM_IO3
5V
DB7
LED+
GND
Note 1: Please ref er to y our LCD datasheet f or the v alue of Bias Resistor R1
R1(1)
LED–
Figure 15: Circuit Diagram for SPI Master Example 3
50
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.17.3.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to SPI Master Example 3...
Use 4-bit mode to drive a HD44780 compatible LCD
--------------------------------------------------------------------2. The program will initialize the LCD to 4-bit mode, displaying the message:
Initialising the LCD
3. The program will scroll through the text "SPI Master Example 3 Copyright FTDI 2014 " o n
the first line and will show a bouncing animation on the second lin e. For example:
S
→
C
o
p
y
S
P
I
r
i
g
h
←
M a
s
t
e
r
E
|
t
F
T
D
I
2
51
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.18 SPI Slave Examples
3.18.1
SPI Slave Example 1
3.18.1.1 Purpose
The purpose of this example is to demonstrate the use of the SPI Slave Peripheral and how to
transfer data.
The default buffer size for this example is 8 bytes deep. This can be changed by editing the
APP_BUFFER_SIZE definition and recompiling the example.
3.18.1.2 Setup
This example uses two FT90x EVM modules, one module as SPI master and other module as SPI
slave.
Connect the following as shown in Figure 16.
1. Connect the GPIO28/SPIM_SS0 (accessible via J2 Pin
GPIO37/SPIS0_SS (accessible via CN7 Pin 1 on FT90x EVM) .
2. Connect the GPIO27/SPIM_SCK (accessible via J2 Pin
GPIO36/SPIS0_SCK (accessible via CN7 Pin 2 on FT90x EVM).
3. Connect the GPIO29/SPIM_MOSI (accessible via J2 Pin
GPIO38/SPIS0_MOSI (accessible via CN7 Pin 3 on FT90x EVM).
4. Connect the GPIO30/SPIM_MISO (accessible via J2 Pin
GPIO39/SPIS0_MISO (accessible via CN7 Pin 4 on FT90x EVM).
GPIO28/SPIM_SS0
GPIO27/SPIM_SCK
2
on
FT90x
EVM)
to
1
on
FT90x
EVM)
to
4
on
FT90x EVM) to
3
on
FT90x EVM) to
GPIO37/SPIS0_SS0
GPIO36/SPIS0_SCK
GPIO29/SPIM_MOSI
GPIO38/SPIS0_MOSI
GPIO30/SPIM_MISO
GPIO39/SPIS0_MISO
Figure 16: Circuit Diagram for SPI Slave Examples
Additionally, connect a USB to Serial converter to UART0 as this port is used to dump debug text.
52
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.18.1.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to SPI Master Example 1...
Loopback use case between two MM900EVxA module, FT900 (SPI Master) and FT900 (SPI
Slave)
--------------------------------------------------------------------This is followed by instructions on screen for quick reference.
2. At the setup time predefined data is written into the transmission FIFO, at run time read
and write back the data to SPI master.
53
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.19 Timer Examples
3.19.1
Timer Example 1
3.19.1.1 Purpose
The purpose of this example is to demonstrate using the Timers in single shot mode .
3.19.1.2 Setup
Connect a USB to Serial converter to UART0 as this port is used to send debug text.
3.19.1.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to Timer Example 1...
All timers are in one-shot mode and are polled in the main loop.
* Timer A will expire after 5 seconds.
* Timer B will expire after 6 seconds.
* Timer C will expire after 7 seconds.
* Timer D will expire after 8 seconds.
The current state of the timer will be shown every second
--------------------------------------------------------------------2. Every second, the status of the timers will be printed. The output should be:
Timer
Timer
Timer
Timer
Timer
Timer
Timer
Timer
Timer
Timer
_
_
_
_
_
A
_
_
_
_
3.19.2
_
_
_
_
_
_
B
_
_
_
_
_
_
_
_
_
_
C
_
_
_
_
_
_
_
_
_
_
D
_
Timer Example 2
3.19.2.1 Purpose
The purpose of this example is to demonstrate using the Timers in continuous mode .
3.19.2.2 Setup
Connect a USB to Serial converter to UART0 as this port is used to send debug text.
3.19.2.3 Execution
1. A welcome message should appear like so:
54
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to Timer Example 2...
All timers are in continuous mode and are polled in the main loop.
* Timer A will fire every 2 seconds.
* Timer B will fire every 3 seconds.
* Timer C will fire every 4 seconds.
* Timer D will fire every 5 seconds.
The current state of the timer will be shown every second
--------------------------------------------------------------------2. Every second, the status of the timers will be printed. The output should be:
Timer
Timer
Timer
Timer
Timer
Timer
Timer
Timer
Timer
Timer
Timer
Timer
Timer
Timer
Timer
Timer
_
_
A
_
A
_
A
_
A
_
A
_
A
_
A
_
3.19.3
_
_
_
B
_
_
B
_
_
B
_
_
B
_
_
B
_
_
_
_
C
_
_
_
C
_
_
_
C
_
_
_
_
_
_
_
_
D
_
_
_
_
D
_
_
_
_
D
Timer Example 3
3.19.3.1 Purpose
The purpose of this example is to demonstrate using the Timers in continuous mode and being
serviced by an interrupt.
3.19.3.2 Setup
Connect a USB to Serial converter to UART0 as this port is used to send debug text.
3.19.3.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
------------------------------------------------------------------- -Welcome to Timer Example 3...
All timers are in continuous mode and are polled in the main loop.
* Timer A will fire every 2 seconds.
* Timer B will fire every 3 seconds.
* Timer C will fire every 4 seconds.
* Timer D will fire every 5 seconds.
The current state of the timer will be shown every second
---------------------------------------------------------------------
55
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
2. Every second, the status of the timers will be printed. The output should be:
Timer
Timer
Timer
Timer
Timer
Timer
Timer
Timer
Timer
Timer
Timer
Timer
Timer
Timer
Timer
Timer
_
_
A
_
A
_
A
_
A
_
A
_
A
_
A
_
_
_
_
B
_
_
B
_
_
B
_
_
B
_
_
B
_
_
_
_
C
_
_
_
C
_
_
_
C
_
_
_
_
_
_
_
_
D
_
_
_
_
D
_
_
_
_
D
56
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.20 UART Examples
3.20.1
UART Example 1
3.20.1.1 Purpose
The purpose of this example is to demonstrate using the UART to transmit and receive characters.
3.20.1.2 Setup
Connect a USB to Serial converter to UART0 as this port is used to send debug text and for the
example.
3.20.1.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to UART Example 1...
Any character typed here will be echoed back on the same serial port.
--------------------------------------------------------------------2. Typing any characters here will cause them to be transmitted back.
Note that some terminal programs have a ‘local echo’ function. If enabled, then the transmitted
and received characters are displayed. If disabled, only the re ceive character is displayed.
3.20.2
UART Example 2
3.20.2.1 Purpose
The purpose of this example is to demonstrate using the UART to transmit and receive characters
using an interrupt.
3.20.2.2 Setup
Refer to 3.20.1.2 Setup Section.
3.20.2.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to UART Example 2...
Any character typed here will be echoed back on the same serial port
via an interrupt
--------------------------------------------------------------------2. Typing any characters here will cause them to be transmitted back.
57
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
Note that some terminal programs have a ‘local echo’ function. If enabled, then the transmitted
and received characters are displayed. If disabled, only the receive character is displayed.
3.20.3
UART Example 3
3.20.3.1 Purpose
The purpose of this example is to demonstrate using the UART to transmit and receive characters
using an interrupt which stores data in local memory and then the local data transmitted back
every second.
3.20.3.2 Setup
Refer to 3.20.1.2 Setup Section.
3.20.3.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to UART Example 3...
Any character typed here will be echoed back on the same serial port
via an interrupt and polled every second.
--------------------------------------------------------------------2. Typing any characters here will cause them to be transmitted back in one second bursts.
58
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.21 USB Device Examples
The USB device examples emulate a particular class of device or implement a function on the
FT900. The examples typically show emulating a device class.
Data can be received from or sent to the USB host permitting ‘bridge’ devices to be made which
transfer data from one interface to the USB device interface.
The specifications of the devices emulated in this section may be obtained from the USB –IF
website at http://www.usb.org/developers/docs/devclass_docs/.
FTDI have reserved a range of USB PIDs (from 0x0fd0 to 0x0fdf) which have been allocated to
different device classes to facilitate testing. Currently allocated PID values are listed in Table 3.1.
Class
VID
PID
CDC ACM
0x0403 (FTDI)
0x0fd1
RNDIS Networking
0x0403 (FTDI)
0x0fd3
CDC NCM
0x0403 (FTDI)
0x0fd4
Mass Storage
0x0403 (FTDI)
0x0fd5
HID
0x0403 (FTDI)
0x0fda
DFU
0x0403 (FTDI)
0xfde
Table 3.1 USB device example VIDs and PIDs.
For example, all HID devices for the FT900 will use a VID of 0x0403 and a PID of 0x0fda.
3.21.1
GPIO DFU Example
Provides a Device Firmware Update (DFU) interface , allowing a USB host to update firmware on
the device. This will allow a ROM image to be downloaded to a device from a utility program
running on a USB host. The firmware will wait for a GPIO line to be pulled down or a character to
be received from the UART to enable a DFU mode.
3.21.1.1 Purpose
The purpose of this example is to demonstrate using the USB device to download new firmware to
a device. A DFU interface is instantiated on the device allowing a utility program on the host to
connect to the device and download or upload firmware to or from the device. The DFU mode can
be activated programmatically when some input source is signaled. This example uses a GPIO line
or the UART interface.
The example complies with the Microsoft WCID specifications to automatically install a WinUSB
driver when the device is plugged into a Windows system. This simplifies installing the drivers
required by a DFU utility on the host to communicate with the DFU interface.
59
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.21.1.2 Setup
Connect the FT900 USB device port to a USB host. Pull GPIO 18 low (to GND) or send a carriage
return over the UART and DFU mode will be activated. Pull GPIO 17 low or send a space character
over the UART and DFU mode will be activated for 5 seconds. Pull GPIO 16 low or send any other
character over the UART and DFU mode will be activated for the de fault timeout which is around 1
second.
When the device is enumerated for the first time it will require a driver to be installed. Windows
will install the WinUSB device driver automatically.
The utility program dfu-util (http://dfu-util.sourceforge.net/) can be used to send firmware to the
device.
3.21.1.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to GPIO_DFU Example...
Start a DFU interface on the USB Device Port when a GPIO is pulled low .
--------------------------------------------------------------------On GPIO trigger GPIO18 for infinite DFU timeout
GPIO17 for 5 seconds DFU timeout
GPIO16 for default timeout
On UART press <CR> for infinite DFU timeout
<space> for 5 seconds DFU timeout
Any other key for default timeout
2. Pull GPIO18 low to enable the DFU interface.
GPIO18 interrupted
Starting DFU - never to return
3. Send the new firmware image to the device using the dfu-util utility:
60
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
C:\>dfu-util.exe -D dfu_test_file.bin.bin
dfu-util 0.8
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to [email protected]
Invalid DFU suffix signature
A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 0403:0fde
Run-time device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 256
Copying data from PC to DFU device
Download
[=========================] 100%
258048 bytes
Download done.
state(6) = dfuMANIFEST-SYNC, status(0) = No error condition is present
unable to read DFU status after completion
The “unable to read DFU status after completion” message is not indicative of a failure. It
is expected as the device resets itself when the firmware download is complete and
therefore dfu-util cannot receive an answer for a s tatus request.
3.21.2
USBD Example BOMS to SD Card
3.21.2.1 Purpose
This example program will create FT900 as a USB Bulk-Only Mass Storage (BOMS) device to the
USB host. Data for the mass storage device are read from or written to an SD card inserted in the
FT900 device.
3.21.2.2 Setup
Connect a USB to Serial converter to UART0 as this port is used to send debug text. Insert a
FAT32 formatted SD card (CN5 on the FT90x EVM). Connect the FT900 USB device port to a USB
host. The device is enumerated as a USB Mass Storage Device.
3.21.2.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to USB Mass Storage to SD Card Test Application ...
--------------------------------------------------------------------Change...connect card 2
Card initialise 0
Restarting
2. The FT900 device, after enumeration at the Windows host, should appear as a Removable
Disk Drive. Using Windows Explorer, Open the fold er to view files in the drive. All the file
operations – create, open, write, read, close, delete can be performed.
61
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
3.21.3
C learance N o.: FT DI# 4 5 1
USBD Example HID
Emulates a keyboard when connected to a USB host and sends a fixed sequence of key presses to
the operating system on the host.
3.21.3.1 Purpose
The purpose of this example is to demonstrate using the USB device to emulate a keyboard by
instantiating a HID device. The HID device is a boot mode keyboard which will enumerate then
send a predetermined string to the host as simulated key presses. The operating system on the
host can receive and treat these key presses as if they were from a real keyboard.
The example presents 2 USB interfaces to the host, a keyboard interface and a DFU (Device
Firmware Update) interface. This is therefore considered to be a composite USB device. The DFU
interface allow s firmware updates to the device under the control of a utility running on the host,
as per the previous example.
The method for handling standard, class and vendor requests for a composite device are shown.
Device, configuration and string descriptors for the device are defined and handled in the example
code.
An interrupt IN endpoint is on the keyboard interface which is polled by the USB host. Simulated
key presses are sent to the host using a report descriptor. The format of the descriptor is given in
the code and is available to the host to aid it in interpreting the key press ‘reports’. The required
functions of a HID class device are covered including the SetIdle request.
The string to send to the host demonstrates pressing normal alpha-numeric keys, the Caps Lock
key, and the carriage return key.
3.21.3.2 Setup
Connect the FT900 USB device port to a USB host. When the device is enumerated as a USB
keyboard it will start sending a text string to the host which will appear as if typed in by a real
keyboard.
3.21.3.3 Execution
1. A welcome message should appear like so,
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to USBD HID Tester Example 1.,,
Emulate a HID device connected to the USB Device Port
--------------------------------------------------------------------2. After enumeration this string will appear on the debug console and the host system.
Hello, I am an FTDI FT900 device... nice to meet you!
3. The device will not perform any further actions.
62
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
3.21.4
C learance N o.: FT DI# 4 5 1
USBD Example HID Bridge
Emulates a keyboard when connected to a USB host and sends characters received from the UART
interface as key presses to the operating system on the host.
3.21.4.1 Purpose
The purpose of this example is to demonstrate using the USB device to emulate a keyboard by
instantiating a HID device. The HID device is a boot mode keyboard which will enumerate then
convert characters received from the UART interface into simulated key presses. The operating
system on the host can receive and treat these key presses as if they were from a real keyboard.
The example presents 2 USB interfaces to the host, a keyboard interface and a DFU (Device
Firmware Update) interface. This is therefore considered to be a composite USB device. The DFU
interface allows firmware updates to the device under the control of a utility running on the host,
as per the previous example.
The method for handling standard, clas s and vendor requests for a composite device are shown.
Device, configuration and string descriptors for the device are defined and handled in the example
code.
An interrupt IN endpoint is on the keyboard interface which is polled by the USB host. Simulat ed
key presses are sent to the host using a report descriptor. The format of the descriptor is given in
the code and is available to the host to aid it in interpreting the key press ‘reports’. The required
functions of a HID class device are covered including the SetIdle request.
The characters translated from the UART interface include several control characters and escape
sequences which are produced by popular PC terminal emulation programs.
3.21.4.2 Setup
Connect the FT900 USB device port to a USB host and a USB to UART convertor to the FT900
UART.
3.21.4.3 Execution
1. A welcome message should appear like so,
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to USBD HID Bridge Example 1.,,
Emulate a HID device connected to the USB Device Port, bridge buffer
from the UART to the HID device.
--------------------------------------------------------------------2. After enumeration characters received from the UART interfa ce will appear as key presses
on the host system.
Hello, I am an FTDI FT900 device... nice to meet you!
63
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
3.21.5
C learance N o.: FT DI# 4 5 1
USBD Example CDCACM
Emulates a Communications Device Class (CDC) Abstract Control Model (ACM) device when
connected to a USB host. This example allows the operating system on the host to open a virtual
COM port to the CDC ACM device. Data is read from the UART interface and transmitted to the
host, data received from the host is sent to the UART interface.
3.21.5.1 Purpose
The purpose of this example is to demo nstrate using the USB device to emulate a Communications
Device Class (CDC) device. The type of CDC device emulated is an Abstract Control Model (CDC
ACM).
The example shows a composite device presenting 3 USB interfaces to the host, a CDC CONTROL
interface, a CDC DATA interface and a DFU interface.
The method for handling standard, class and vendor requests for the composite device are shown.
Device, configuration and string descriptors for the device are defined and handled in the example
code.
The CDC CONTROL interface has an interrupt IN endpoint to receive notifications which is polled by
the USB host. A notification structure is sent to the host periodically when the state of the UART
changes.
The CDC DATA interface has 2 BULK endpoints, one for IN packets and one for OUT packets. This
forms a bi-directional data pipe to the virtual COM port on the USB host for both receiving data
and transmitting data. A circular buffer on the device is used to turn the data stream to and from
the UART into packets used by the USB interface.
A DFU interface is also provided device. The example also complies with the Microsoft WCID
specifications to automatically install a WinUSB driver when the device is plugged into a Windows
system. This simplifies installing the drivers required by a DFU utility on the host to communication
with the DFU interface.
3.21.5.2 Setup
Connect the FT900 USB device port to a USB host. When the device is enumerated it will require a
driver to be installed. This is only required the first time it is connected.
To install the Windows built-in CDC ACM driver start Device Manager and right-click on the “FT900
CDC ACM” device in “Other Devices”. The click on “Update device driver…”, then “Browse my
computer for driver software” and navigate to the examples directory. The next step may be a
Dialog box stating that “Windows can’t verify the publisher of this driver software”, click on “Install
this driver software anyway”. The CDC ACM driver will install and a virtual COM port will appear in
Device Manager under “COM Ports”.
When running a terminal program on the USB host (such as PuTTY or CoolTerm) a virtual COM
port can be opened to allow direct communication with the emulated CDC device. If the UART
interface on the FT900 is also connected to a PC terminal program as well then data can be sent
both ways between the terminal programs. It is also possible to connect to an external device such
as a modem.
64
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.21.5.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to USBD CDC ACM Tester Example 1...
Emulate a CDC ACM device connected to the USB Device Port.
---------------------------------------------------- ----------------2. The device will continue to bridge from the USB CDC ACM interface to the UART.
65
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.22 USB Host Examples
The USB host examples demonstrate connecting to and controlling devices connected to the host
USB.
Data can be received from or sent to USB devices and control operations can be performed on
these devices.
The specifications of the devices connected to in this section may be obtained from the USB –IF
website at http://www.usb.org/developers/docs/devclass_docs/.
3.22.1
USBH_Example Hub
Lists devices connected to the USB host port of the FT900. The output is sent to the UART
interface.
3.22.1.1 Purpose
The purpose of this example is to demonstrate using the USB host to find and identify devices on
the USB. It will send queries to the devices found to request additional information.
3.22.1.2 Setup
Connect the FT900 USB host port to a USB device or a USB hub with multiple devices . When the
devices are enumerated the program will list all detected devices.
3.22.1.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to USBH Hub Tester Example 1...
List devices connected to the USB Host Port
--------------------------------------------------------------------2. When a device is connected then the program will output information about the device.
This example is for a generic USB flash disk:
66
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
USB Device Detected
USB Device Enumerated
Device found at level 1
Device Descriptors:
bcdUSB:
bDeviceClass:
bDeviceSubClass:
bDeviceProtocol:
bMaxPacketSize0:
VID:
PID:
bcdDevice:
iManufacturer:
iProduct:
iSerialNumber:
0200
00
00
00
40
1043
8012
0100
Generic
Flash Disk
0604260938510038
Configuration Descriptors:
wTotalLength:
bNumInterfaces:
bConfigurationValue:
iConfiguration:
bmAttributes:
MaxPower:
0020
01
01
00
80
32
Interface Descriptors:
bInterfaceNumber:
bAlternateSetting:
bNumEndpoints:
bInterfaceClass:
bInterfaceSubClass:
bInterfaceProtocol:
iInterface:
00
00
02
08
06
50
00
Endpoint Descriptors:
bEndpointAddress:
Transfer Type:
wMaxPacketSize:
bInterval:
81
Bulk
0000
02
Endpoint Descriptors:
bEndpointAddress:
Transfer Type:
wMaxPacketSize:
bInterval:
02
Bulk
0000
02
Please remove the USB Device
Devices can be removed once they have been queried and other devices then inse rted.
Devices connected to USB hubs will be queried as well, however, the example code does
not check for connection or removal events on USB hubs and will not update the output if
new devices are added or devices removed from a downstream hub.
3.22.2
USBH Example HID
Display report data received from a Human Interface Device (HID) over the USB. The output is
sent to the UART interface. The data is not interpreted to decode the meaning of the HID reports.
67
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.22.2.1 Purpose
The purpose of this example is to demonstrate receiving USB HID reports from a HID device. This
is done by polling an interrupt IN endpoint for data from the device under test.
A simple blocking read is made of the interrupt endpoint with a 1000 ms timeout. If data has been
received then the data is displayed in hexadecimal format.
3.22.2.2 Setup
Connect the FT900 USB host port to a USB HID device such as a keyboard or a mouse . When the
HID device is enumerated the program will start displaying HID reports as they are received from
the HID device.
3.22.2.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to USBH HID Tester Example 1...
Find and displays reports received from HID devices connected to
the USB Host Port
--------------------------------------------------------------------2. When a device is connected then the program will output information from the device:
USB Device Detected
USB Device Enumerated
HID device found at level 1
VID: 03f0 PID: 0024
Speed: 0 low
Address: 1
Setting idle
Reports from device 8 bytes:
20 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
20 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
Timeout
The HID reports can be decoded into key presses and displayed on the terminal. However,
this is out with the scope of this example code. This example shows a low -speed keyboard
with 8 bytes of HID report data. The “Timeout” occurs when the device does not respond
to the host requests within an arbitrary length of time; it does not indicate an error.
3.22.3 USBH Example CDCACM
Implement a UART to Communication Device Class (CDC) bridge over the USB.
3.22.3.1 Purpose
This example code demonstrates bridging bi-directional data from the UART interface to a C DC
device on the USB. The CDC device must support Abstract Control Model (CDC ACM).
68
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.22.3.2 Setup
Connect the FT900 USB host port to a USB CDC ACM device such as a modem or mobile phone.
When the CDC device is enumerated the program will start sending data received from the UART
interface to the CDC device and returning data from the CDC device to the UART interface.
3.22.3.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to USBH CDC Tester Example 1...
Bridge data from the UART to a CDC ACM device on the USB host port.
--------------------------------------------------------------------2. When a device is connected then the program will output information about the device
then bridge data:
USB Device Detected
USB Devices Enumerated
Beginning CDC ACM testing 0 0
Beginning CDC ACM testing
Sending encapsulated reset... not supported -3
Sending reset to DATA interface...Received OK
ATZ
OK
ATDT07778889999
ERROR
The example code will send an encapsulated reset command (“ATZ”). This may or may not
be supported by the device.
In the example output the reset command “ATZ” was sent via the UART as the
encapsulated command was not accepted by the device.
Then an attempt to dial was made which resulted in an error – the device did not have a
SIM card.
3.22.4
USBH Example BOMS
Implement a simple tester for USB Bulk-Only Mass Storage (BOMS) devices.
3.22.4.1 Purpose
This example code will query a flash disk which supports the BOMS specification and read sectors 0
and 1025 with the contents displayed in hexadecimal format on the UART interface. It will then
read the entire first cluster of the disk and display that similarly on the UART interface.
3.22.4.2 Setup
Connect the FT900 USB host port to a USB BOMS device such as a Flash disk. When the BOMS
device is enumerated the program will start sending data received from the sectors read on the
BOMS device to the UART interface.
69
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.22.4.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to USBH BOMS Tester Example 1...
Find and exercises BOMS (Flash Disk) devices connected to the USB
Host Port
--------------------------------------------------------------------2. When a device is connected, the program will output information about the device followed
by data from the device:
USB Device Detected
USB Devices Enumerated
BOMS device found at level 1
Sector 0
33 c0 8e
06 b9 00
f6 e4 05
b8 01 02
00 7c 00
b9 04 00
80 3d 80
be 9c 06
04 31 50
0e cd 10
20 61 63
6e 2e 2e
6e 6f 74
00 00 00
00 00 00
00 00 00
00 00 00
00 00 00
00 00 00
00 00 00
00 00 00
00 00 00
00 00 00
00 00 00
00 00 00
00 00 00
00 00 00
00 00 00
01 00 06
00 00 00
00 00 00
00 00 00
c0
01
ae
cd
00
32
74
eb
be
58
74
ae
20
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
0f
00
00
00
8e
f2
04
13
80
f6
19
04
99
a8
69
0d
66
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
e0
00
00
00
d8
a5
8b
72
fa
8a
fe
90
06
80
76
0a
6f
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
ff
00
00
00
8e
ea
f0
16
81
45
c6
be
bb
74
65
50
75
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
20
00
00
00
d0
44
8a
81
74
04
83
b4
1b
f2
20
61
6e
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
bc
06
74
bf
02
3c
c7
06
06
c3
70
72
64
00
00
00
00
00
00
00
00
00
00
00
00
00
00
0a
00
00
00
00
00
00
01
fe
b2
00
10
e8
53
0d
61
74
2e
00
00
00
00
00
00
00
00
00
00
00
00
00
00
0b
00
00
00
00
7c
00
8b
01
80
74
e2
0e
fc
0a
72
69
2e
00
00
00
00
00
00
00
00
00
00
00
00
00
00
0c
e0
00
00
00
fc
8b
4c
55
8b
0b
e9
00
ac
a0
74
74
ae
00
00
00
00
00
00
00
00
00
00
00
00
00
00
0d
ff
00
00
00
8b
d5
02
aa
ea
3c
0a
eb
50
0d
69
69
00
81
00
00
00
00
00
00
00
00
00
00
00
00
00
00
07
00
00
00
f4
58
bb
75
bf
05
f6
fe
24
0a
74
6f
00
24
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
bf
b4
00
0e
be
74
74
8a
7f
4e
69
6e
00
18
00
00
00
00
00
00
00
00
00
00
00
00
00
80
00
00
00
55
00
10
7c
ea
07
07
06
c6
b4
6f
6f
20
00
11
00
00
00
00
00
00
00
00
00
00
00
00
00
01
00
00
00
aa
Sector 1025
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
3.22.5
USBH Example File System
Implement a simple file system tester for USB Bulk-Only Mass Storage (BOMS) devices. This uses
the FatFS library.
70
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.22.5.1 Purpose
This example code will query a flash disk which supports the BOMS specification and read sectors 0
and 1025 with the contents displayed in hexadecimal format on the UART interface. It will then
read the entire first cluster of the disk and display that s imilarly on the UART interface.
3.22.5.2 Setup
Connect the FT900 USB host port to a USB BOMS device such as a Flash disk. When the BOMS
device is enumerated the program will start performing tests on the file system on the BOMS
device and sending the result to the UART interface.
3.22.5.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to USBH File System Tester Example 1...
Find and exercises Flash Disks devices connected to the USB
Host Port
--------------------------------------------------------------------2. When a device is connected the program will display the files in the root directory of the
disk:
USB Device Detected
USB Device Enumerated
BOMS device found at level 1
ls(path = ""):
DD/MM/YYYY HH:MM
Size
01/08/2014 10:57
333878
01/08/2014 10:57
333878
20/08/2014 10:32
0
20/08/2014 10:33
0
22/07/2014 13:51
207360
...
17/07/2014 16:56
<DIR>
0
30/10/2014 16:09
114146
28/10/2014 10:48
151328281
04/11/2014 13:16
210
42 File(s)
290935952
Filename
SCR01.BMP
SCR02.BMP
SCR03.BMP
SCR04.BMP
TMCAPP~1.EXE
FT900
ETH_EX~1.PNG
V100~1.ZIP
GCCVARS.BAT
bytes
3. Then the program will write some data to a text file:
LOREM.TXT already exists. Deleting
Opening LOREM.TXT for writing
Wrote 1658 bytes
Closing LOREM.TXT
71
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
4. The program will read back the file:
Opening LOREM.TXT for reading
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi dictum mi eget
malesuada auctor. Cras tellus ligula, feugiat ac ante eu, tincidunt consectetur
mauris. Phasellus in mollis enim, dapibus venenatis est. Sed urna tellus, varius a
dui sed, scelerisque commodo lectus. In pretium lobortis tortor, semper ultricies
odio viverra a. Ut sit amet aliquam lectus. Phasellus non risus a nisl semper
vehicula a vitae lorem. Fusce suscipit, purus nec facilisis lacinia, lacus massa
aliquet augue, in feugiat neque nibh a lacus. Curabitur pharetra viverra massa
quis efficitur.
Mauris posuere nisl vel aliquam finibus. Aenean ac fringilla justo. Nulla eu
sollicitudin erat. Duis in ligula at quam pretium hendr erit. Fusce quis egestas
metus. In hac habitasse platea dictumst. Fusce tincidunt enim at tempus
ullamcorper. Aenean pellentesque condimentum sapien vel porta. In sollicitudin
tempor pulvinar. Pellentesque aliquet justo lacus, scelerisque feugiat augue
commodo viverra.
Etiam pulvinar quam a pulvinar aliquam. Cras rutrum quis tortor ut ultrices.
Curabitur sit amet odio eros. Mauris auctor erat non risus interdum, at venenatis
urna interdum. Nam eget auctor risus, auctor fringilla leo. Quisque sit amet
ligula mattis, gravida tortor quis, ullamcorper odio. Nullam semper mauris at leo
aliquam, quis mollis tortor iaculis. Mauris ut tempor elit, sed sodales magna.
Donec non eros tortor. Donec lorem justo, vestibulum vitae sagittis ac, bibendum
vitae velit. Integer ante mi, tempus sodales consectetur vel, porta ac libero.
Maecenas dapibus orci at rhoncus bibendum. Nulla elementum lectus massa, non
varius lorem scelerisque sit amet.
Closing LOREM.TXT
72
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
3.22.6
C learance N o.: FT DI# 4 5 1
AOA Examples
The Android AOA feature allows Android devices to attach to USB Host devices as an accessory. In
this mode, the Android device is powered by the Host device (such as FT900). Data exchange is
over custom Bulk End Points or over USB HID (available in AOAv2). AOAv1 support is available
from Android 3.1 and AOAv2 support is available from Android 4.1.
The FT900 USB Peripheral Driver Library provides an AOA driver (usbh_aoa.c) tha t implements the
AOA protocol.
3.22.6.1 Installing Example Apps onto an Android Device

The GPIO and UARTLoopback examples require companion Apps on the Android device to
interact with. The HID example does not require any specific App to run.

To install the Apps download and extract the “Android.zip”
http://www.ftdichip.com/Support/SoftwareExamples/Android/Android.zip

An App note explaining the details of the Android Apps is available online: AN_208
FT311/FT312D Demo APK User Guide

Copy or send the GPIODemoActivity.apk and UARTLoopbackActivity.apk onto the Android
device.

On the Android device, go to Settings > Security > Unknown Sources and select “Allow
installation of apps which are not from the electronic market”.

Using a file browser App (such as “File Explorer” or “ES File Explorer”) on the Android
device navigate to the apk location and open them. Install both the GPIODemoActivity and
UARTLoopbackActivity.
folder
from
Note: Ensure Developer Options > USB Debugging is not enabled on the Android device;
otherwise the examples will not function correctly.
3.22.6.2 GPIO Example
3.22.6.2.1
Purpose
The purpose of this demo is to illustrate data exchange between an Android App and the FT900.
3.22.6.2.2
Setup
Program the FT900 development board with “USBH Example AOA GPIO 1.bin”.
Connect a USB to Serial converter to UART0 as this port is used to send debug text.
Open up terminal PC application program for UART0 w ith following port setting: 19200 baud, no
parity, 8 data bits, 1 stop bit.
Connect FT900 USB Host Port to an Android device that contains the GPIODemoActivity.apk preinstalled.
73
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
3.22.6.2.3
C learance N o.: FT DI# 4 5 1
Execution
1. A welcome message should appear on the PC terminal application like so,
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to USBH GPIO AOA Tester Example 1...
Tests the FTDIGPIODemo on an Android device.
--------------------------------------------------------------------2. Connect the Android device to the MM900EV Board using a USB cable. The PC terminal
application should display
USB Device Detected
.USB Devices Enumerated
Init AOA
Will re-enumerate as AOA
..........................................................................
..........................................................................
..........................................................................
..........................................................................
.......................................................USB Devices
Enumerated
Init AOA
Attaching AOA
Testing AOA
VID: 18d1 PID: 2d01
Speed: 2 high
Address: 1
Accessory: yes
Audio: no
Adb: yes
Write: 4
On the Android device, the following pop-up should appear. Select OK to continue.
3. Select OK on the Android device. The GPIODemo application should be automatically
launched and you should be able to see the following screen.
74
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
4. Click the “Config” button on the App to send some data to FT900. The following message
will appear on the PC terminal.
Configure command: Outmap 0000000 Inmap 1111111
5. Click the “Read” button on the App to read the “Bitmap” status. The current Bitmap status
is displayed on the PC terminal as:
Read Port: Bitmap 0000010
The appropriate bit in the “In Data” list will be set according to the current bitmap.
3.22.6.3 UART Loopback Example
3.22.6.3.1
Purpose
The purpose of this demo is to illustrate data exchange between an Android App and the FT900.
3.22.6.3.2
Setup
Program the FT900 development board with “USBH Example AOA UARTLoopback 1.bin”.
Connect a USB to Serial converter to UART0 as this port is used to send debug text.
Open up terminal PC application program for UART0 with following port setting: 19200 baud, no
parity, 8 data bits, 1 stop bit.
Connect FT900 USB Host Port to an Android device that contains the UARTLoopbackActivity.apk
pre-installed.
3.22.6.3.3
Execution
1. A welcome message should appear on the PC terminal application like so,
75
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to USBH UART AOA Tester Example 1...
Tests the FTDIUARTLoopback on an Android device.
--------------------------------------------------------------------2. Connect the Android device to the MM900EV Board using a USB cable. The PC terminal
application should display
USB Device Detected
.USB Devices Enumerated
Init AOA
Will re-enumerate as AOA
.................................. ........................................
..........................................................................
..........................................................................
..........................................................................
..........................USB Devices Enumerated
Init AOA
Attaching AOA
Testing AOA
VID: 18d1 PID: 2d01
Speed: 2 high
Address: 1
Accessory: yes
Audio: no
Adb: yes
On the Android device, the following pop-up should appear
3. Select OK on the Android device. The UARTLoopback application should be automatically
launched and you should be able to see the following screen
76
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
4. Press the “Config” button on the App. The following message will appear on the PC
terminal. Note that none of the UART parameters are actually changed.
Config: baud 9600 stop 8 data 1 parity None flow None
5. Send some data by typing into the PC terminal, for example the string “Hello World!” The
string should appear in the “Read Bytes” text box in the Android App as shown below.
6. To transmit data to FT900 type something in the “Write Bytes” text box in the App and
click on “Write”
3.22.6.4 AOA HID Example
3.22.6.4.1
Purpose
AOAv2 allows AOA Hosts to register as one or more Human Interface Device (HID) with the
Android device. The HID example use s this feature to make FT900 register as a HID keyboard with
the Android device. This demo can be used with any android App that can accept keyboard input.
77
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
3.22.6.4.2
C learance N o.: FT DI# 4 5 1
Setup
Program the FT900 development board with “USBH Example AOA HID 1.bin”.
Connect a USB to Serial converter to UART0 as this port is used to send debug text.
Open up terminal PC application program for UART0 with following port setting: 19200 baud, no
parity, 8 data bits, 1 stop bit.
Connect FT900 USB Host Port to an Android device with android v4.1 and above.
3.22.6.4.3
Execution
1. A welcome message should appear on the PC terminal application like so,
Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to USBH AOA HID Tester Example 1...
Bridges UART input to a HID keyboard on an Android device.
--------------------------------------------------------------------2. Connect the Android device to the MM900EV Board using a USB cable. The PC terminal
application should display
USB Device Detected
.USB Devices Enumerated
Init AOA
Will re-enumerate as AOA
.........................................................................U
SB Devices Enumerated
Init AOA
Attaching AOA
Testing AOA
VID: 18d1 PID: 2d01
Speed: 2 high
Address: 1
Accessory: yes
Audio: no
Adb: yes
3. On the Android device the following pop-up will appear. Select Cancel to proceed.
78
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
4. On the Android device, launch any App that can accept keyboard inputs like the FTDI UART
Terminal App from the Google Play store or any text editor app.
5. At the PC terminal type a string that you wish to send to the Android device, e.g.: “Hello
World!”
6. The string should be displayed on the Android device.
Note that even though the AOA specification says that Hosts that are not associated with Apps can
enumerate without sending the manufacturer and model names (see section “ Connecting to
AOAv2 without an Android app” at https://source.android.com/accessories/aoa2.html). As of
Android 5.x, such devices are not allowed to enumerate. This is currently still an open bug.
79
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
3.23 Watchdog Timer Examples
3.23.1
Watchdog Example 1
3.23.1.1 Purpose
The purpose of this example is to demonstrate using the Watchdog Timer.
3.23.1.2 Setup
Connect a USB to Serial converter to UART0 as this port is used to send debug text.
3.23.1.3 Execution
1. A welcome message should appear like so:
(C) Copyright 2016, Future Technology Devices International Ltd.
--------------------------------------------------------------------Welcome to WDT Example 1...
Kick the watchdog for 10 seconds then let it expire.
--------------------------------------------------------------------2. The program will kick the watchdog for 10 seconds and then resets the device:
WDT
WDT
WDT
WDT
WDT
WDT
WDT
WDT
WDT
WDT
Kick
Kick
Kick
Kick
Kick
Kick
Kick
Kick
Kick
Kick
1
2
3
4
5
6
7
8
9
10
The welcome message is shown after the device is reset and the timer example should run again if
the program is stored in flash.
80
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
4 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 8791 3570
Fax: +886 (0) 2 8791 3576
Future Technology Devices International Limited
(C hina)
Room 1103, No. 666 West Huaihai Road,
Shanghai, 200052
C hina
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
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.
Sys tem and equipment manufacturers and des igners are responsible to ens ure that their s ystems, and any Future T ec hnology
D evic es I nternational L td (FT DI) devices inc orporated in their s ystems, meet all applicable s afety, regulatory and s ystem - level
performanc e requirements. A ll application-related information in this document (including application des c riptions , s ugges ted
FT D I devic es and other materials ) is provided for referenc e only. While FT D I has taken c are to as s ure it is ac c urate, this
information is s ubject to c ustomer c onfirmation, and FT D I dis c laims all liability for s ys tem des igns and for any applic ations
as s istance provided by FTD I. U se of FT DI devices in life s upport and/or s afety applications is entirely at the us er’s ris k, a nd the
us er agrees to defend, indemnify and hold harmles s FTDI from any and all damages , c laims , s uits or expens e res ulting from
s uc h us e. T his doc ument is s ubject to c hange without notic e. N o freedom to us e patents or other intellectual property rights is
implied by the public ation of this doc ument. N either the whole nor any part of the information c ontained in, or the produc t
des c ribed in this doc ument, may be adapted or reproduc ed in any material or electronic form without the prior written c ons ent
of the c opyright holder. Future T ec hnology D evic es I nternational L td, U nit 1 , 2 Seaward P lac e, C enturion Bus ines s P ark,
G las gow G 4 1 1 H H , U nited Kingdom. Sc otland Regis tered C ompany N umber: SC 1 3 6 6 4 0
81
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
Appendix A – References
Document References
http://www.ftdichip.com/Products/ICs/FT90x.html
FT900/FT901/FT902/FT903 Datasheet
FT905/FT906/FT907/FT908 Datasheet
FT900 User Manual
AN_325 FT900 Toolchain Installation Guide
Serial Cables: http://www.ftdichip.com/Products/Cables/USBTTLSerial.htm
Bus Pirate: http://dangerousprototypes.com/docs/Bus_Pirate
GNU Make Manual - 9.5 Overriding Variables
(http://www.gnu.org/software/make/manual/html_node/Overriding.html#Overriding)
Acronyms and Abbreviations
Terms
Description
ADC
Analogue to Digital Converter
ARP
Address Resolution Protocol
CAN
Controller Area Network
DAC
Digital to Analogue Converter
EEPROM
GPIO
Electronically Erasable PROgrammable Memory
General Purpose I/O
I2C
Inter-IC
I2S
Inter-IC Sound
ICMP
Internet Control Messaging Protocol
MDI-X
Medium Dependent Interface Crossover
PWM
Pulse Width Modulation
RTC
Real Time Clock
SD
Secure Digital
SPI
Serial Peripheral Interface
UART
Universal Asynchronous Receiver Transmitter
WDT
WatchDog Timer
82
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
Appendix B – List of Tables & Figures
List of Tables
Table 3.1 USB device example VIDs and PIDs............................................................................. 59
List of Figures
Figure 1: FT90x Interface driver support....................................................................................... 4
Figure 2: FT90x Programming Utility ............................................................................................ 6
Figure 3: Circuit Diagram for ADC Examples ................................................................................. 7
Figure 4: Circuit diagram for CAN Examples................................................................................ 12
Figure 5: D2XX Port opened in the PC Terminal application ......................................................... 16
Figure 6: FT900 Programming Utility D2XX Tab .......................................................................... 16
Figure 7: Output from dac_example1.c....................................................................................... 17
Figure 8: Output from dac_example2.c....................................................................................... 18
Figure 9: Wireshark output for eth_example1.c .......................................................................... 25
Figure 10: Circuit Diagram for I2C Master Examples ................................................................... 35
Figure 11: Circuit Diagram for I2C Slave Examples ..................................................................... 38
Figure 12: PWM Low Pass Filter .................................................................................................. 43
Figure 13: Circuit Diagram for SPI Master Examples ................................................................... 47
Figure 14: Circuit Diagram for SPI Master EEPROM Examples...................................................... 48
Figure 15: Circuit Diagram for SPI Master Example 3 .................................................................. 50
Figure 16: Circuit Diagram for SPI Slave Examples ..................................................................... 52
83
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited
Application Note
AN_360 FT90x Example Applications
V ers ion 1 .2
D oc ument Reference N o.: FT _001149
C learance N o.: FT DI# 4 5 1
Appendix C – Revision History
Document Title:
AN_360 FT90x Example Applications
Document Reference No.:
FT_001149
Clearance No.:
FTDI# 451
Product Page:
http://www.ftdichip.com/FTProducts.htm
Document Feedback:
Send Feedback
Revision
Changes
Date
1.0
Initial Release
2015-06-29
1.1
Addition of USB Examples, I2C Master
2015-10-08
1.2
Added examples for USBH AOA, FreeRTOS, VFW
Loader, D2XX, Datalogger feature, USBD BOMS to SD
Card and BCD Device
2016-02-24
84
P roduc t Page
D oc ument Feedback
C opyright © Future T echnology D evices I nternational L imited