User Guide For LibMPSSE – I2C

2y ago
11 Views
2 Downloads
742.30 KB
25 Pages
Last View : 4m ago
Last Download : 3m ago
Upload by : Mariam Herr
Transcription

Application NoteAN 177User Guide For libMPSSE – I2CVersion 1.5Issue Date: 2020-05-27This application note is a guide to using the libMPSSE-I2C – a library whichsimplifies the design of firmware for interfacing to the FTDI MPSSE configuredas an I2C interface. The library is available for Windows and for LinuxUse of FTDI devices in life support and/or safety applications is entirely at the user’s risk, and theuser agrees to defend, indemnify and hold harmless FTDI from any and all damages, claims, suitsor expense resulting from such use.Future Technology Devices International Limited (FTDI)Unit 1, 2 Seaward Place, Glasgow G41 1HH, United KingdomTel.: 44 (0) 141 429 2777 Fax: 44 (0) 141 429 2758Web Site: http://ftdichip.comCopyright Future Technology Devices International Limited

Application NoteAN 177 User Guide For libMPSSE – I2CVersion 1.5Document Reference No.: FT 000466Clearance No.: FTDI#210Table of Contents1 Introduction . 32 System Overview . 43 Application Programming Interface (API) . 53.1 I2C Functions .53.1.1I2C GetNumChannels . 53.1.2I2C GetChannelInfo . 53.1.3I2C OpenChannel . 63.1.4I2C InitChannel . 63.1.5I2C CloseChannel . 73.1.6I2C DeviceRead . 73.1.7I2C DeviceWrite. 93.2 GPIO functions .113.2.1FT WriteGPIO . 113.2.2FT ReadGPIO . 113.3 Library Infrastructure Functions .113.3.1Init libMPSSE. 123.3.2Cleanup libMPSSE . 123.4 Data types .123.4.1ChannelConfig . 123.4.2I2C CLOCKRATE . 133.4.3Typedefs . 134 Example Circuit . 145 Example Program . 156 Contact Information . 21Appendix A – References . 22Document References . 22Acronyms and Abbreviations. 22Appendix B – List of Tables & Figures . 23List of Tables.23Product PageDocument Feedback1Copyright Future Technology Devices International Limited

Application NoteAN 177 User Guide For libMPSSE – I2CVersion 1.5Document Reference No.: FT 000466Clearance No.: FTDI#210List of Figures .23Appendix C – Revision History . 24Product PageDocument Feedback2Copyright Future Technology Devices International Limited

Application NoteAN 177 User Guide For libMPSSE – I2CVersion 1.5Document Reference No.: FT 000466Clearance No.: FTDI#2101 IntroductionThe Multi-Protocol Synchronous Serial Engine (MPSSE) is a generic hardware found in several FTDIchips that allows these chips to communicate with a synchronous serial device such an I2C device,a SPI device or a JTAG device. The MPSSE is currently available on the FT2232D, FT2232H,FT4232H and FT232H chips, which communicate with a PC (or an application processor) over theUSB interface. Applications on a PC or on an embedded system communicate with the MPSSE inthese chips using the D2XX USB drivers.The MPSSE takes different commands to send out data from the chips in the different formats,namely I2C, SPI and JTAG. libMPSSE is a library that provides a user friendly API to enable usersto write applications to communicate with the I2C/SPI/JTAG devices without needing tounderstand the MPSSE and its commands. However, if the user wishes then he/she may try tounderstand the working of the MPSSE and use it from their applications directly by calling D2XXfunctions.User ApplicationlibMPSSE(SPI/I2C/JTAG Library)D2XX APIUSB Bus driverFTDI USB-to-Legacybridge chipsLegacy protocol slavedeviceFigure 1 - The Software & Hardware Stack through which legacy protocol data flowsAs shown in Figure 1, libMPSSE has three different APIs, one each for I2C, SPI and JTAG. Thisapplication note only describes the I2C section. The libMPSSE library (Linux or Windows versions),sample code, release notes and all necessary files can be downloaded from the FTDI website s/MPSSE.htmThe sample source code contained in this application note is provided as an example and is neitherguaranteed nor supported by FTDI.Product PageDocument Feedback3Copyright Future Technology Devices International Limited

