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: FT4222H Slave Losing bytes  (Read 2041 times)

Cactus

  • Newbie
  • *
  • Posts: 10
    • View Profile
FT4222H Slave Losing bytes
« on: February 20, 2018, 09:46:09 AM »

Hi I was wondering if anyone would be able to provide me with a reason the FT4222h is losing bytes.
I am currently using the FT4222h in slave mode, with a microprocessor as master.
The microprocessor sends parcels 6630 bytes every 4ms. Using a Labview program, I poll the "SPI Slave Get Rx Status" and read when there are incoming bytes.
Occasionally the FT4222h has missed bytes and the next parcel has "merged" with the previous parcel.
E.g if i am sending a parcel of 0-6629, one parcel may come up 0,1,2,...4560,4561,90,130,1,25,230,0,1,2,3,...
where 90,130,1,25,230, is the protocol for the packet.
This occurs very infrequently, however I am requiring a high fidelity system, so losing bytes is not ideal.
I have set the latency as 4ms and the Transfer size for USB IN request to 6656 bytes. Slave is set as SPI_SLAVE_WITH_PROTOCOL.
« Last Edit: February 20, 2018, 09:59:25 AM by Cactus »
Logged

FTDI Community

  • Administrator
  • Sr. Member
  • *****
  • Posts: 337
    • View Profile
Re: FT4222H Slave Losing bytes
« Reply #1 on: February 21, 2018, 10:52:16 AM »

Hello,

We recommend that you place a known starting byte at the beginning of each data packet.
There is no guarantee that your data packets will align correctly with USB packets, as the USB host is responsible for scheduling transfers. The best approach would be to try to achieve the greatest throughput possible and sort out the data once in Labview.

Best Regards,

FTDI Community
Logged

Cactus

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: FT4222H Slave Losing bytes
« Reply #2 on: February 22, 2018, 07:40:56 AM »

Thanks for the advice, I'll give it a shot.
I've had a read through "AN232B-03 Optimizing D2XX Data Throughput"  and there are a few things which I am still unsure about. Perhaps would you know?
  • According to AN232B-03 data is transferred across in packets of 64bytes, where two of these bytes are reserved for the FTDI and 62 bytes of actual data. Does this mean that I should make sure that all the data I send to the FT4222h is in multiples of 62 bytes? (e.g instead of sending 6630 I should send packets of 6634)
  • When I call the get max transfer size function in Lib4222, I get 1016. Is this the maximum size of data that can be sent to the FT4222h at once? Or should I send my data packets in multiples of this?
Logged

FTDI Community

  • Administrator
  • Sr. Member
  • *****
  • Posts: 337
    • View Profile
Re: FT4222H Slave Losing bytes
« Reply #3 on: February 22, 2018, 02:34:16 PM »

Hello,

Maintaining the data in packets as close to multiples of 62 may be beneficial, however the number of packets required to send 6630 bytes of data and 6634 bytes of data is the same at 107.

The FT4222_GetMaxTRansferSize function returns the maximum packet size in a transaction. Thus keeping your data packets within the value returned would ensure only one USB transaction is required to transfer the whole packet.

It may be worth experimenting with the your data packet size to establish what returns the best result.

Best Regards,

FTDI Community
Logged