FTDI Community

Please login or register.

Login with username, password and session length.
Advanced Search  

News:

Welcome to the FTDI Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ FTDI Support


New Bridgetek Community is now open

Please note that we have created the Bridgetek Community to discuss all Bridgetek products e.g. EVE, MCU.

Please follow this link and create a new user account to get started.

Bridgetek Community

Author Topic: FT232H 245 FIFO problems (edited)  (Read 11305 times)

G40

  • Newbie
  • *
  • Posts: 3
    • View Profile
FT232H 245 FIFO problems (edited)
« on: September 24, 2019, 02:04:14 PM »

Greetings. Am using an FTDI UM232H module to test FIFO modes. Application is a very simple bit of C++ code (x64/MSVC2019 Pro/Windows 10 Pro/D2XX v2.12.28 WHQL drivers).

The board has been programmed (via Prog) such that Port A Hardware is set to '245 FIFO'. It is not entirely clear that this requirement holds for the FT232H, though it is documented as such for the FT232H in the D2XX programmers reference.

Before any writes occur, FT_SetBitMode is called with FT_BITMODE_RESET, then

1. using FT_BITMODE_SYNC_FIFO the FT_Write call blocks after 2 writes
2. using FT_BITMODE_SYNC_BITBANG then FT_Write blocks after 2 writes
3. using FT_BITMODE_ASYNC_BITBANG then FT_Write succeeds and data appears as expected on the I/O pins, this runs to completion over ~512K loops

For cases 1 and 2, a software USB sniffer shows the 2 packets on the wire before the 3rd write blocks. The driver in this case is reading from the device and is getting a stream of 2 bytes (always 0x32,0x00) from the IN bulk endpoint.

What am I missing here? Can the synchronous modes be set up to loop-back? If so via which pins? The IO control pins are set as shown below but they always appear to be in tri-state (according to the 'scope)

I've looked at https://www.ftdichip.com/Support/Documents/AppNotes/AN_165_Establishing_Synchronous_245_FIFO_Communications_using_a_Morph-IC-II.pdf for some inspiration but none found.

TIA for any help.

    <IO_Controls>
      <C0>Tristate</C0>
      <C1>Tristate</C1>
      <C2>Tristate</C2>
      <C3>Tristate</C3>
      <C4>Tristate</C4>
      <C5>Tristate</C5>
      <C6>Tristate</C6>
      <C7>Tristate</C7>
      <C8>PWREN#</C8>
      <C9>TX&amp;RXLED#</C9>
    </IO_Controls>


Very slightly elided C++ code below.

try {
// read EEPROM to check settings.
char Manufacturer[32] = { 0 };
char ManufacturerId[16] = { 0 };
char Description[64] = { 0 };
char SerialNumber[16] = { 0 };
FT_PROGRAM_DATA program_data = { 0 };
program_data.Signature2 = 0xffffffff;
program_data.Version = 5;
program_data.Manufacturer = Manufacturer;
program_data.ManufacturerId = ManufacturerId;
program_data.Description = Description;
program_data.SerialNumber = SerialNumber;

// device_index obtained via FT_ListDevices.
ftStatus = FT_Open(device_index, &ftHandle);
if (ftStatus != FT_OK)
   throw "FT_Open";
ftStatus = FT_ResetDevice(ftHandle);
if (ftStatus != FT_OK)
   throw "FT_ResetDevice";
// returns 0xFF ??
ftStatus = FT_GetBitMode(ftHandle, &mode);
if (ftStatus != FT_OK)
   throw "FT_GetBitMode";
printf("FT_GetBitMode => 0x%x\n", mode);
// check EEPROM content.
ftStatus = FT_EE_Read(ftHandle, &program_data);
if (ftStatus != FT_OK)
   throw "FT_EE_Read";
// reset MPSSE
ftStatus = FT_SetBitMode(ftHandle, Mask, FT_BITMODE_RESET);
if (ftStatus != FT_OK)
   throw "FT_SetBitMode";
// configure FT2232H into Sync FIFO mode (FT_BITMODE_SYNC_FIFO).
// Prog applied CPU FIFO option
ftStatus = FT_SetBitMode(ftHandle, Mask, FT_BITMODE_SYNC_FIFO);
if (ftStatus != FT_OK)
   throw "FT_SetBitMode";
// returns 0xFF ??
ftStatus = FT_GetBitMode(ftHandle, &mode);
if (ftStatus != FT_OK)
   throw "FT_GetBitMode";
printf("FT_GetBitMode => 0x%x\n", mode);
// any more and FT_Write blocks hard.
loops = 2;
for (loop = 0; loop < loops; loop++)
{
   // write 16 byte toggling pattern to FT232H
   ftStatus = FT_Write(ftHandle, &data_buf, sizeof(data_buf), &data_written);
   if (ftStatus != FT_OK)
      throw "FT_Write";
   if ((loop % 16) == 0)
      printf("[%d]:%d\n", loop, data_written);
}
}
catch (...)      
« Last Edit: September 25, 2019, 01:23:14 PM by G40 »
Logged

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 896
    • View Profile
Re: FT232H 245 FIFO problems (edited)
« Reply #1 on: September 25, 2019, 03:51:10 PM »

Hello,

Please see the following App Note which should make things a bit clearer for you:

TN_167 FTDI FIFO Basics

It includes some simple software examples.

Best Regards,
FTDI Community
Logged