Application NoteAN 177 User Guide For libMPSSE – I2CVersion 1.5Document Reference No.: FT 000466Clearance No.: FTDI#2102 System OverviewFigure 2 - System OrganizationFigure 2 shows how the components of the system are typically organised. The PC/Host may bedesktop/laptop machine or an embedded system. The FTDI chip and the I2C device would usuallybe on the same PCB. Though only one I2C device is shown in the diagram above, many devicescan actually be connected to the bus if each device has a different I2C address. I2C devices thatsupport configurable addresses will have pins which can be hardwired to give a device anappropriate address; this information may be found in the datasheet of the I2C device chip.Product PageDocument Feedback4Copyright Future Technology Devices International Limited

Application NoteAN 177 User Guide For libMPSSE – I2CVersion 1.5Document Reference No.: FT 000466Clearance No.: FTDI#2103 Application Programming Interface (API)The libMPSSE-I2C APIs can be divided into two broad sets. The first set consists of five controlAPIs and the second set consists of two data transferring APIs. All the APIs return an FT STATUS.This is the same FT STATUS that is defined in the D2XX driver.3.1 I2C Functions3.1.1 I2C GetNumChannelsFT STATUS I2C GetNumChannels (uint32 *numChannels)This function gets the number of I2C channels that are connected to the host system. The numberof ports available in each of these chips is different.Parameters:out*numChannelsThe number of channels connected to the hostReturns:Returns status code of type FT STATUSNote:FTDI’s USB-to-legacy bridge chips may have multiple channels in them but not all thesechannels can be configured to work as I2C masters. This function returns the total number ofchannels connected to the host system that has a MPSSE attached to it so that they may beconfigured as I2C masters.For example, if an FT2232D (1 MPSSE port), a FT232H (1 MPSSE port), a FT2232H (2 MPSSEport) and a FT4232H (2 MPSSE ports) are connected to a PC, then a call toI2C GetNumChannels would return 6 in numChannels.Warning:This function should not be called from two applications or from two threads at thesame time.3.1.2 I2C GetChannelInfoFT STATUS I2C GetChannelInfo (uint32 index,FT DEVICE LIST INFO NODE *chanInfo)This function takes a channel index (valid values are from 0 to the value returned byI2C GetNumChannels – 1) and provides information about the channel in the form of a populatedFT DEVICE LIST INFO NODE structure.Parameters:inoutindex*chanInfoIndex of the channelPointer to FT DEVICE LIST INFO NODE structureReturns:Returns status code of type FT STATUSNote:Product PageDocument Feedback5Copyright Future Technology Devices International Limited

Application NoteAN 177 User Guide For libMPSSE – I2CVersion 1.5Document Reference No.: FT 000466Clearance No.: FTDI#210This API could be called only after calling I2C GetNumChannels.See also:Structure definition of FT DEVICE LIST INFO NODE is in the D2XX Programmer’s Guide.Warning:This function should not be called from two applications or from two threads at the same time.3.1.3 I2C OpenChannelFT STATUS I2C OpenChannel (uint32 index, FT HANDLE *handle)This function opens the indexed channel and provides a handle to it. Valid values for the index ofchannel can be from 0 to the value obtained using I2C GetNumChannels – 1).Parameters:inoutIndexHandleIndex of the channelPointer to the handle of type FT HANDLEReturns:Returns status code of type FT STATUSNote:Trying to open an already open channel returns an error code.3.1.4 I2C InitChannelFT STATUS I2C InitChannel (FT HANDLE handle, ChannelConfig *config)This function initializes the channel and the communication parameters associated with it.Parameters:InInHandleConfigoutNoneHandle of the channelPointer to ChannelConfig structure. Members ofChannelConfig structure contains the values for I2C masterclock, latency timer and OptionsReturns:Returns status code of type FT STATUSSee also:Structure definition of ChannelConfigNote:This function internally performs what is required to get the channel operational such asresetting and enabling the MPSSE.Product PageDocument Feedback6Copyright Future Technology Devices International Limited

