Your browser does not allow scripts
Please click here to view a static table of contents without scripts
FT_EE_Program
Return to Introduction  Previous page  Next page
Program the EEPROM.

FT_STATUS
FT_EE_Program
(FT_HANDLE ftHandle, PFT_PROGRAM_DATA pData)




Parameters
ftHandle
Handle of the device.
pData
Pointer to structure of type FT_PROGRAM_DATA.




Return Value
FT_OK if successful, otherwise the return value is an FT error code.



Remarks
This function interprets the parameter pData as a pointer to a struct of type FT_PROGRAM_DATA that contains the data to write to the EEPROM. The data is written to EEPROM, then read back and verified.

If the SerialNumber field in FT_PROGRAM_DATA is NULL, or SerialNumber points to a NULL string, a serial number based on the ManufacturerId and the current date and time will be generated.

Note that the DLL must be informed which version of the
FT_PROGRAM_DATA structure is being used. This is done through the Signature1, Signature2 and Version elements of the structure. Signature1 should always be 0x00000000, Signature2 should always be 0xFFFFFFFF and Version can be set to use whichever version is required. For compatibility with all current devices Version should be set to the latest version of the FT_PROGRAM_DATA structure which is defined in FTD2XX.h.

If
pData is NULL, the structure version will default to 0 (original BM series) and the device will be programmed with the default data:
{0x0403, 0x6001, "FTDI", "FT", "USB HS Serial Converter", "", 44, 1, 0, 1, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 0}



Example

// Version 2 structure for programming a BM device.  
// Other elements would need non-zero values for FT2232C, FT232R or FT245R devices.

FT_PROGRAM_DATA ftData = {
   0x00000000,         // Header - must be 0x00000000 
   0xFFFFFFFF,         // Header - must be 0xffffffff
   0x00000002,         // Header - FT_PROGRAM_DATA version
   0x0403,            // VID
   0x6001,            // PID
   "FTDI",            // Manufacturer
   "FT",            // Manufacturer ID
   "USB HS Serial Converter",   // Description
   "FT000001",         // Serial Number
   44,            // MaxPower
   1,            // PnP
   0,            // SelfPowered
   1,            // RemoteWakeup
   1,            // non-zero if Rev4 chip, zero otherwise
   0,            // non-zero if in endpoint is isochronous
   0,            // non-zero if out endpoint is isochronous
   0,            // non-zero if pull down enabled
   1,            // non-zero if serial number to be used
   0,            // non-zero if chip uses USBVersion
   0x0110            // BCD (0x0200 => USB2)
   //
   // FT2232C extensions (Enabled if Version = 1 or Version = 2)
   //
   0,            // non-zero if Rev5 chip, zero otherwise
   0,            // non-zero if in endpoint is isochronous
   0,            // non-zero if in endpoint is isochronous
   0,            // non-zero if out endpoint is isochronous
   0,            // non-zero if out endpoint is isochronous
   0,            // non-zero if pull down enabled
   0,            // non-zero if serial number to be used
   0,            // non-zero if chip uses USBVersion
   0x0,            // BCD (0x0200 => USB2)
   0,            // non-zero if interface is high current
   0,            // non-zero if interface is high current
   0,            // non-zero if interface is 245 FIFO
   0,            // non-zero if interface is 245 FIFO CPU target
   0,            // non-zero if interface is Fast serial
   0,            // non-zero if interface is to use VCP drivers
   0,            // non-zero if interface is 245 FIFO
   0,            // non-zero if interface is 245 FIFO CPU target
   0,            // non-zero if interface is Fast serial
   0,            // non-zero if interface is to use VCP drivers
   //
   // FT232R extensions (Enabled if Version = 2)
   //
   0,            // Use External Oscillator
   0,            // High Drive I/Os
   0,            // Endpoint size
   0,            // non-zero if pull down enabled
   0,            // non-zero if serial number to be used
   0,            // non-zero if invert TXD
   0,            // non-zero if invert RXD
   0,            // non-zero if invert RTS
   0,            // non-zero if invert CTS
   0,            // non-zero if invert DTR
   0,            // non-zero if invert DSR
   0,            // non-zero if invert DCD
   0,            // non-zero if invert RI
   0,            // Cbus Mux control
   0,            // Cbus Mux control
   0,            // Cbus Mux control
   0,            // Cbus Mux control
   0,            // Cbus Mux control
   0            // non-zero if using D2XX drivers

};
FT_HANDLE ftHandle;

FT_STATUS ftStatus = FT_Open(0, &ftHandle);
if (ftStatus == FT_OK) {
    ftStatus = FT_EE_Program(ftHandle, &ftData);
    if (ftStatus == FT_OK) {
        // FT_EE_Program OK!
    }
    else {
        // FT_EE_Program FAILED! 
   }
}