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: Zeros in output from FT220X (C#)  (Read 15676 times)

9ghtX

  • Newbie
  • *
  • Posts: 6
    • View Profile
Zeros in output from FT220X (C#)
« on: December 03, 2020, 05:22:23 AM »

 I tried to get data from my FT220X using ftDevice.Read() and ftDevice.Purge(ref readData), but there is only zeros in data. I checked hardware signals and there is everything OK.
 So, the question. May be there problem in code (I've attached it to this topic) that causes this problem?

Hardware specifics:
 Clock: 40 Mhz
 Receiving package has 4 bytes
 Connected 2 devices FT234XD via 485 (using Serial.IO C# lib) and FT220X via SPI (using FTD2XX.dll).
« Last Edit: December 07, 2020, 04:32:22 AM by 9ghtX »
Logged

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 891
    • View Profile
Re: Zeros in output from FT220X (C#)
« Reply #1 on: December 04, 2020, 04:32:39 PM »

Hello,

Please refer to the FT220X Product Page:

https://www.ftdichip.com/Products/ICs/FT220X.html

Please note that this is not an SPI master.

FT220X implements FT1248 which is a proprietary FTDI interface that allows for a synchronous parallel/ serial interface where the data bus may be 1, 2, 4 or 8 bit wide.
This is not a standard SPI slave.

Data transfer rates up to 1MByte/s.

These app notes should help you:

AN_206 FT1248-1 Bit SPI
AN_167 FT1248 Dynamic Parallel/Serial Interface Basics
AN_173 Establishing FT1248 Communications using a Morph-IC-II

Have you considered our latest SPI slave product the FT4222H?
Do you require an SPI master or slave?

Best Regards,
FTDI Community
Logged

9ghtX

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Zeros in output from FT220X (C#)
« Reply #2 on: December 07, 2020, 05:18:08 AM »

Recently I tried to write program on C++, guided by your instructions on official cite. So, after completing writing I got on RxBytesBuffer strange data package. I get, for example, 0x00AFF738 and this bytes always change in ever iteration of using program.

Also I notice that this values have difference in 12. If I printf() them in %lu, I get RxBytes: 0x6421720, TxBytes: 0x6421732 and RxBuffer: 0x6421444. Is this kinda encrypting? And if this packages always change and they are encrypted, how I can uncrypt them?

In my device this chip in Slave mode. I need get 5 bytes, that contains answers from my SPI-Master device. And after getting command I need to write an answer to Master and continue communicate with it at same time with 485 port (but with communicating with 2 devices I have no problem).
« Last Edit: December 07, 2020, 07:46:23 AM by 9ghtX »
Logged

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 891
    • View Profile
Re: Zeros in output from FT220X (C#)
« Reply #3 on: December 07, 2020, 02:03:39 PM »

Hello

Thank you for your update.
There is no encryption used on the FT220X, what API call are you using when the following happens:
 
Also I notice that this values have difference in 12. If I printf() them in %lu, I get RxBytes: 0x6421720, TxBytes: 0x6421732 and RxBuffer: 0x6421444. Is this kinda encrypting? And if this packages always change and they are encrypted, how I can uncrypt them?

Can I see this code snippet?

Best Regards,
FTDI Community
Logged

9ghtX

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Zeros in output from FT220X (C#)
« Reply #4 on: December 08, 2020, 03:39:53 AM »

I found a problem about this random numbers.

After solving all problems with reading, now I get zeros as via C# lib. I write all readed data in byte array and write in console every byte from it. And all bytes in array are zeros. As you can see at screenshot, there is bytes in RxBytes (that displays allowed to read bytes in buffer). There is 4 of them, readed data bytes have only 0 value.
« Last Edit: December 08, 2020, 09:19:07 AM by 9ghtX »
Logged

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 891
    • View Profile
Re: Zeros in output from FT220X (C#)
« Reply #5 on: December 08, 2020, 05:16:20 PM »

Hello,

Thanks for your code, I cannot see any glaring issues with it immediately.

However I did notice you are trying to print the 'RxBuffer' data as a unsigned long:
Code: [Select]
printf("Data Recieved: 0x%lu\n", RxBuffer[i]);
But RxBuffer is defined as a char array.

Could you also double check the data being received by the FT220? I.e what is the expected 4 bytes?

Best Regards,
FTDI Community
Logged

9ghtX

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Zeros in output from FT220X (C#)
« Reply #6 on: December 09, 2020, 05:14:47 AM »

 I tried to define RxBuffer differently: integer, char, DWORD just for experiment. That doesn't change nothing

 As I checked, there must be at least one 4 (or 5, that's another question, why I get 4 bytes instead 5, when timings are Ok) bytes package {0x9E, 0x00, 0x00, 0x00, 0x03}.

 Another question. There is MIOSIs in FT1248 controller. The 0s' one is only for OUTPUT or for both of them?

« Last Edit: December 09, 2020, 09:59:27 AM by 9ghtX »
Logged

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 891
    • View Profile
Re: Zeros in output from FT220X (C#)
« Reply #7 on: December 09, 2020, 05:40:33 PM »

Hello,

It was more in relation to the prinft statement using the unsigned long identifier, and not how the rxBuffer is defined.

Can you take a logic capture of the device receiving this data?

MIOSIO[0] is the bi-directional data line, which the master must read or write to.

Best Regards,
FTDI Community
Logged

9ghtX

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Zeros in output from FT220X (C#)
« Reply #8 on: December 10, 2020, 04:11:46 AM »

 I found out that I needed to write in FT220X 0x00 bit first to initialize Master Write Slave Read mode.
"Write 0x00 Write request command" - From FT220X Datasheet

 Do I need to write to FT220X in my program first bit 0x01 to init Master Read Slave Write mode? Or it does this bt itself and I don't need to write anything?
"Read 0x01 Read request command" - From FT220X Datasheet

 Or for easily for me to understand you could write little example, how to Write via FT220X correctly.

 Here is my thoughts:
If I want to read message from Master, I need to send to my FT220X 0x00 in first bit of my byte data.
If I want to write data from my FT220X to Master, what should I do? Write first bit 0x01? Or it happens automatically? Does it add first bit 0x01-write-command and will my Master see this bit?
So many questions..)
« Last Edit: December 10, 2020, 07:25:39 AM by 9ghtX »
Logged

anoopkyadav

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Zeros in output from FT220X (C#)
« Reply #9 on: March 02, 2022, 02:30:25 PM »

Sir / Madam ,

Has anybody found the solution for ZERO's Received .

I am using UMFT221XE-01 module for Receiving SPI Data from my custom board(Master).
I have made a GUI in C# to receive the SPI data from my Custom Board(Master).

When I am reading the SPI data in the Rx Buffer It's Showing 0000 (All Zeros) , Even Though the available bytes to read are showing Non Zeros .

Pls suggest how to read data in SPI Slave mode.

Pls share a sample code if available

Logged