Application NoteAN 177 User Guide For libMPSSE – I2CVersion 1.5Document Reference No.: FT 000466Clearance No.: FTDI#2103.1.5 I2C CloseChannelFT STATUS I2C CloseChannel (FT HANDLE handle)Closes a channel and frees all resources that were used by itParameters:inoutHandleNoneHandle of the channelReturns:Returns status code of type FT STATUS3.1.6 I2C DeviceReadFT STATUS I2C DeviceRead(FT HANDLE handle, uint32 deviceAddress, uint32 sizeToTransfer,uint8 *buffer, uint32 *sizeTransferred, uint32 options).This function reads the specified number of bytes from an addressed I2C SizeToTransferBufferSizeTransferredoptionsProduct PageDocument FeedbackHandle of the channelAddress of the I2C slave. This is a 7bit value and it should notcontain the data direction bit, i.e. the decimal value passedshould be always less than 128Number of bytes to be readPointer to the buffer where data is to be readPointer to variable containing the number of bytes readThis parameter specifies data transfer options. The bit positionsdefined for each of these options are:BIT0: if set then a start condition is generated in the I2C busbefore the transfer begins. A bit mask is defined for this optionsin file ftdi i2c.h as I2C TRANSFER OPTIONS START BITBIT1: if set then a stop condition is generated in the I2C busafter the transfer ends. A bit mask is defined for this options infile ftdi i2c.h as I2C TRANSFER OPTIONS STOP BITBIT2: reserved (only used in I2C DeviceWrite)BIT3: some I2C slaves require the I2C master to generate aNAK for the last data byte read. Setting this bit enables workingwith such I2C slaves. The bit mask defined for this bit isI2C TRANSFER OPTIONS NACK LAST BYTEBIT4: setting this bit will invoke a multi byte I2C transferwithout having delays between the START, ADDRESS, DATA andSTOP phases. Size of the transfer in parameters sizeToTransferand sizeTransferred are in bytes. The bit mask defined for thisbit is I2C TRANSFER OPTIONS FAST TRANSFER BYTES*BIT5: setting this bit would invoke a multi bit transfer withouthaving delays between the START, ADDRESS, DATA and STOPphases. Size of the transfer in parameters sizeToTransfer andsizeTransferred are in bytes. The bit mask defined for this bit isI2C TRANSFER OPTIONS FAST TRANSFER BITS*BIT6: the deviceAddress parameter is ignored if this bit is set.This feature may be useful in generating a special I2C busconditions that do not require any address to be passed. Settingthis bit is effective only when either7Copyright Future Technology Devices International Limited

Application NoteAN 177 User Guide For libMPSSE – I2CVersion 1.5Document Reference No.: FT 000466Clearance No.: FTDI#210I2C TRANSFER OPTIONS FAST TRANSFER BYTES orI2C TRANSFER OPTIONS FAST TRANSFER BITS is set. The bitmask defined for this bit isI2C TRANSFER OPTIONS NO ADDRESS*BIT7 – BIT31: reserved*The I2C DeviceRead and I2C DeviceWrite functions send commands to the MPSSE, reads theresponse and based on the response sends further commands. Delays between START,ADDRESS, DATA and STOP conditions are seen on the I2C bus as a result of waiting forcommand responses, and also because these commands are sent over different USB transfers.I2C TRANSFER OPTIONS FAST TRANSFER BYTES is introduced to minimize these delays bysending multiple MPSSE commands and I2C data over fewer (or possibly just one) USBtransfers, without waiting for I2C ack bits to be read into the PC/host. Also, sometimes someI2C devices may require a special non-I2C frame to be sent to it over the I2C bus which mayhave not have an address phase and may have either more or less than 8 bits in the frame.I2C TRANSFER OPTIONS FAST TRANSFER BITS & I2C TRANSFER OPTIONS NO ADDRESSoptions are introduced to address such needs. For example, some I2C EEPROM chips need a9bit frame without address to be sent to it to perform a software reset. These bits may be setto implement such features.I2C TRANSFER OPTIONS START BIT and I2C TRANSFER OPTIONS STOP BIT have theirusual meanings when used with I2C TRANSFER OPTIONS FAST TRANSFER BYTES orI2C TRANSFER OPTIONS FAST TRANSFER BITS, howeverI2C TRANSFER OPTIONS BREAK ON NACK and I2C TRANSFER OPTIONS NACK LAST BYTEare not meant to be used with them.Returns:Returns status code of type FT STATUSFollowing are the special meanings of the FT STATUS code when returned from thisfunction:Return code FT DEVICE NOT FOUND would mean that the I2C slave didn’t respond whenit was addressed and so the function returned before even beginning any data transfer.Typically this would mean that the address passed to the function was incorrect, or theaddress of the I2C slave has been configured incorrectly (i.e. if the slave allows it), or theI2C master and the I2C slave isn’t connected properly.Return code FT INVALID PARAMETER would mean that the deviceAddress that is greaterthan 127.Return code FT IO ERROR would mean that the transfer failed while actually transferringdataNote:This function internally performs the following operations: Write START bit (if BIT0 of options flag is set)Write device addressGet ACK from deviceLOOP until sizeToTransfero Read byte to buffero Give ACKWrite STOP bit(if BIT1 of options flag is set)Product PageDocument Feedback8Copyright Future Technology Devices International Limited

Application NoteAN 177 User Guide For libMPSSE – I2CVersion 1.5Document Reference No.: FT 000466Clearance No.: FTDI#210Warning:This is a blocking function and will not return until either the specified amount of data is reador an error is encountered.3.1.7 I2C DeviceWriteFT STATUS I2C DeviceWrite (FT HANDLE handle, uint32 deviceAddress, uint32 sizeToTransfer,uint8 *buffer, uint32 *sizeTransferred, uint32 options)This function writes the specified number of bytes to an addressed I2C Handle of the channelAddress of the I2C slave. This is a 7bit value and it should notcontain the data direction bit, i.e. the decimal value passedshould be always less than 128Number of bytes to be writtenPointer to the buffer from where data is to be writtenPointer to variable containing the number of bytes writtenThis parameter specifies data transfer options. The bit positionsdefined for each of these options are:BIT0: if set then a start condition is generated in the I2C busbefore the transfer begins. A bit mask is defined for this optionsin file ftdi i2c.h as I2C TRANSFER OPTIONS START BITBIT1: if set then a stop condition is generated in the I2C busafter the transfer ends. A bit mask is defined for this options infile ftdi i2c.h as I2C TRANSFER OPTIONS STOP BITBIT2: if set then the function will return when a device nAcksafter a byte has been transferred. If not set then the functionwill continue transferring the stream of bytes even if the devicenAcks. A bit mask is defined for this options in file ftdi i2c.h asI2C TRANSFER OPTIONS BREAK ON NACKBIT3: reserved (only used in I2C DeviceRead)BIT4: setting this bit will invoke a multi byte I2C transferwithout having delays between the START, ADDRESS, DATA andSTOP phases. Size of the transfer in parameters sizeToTransferand sizeTransferred are in bytes. The bit mask defined for thisbit is I2C TRANSFER OPTIONS FAST TRANSFER BYTES*BIT5: setting this bit would invoke a multi bit transfer withouthaving delays between the START, ADDRESS, DATA and STOPphases. Size of the transfer in parameters sizeToTransfer andsizeTransferred are in bytes. The bit mask defined for this bit isI2C TRANSFER OPTIONS FAST TRANSFER BITS*BIT6: the deviceAddress parameter is ignored if this bit is set.This feature may be useful in generating a special I2C busconditions that do not require any address to be passed. Settingthis bit is effective only when eitherI2C TRANSFER OPTIONS FAST TRANSFER BYTES orI2C TRANSFER OPTIONS FAST TRANSFER BITS is set. The bitmask defined for this bit isI2C TRANSFER OPTIONS NO ADDRESS*BIT7 – BIT31: reserved*The I2C DeviceRead and I2C DeviceWrite functions send commands to the MPSSE, reads theresponse and based on the response sends further commands. Delays between START,ADDRESS, DATA and STOP conditions are seen on the I2C bus as a result of waiting forProduct PageDocument Feedback9Copyright Future Technology Devices International Limited

Application NoteAN 177 User Guide For libMPSSE – I2CVersion 1.5Document Reference No.: FT 000466Clearance No.: FTDI#210command responses, and also because these commands are sent over different USB transfers.I2C TRANSFER OPTIONS FAST TRANSFER BYTES is introduced to minimize these delays bysending multiple MPSSE commands and I2C data over fewer (or possibly just one) USBtransfers, without waiting for I2C ack bits to be read into the PC/host. Also, sometimes someI2C devices may require a special non-I2C frame to be sent to it over the I2C bus which mayhave not have an address phase and may have either more or less than 8 bits in the frame.I2C TRANSFER OPTIONS FAST TRANSFER BITS & I2C TRANSFER OPTIONS NO ADDRESSoptions are introduced to address such needs. For example, some I2C EEPROM chips need a9bit frame without address to be sent to it to perform a software reset. These bits may be setto implement such features.I2C TRANSFER OPTIONS START BIT and I2C TRANSFER OPTIONS STOP BIT have theirusual meanings when used with I2C TRANSFER OPTIONS FAST TRANSFER BYTES orI2C TRANSFER OPTIONS FAST TRANSFER BITS,howeverI2C TRANSFER OPTIONS BREAK ON NACK & I2C TRANSFER OPTIONS NACK LAST BYTEare not meant to be used with them.Returns:Returns status code of type FT STATUSFollowing are the special meanings of the FT STATUS code returned in the context of I2C:Return code FT DEVICE NOT FOUND would mean that the I2C slave didn’t respond whenit was addressed and so the function returned before beginning data transfer. Typically thiswould mean that the address passed to the function was incorrect, or the device of the I2Cslave has been configured incorrectly (i.e. if the slave allows it), or the I2C master and theI2C slave isn’t connected properly.Return code FT INVALID PARAMETER would mean that the deviceAddress that is greaterthan 127.Return code FT IO ERROR would mean that the transfer failed while transferring dataReturn code FT FAILED TO WRITE DEVICE would either mean that the I2C slave NAKedNote:This function internally performs the following operations: Write START bit (if BIT0 of options flag is set)Write device addressGet ACKLOOP until sizeToTransfer (or until device NAK, if BIT2 in options is set)o Write byte from buffero Get ACKWrite STOP bit(if BIT1 of options flag is set)Warning:This is a blocking function and will not return until either the specified amount of data isread or an error is encountered.Product PageDocument Feedback10Copyright Future Technology Devices International Limited

Application NoteAN 177 User Guide For libMPSSE – I2CVersion 1.5Document Reference No.: FT 000466Clearance No.: FTDI#2103.2 GPIO functionsEach MPSSE channel in the FTDI chips are provided with a general purpose I/O port having 8 linesin addition to the port that is used for synchronous serial communication. For example, theFT223H has only one MPSSE channel with two 8-bit busses, ADBUS and ACBUS. Out of these,ADBUS is used for synchronous serial communications (I2C/SPI/JTAG) and ACBUS is free to beused as GPIO. The two functions described below have been provided to access these GPIO lines(also called the higher byte lines of MPSSE) that are available in various FTDI chips with MPSSEs.3.2.1 FT WriteGPIOFT STATUS FT WriteGPIO(FT HANDLE handle, uint8 dir, uint8 value)This function writes to the 8 GPIO lines associated with the high byte of the MPSSE channelParameters:InInhandledirInvalueHandle of the channelEach bit of this byte represents the direction of the 8respective GPIO lines. 0 for in and 1 for outIf the direction of a GPIO line is set to output, then eachbit of this byte represent the output logic state of the 8respective GPIO lines. 0 for logic low and 1 for logic highReturns:Returns status code of type FT STATUS3.2.2 FT ReadGPIOFT STATUS FT ReadGPIO(FT HANDLE handle,uint8 *value)This function reads from the 8 GPIO lines associated with the high byte of the MPSSE channelParameters:InoutHandle*valueHandle of the channelIf the direction of a GPIO line is set to input, then each bitof this byte represent the input logic state of the 8respective GPIO lines. 0 for logic low and 1 for logic highReturns:Returns status code of type FT STATUSNote:The direction of the GPIO line must first be set using FT WriteGPIO function before thisfunction is used.3.3 Library Infrastructure FunctionsProduct PageDocument Feedback11Copyright Future Technology Devices International Limited

Application NoteAN 177 User Guide For libMPSSE – I2CVersion 1.5Document Reference No.: FT 000466Clearance No.: FTDI#210The two functions described in this section typically do not need to be called from the userapplications as they are automatically called during entry/exit time. However, these functions arenot called automatically when linking the library statically using Microsoft Visual C . It is thenthat they need to be called explicitly from the user applications. The static linking sample providedwith this manual uses a macro which checks if the code is compiled using Microsoft toolchain, if sothen it automatically calls these functions.3.3.1 Init libMPSSEvoid Init libMPSSE(void)Initializes the libraryParameters:InoutNoneNoneReturns:void3.3.2 Cleanup libMPSSEvoid Cleanup libMPSSE(void)Cleans up resources used by the libraryParameters:inoutnonenoneReturns:void3.4 Data types3.4.1 ChannelConfigChannelConfig is a structure that holds the parameters used for initializing a channel. Thefollowing are members of the structure: I2C CLOCKRATE ClockRateValid range for clock divisor is from 0 to 3400000The user can pass either I2C CLOCK STANDARD MODE, I2C CLOCK FAST MODE,I2C CLOCK FAST MODE PLUS or I2C CLOCK HIGH SPEED MODE for the standard clockrates; alternatively a value for a non-standard clock rate may be passed directly.Product PageDocument Feedback12Copyright Future Technology Devices International Limited

Application NoteAN 177 User Guide For libMPSSE – I2CVersion 1.5Document Reference No.: FT 000466 Clearance No.: FTDI#210uint8 LatencyTimerRequired value, in milliseconds, of latency timer. Valid range is 0 – 255. However, FTDIrecommend the following ranges of values for the latency timer:Full speed devices (FT2232D)Hi-speed devices (FT232H, FT2232H, FT4232H)Range 2 – 255Range 1 - 255 uint32 Options Bits of this member are used in the way described below:BitnumberBIT0BIT1BIT2 –BIT31DescriptionValueMeaning of valueThese bitspecify if 3phaseclocking isenabled ordisabledSetting this bitwill enableDrive-OnlyZero ocking isdisabled*101Drive-Only-Zerodisabled**Enable Drive-OnlyZero**Defined macro(if any)I2C DISABLE 3PHASE CLOCKINGI2C ENABLE DRIVE ONLY ZERO*Please note that 3-phase-clocking is available only on the hi-speed devices and not on theFT2232D.**Enabling Drive-Only-Zero ensures that the SDA line is driven by the I2C master only when itis supposed to be driven LOW, and tristate it when it is supposed to be driven HIGH. Thisfeature is available only in FT232H chip. Trying to enable this feature using function I2C Initwill have no effect on chips other than FT232H.3.4.2 I2C CLOCKRATEI2C CLOCKRATE is an enumerated data type that is defined as follows – enum I2C ClockRate t { I2C CLOCK STANDARD MODE 100000,I2C CLOCK FAST MODE 400000,I2C CLOCK FAST MODE PLUS 1000000,I2C CLOCK HIGH SPEED MODE 3400000 }3.4.3 TypedefsFollowing are the typedefs that have been defined keeping cross platform portability in view: nsigned char uint8unsigned short uint16unsigned long uint32signed char int8signed short int16signed long int32unsigned char boolProduct PageDocument Feedback13Copyright Future Technology Devices International Limited

Application NoteAN 177 User Guide For libMPSSE – I2CVersion 1.5Document Reference No.: FT 000466Clearance No.: FTDI#2104 Example CircuitThis example demonstrates how to connect a MPSSE chip (FT2232H) to an I2C device (24LC024H– EEPROM) and how to program it using libMPSSE-I2C library.Figure 3 - Schematic for connecting FT2232H to I2C EEPROM device (24LC024H)The above schematic shows how to connect a FT2232H chip to an I2C EEPROM. Please note thatthe FT2232 chip is also available as a module which contains all the components shown in theabove schematic (except the 24LC024H and its address line pull-up resistors). This module iscalled FT2232H Mini Module and details about it can be found in the device datasheet. TheFT2232H chip acts as the I2C master here and is connected to a PC using USB interface. For theexample we connected lines A0, A1 and A2 of 24LC024H chip to logic HIGH (using the 10K pull-upresistors), this gave the chip an I2C device address of 0x57.Product PageDocument Feedback14Copyright Future Technology Devices International Limited

Application NoteAN 177 User Guide For libMPSSE – I2CVersion 1.5Document Reference No.: FT 000466Clearance No.: FTDI#2105 Example ProgramThe required D2XX driver should be installed into the system depending on the OS that is alreadyinstalled in the PC/host. If a Linux PC is used then the default drivers usbserial and ftdi sio mustbe removed (using rmmod command).Once the hardware shown above is connected to a PC and the drivers are installed, the user canplace the following code (sample-win32-static.c), D2XX.h, libMPSSE i2c.h and libMPSSE.a into onefolder, compile the sample and run it./*!* \file sample-static.c** \author FTDI* \date 20131002** Copyright 2013 Future Technology Devices International Limited* Company Confidential** Project: libMPSSE* Module: I2C Sample Application - Interfacing 24LC024H I2C EEPROM** Rivision History:* 0.1 - 20110513 - initial version* 0.2 - 20110801 - Changed LatencyTimer to 255*Attempt to open channel only if available*Added & modified macros*Change I2C GetChannelInfo & OpenChannel to start indexing from 0* 0.3 - 20111212 - Added ***************************************//*Include ************************************//* Standard C libraries */#include stdio.h #include stdlib.h /* OS specific libraries */#ifdef WIN32#include windows.h #endif/* Include D2XX header*/#include "ftd2xx.h"/* Include libMPSSE header */#include "libMPSSE ***********************************//*Macro and type **************************************//* Helper macros */#define APP CHECK STATUS(exp) {if(exp! FT OK){printf("%s:%d:%s(): status(0x%x) \! FT OK\n", FILE , LINE , FUNCTION ,exp);exit(1);}else{;}};#define CHECK NULL(exp){if(exp NULL){printf("%s:%d:%s(): NULL expression \encountered \n", FILE , LINE , FUNCTION );exit(1);}else{;}};/* Application specific macro definitions */#define I2C DEVICE ADDRESS EEPROM#define I2C DEVICE BUFFER SIZE#define I2C WRITE COMPLETION RETRY#define START ADDRESS EEPROMProduct PageDocument Feedback0x57256100x00 /*read/write start address inside the EEPROM*/15Copyright Future Technology Devices International Limited

Application NoteAN 177 User Guide For libMPSSE – I2CVersion 1.5Document Reference No.: FT 000466#define END ADDRESS EEPROM0x10#define RETRY COUNT EEPROM#define CHANNEL TO OPEN#define DATA OFFSET10Clearance No.

in file ftdi_i2c.h as I2C_TRANSFER_OPTIONS_START_BIT BIT1: if set then a stop condition is generated in the I2C bus after the transfer ends. A bit mask is defined for this options in file ftdi_i2c.h as I2C _TRANSFER_OPTIONS_STOP_BIT BIT2: reserved (only used in I2C_DeviceWrite) B

Related Documents:

User Guide For libMPSSE - SPI Document Reference No.: FT_00492 Version 1.1 Issue Date: 2012-02-13 This application note is a guide to using the libMPSSE-SPI - a library which simplifies the design of firmware for interfacing to the FTDI MPSSE configured as an SPI interface. The library is available for Windows and for Linux.

I2C requires a mere two wires, like asynchronous serial, but those two wires can support up to 1008 peripheral devices.Also, unlike SPI, 2IC can support a multi-controller system, allowing more than one controller [1] to communicate with all peripheral [1] devices on the bus (although the controller devices can't talk to each other over the bus and must take turns using the bus lines).File Size: 356KBPage Count: 12Explore furtherBasics of I2C: The I2C Protocol - TI Trainingtraining.ti.comUnderstanding the I2C Bus - Texas Instrumentswww.ti.comWhat is I2C? Protocol Guide Microcontroller Tutorialswww.teachmemicro.comInter-Integrated Circuit (I2C)www.egr.msu.eduRS-232 INTERFACE - TSCMwww.tscm.comRecommended to you b

I2C Tutorial In this tutorial we will go through I2C Bus & Protocol. I2C was originally invented by Philips(now NXP) in 1982 as bi-directional bus to communicate with multiple devices using just 2 wires/lines. I2C stands for Inter-Integrated Circuit. I2C is sometimes also referred as TWI, which is short for Two Wire Interface, since

Bruksanvisning för bilstereo . Bruksanvisning for bilstereo . Instrukcja obsługi samochodowego odtwarzacza stereo . Operating Instructions for Car Stereo . 610-104 . SV . Bruksanvisning i original

1. General description The PCA9509 is a level translating I2C-bus/SMBus repeater that enables processor low voltage 2-wire serial bus to interface with standard I2C-bus or SMBus I/O.While retaining all the operating modes and features of the I2C-bus system during the level shifts, it also permits extension of the I2C-bus by providing bidirectional buffering for both the dataFile Size: 301KB

Dec 14, 2020 · hardware I2C buses with different clock and data line names. Once you have access to the I2C bus it’s easy to scan the bus to find the address of all devices connected to it. Call the busio.I2C.scan() (https://adafru.it/zcm) function. However before you make calls against the I2C bu

by 4). I2C Multiplexed-Side pins: SDx and SCx: There are 8 sets of SDx and SCx pins, from SD0/SC0 to SD7/SC7. These are the multiplexed pins. Each one is a completely seperate I2C bus set. So you have have 8 I2C devices with identical addresses, as long as they are on one I2C bus each.

upon the most current revision of ASTM D-2996 (Standard Specification for Filament Wound Rein-forced Thermosetting Resin Pipe): Ratio of the axial strain to the hoop strain. Usually reported as 0.30 for laminates under discussion. 0.055 lb/in3, or 1.5 gm/cm3. 1.5 150-160 (Hazen-Williams) 1.7 x 10-5 ft (Darcy-Weisbach/Moody) 1.0 - 1.5 BTU/(ft2)(hr)( F)/inch for polyester / vinyl ester pipe .