FTDI Community

General Category => Discussion - Software => Topic started by: TMa on August 16, 2022, 12:27:54 PM

Title: FT4222H non-byte sized data transfer?
Post by: TMa on August 16, 2022, 12:27:54 PM
Hi all,

I have a simple question regarding SPI slave operation of FT4222 chip. Is it possible to read non-byte sized data?
SPI master are sending 10-bit packet and libft4222 reporting that only one byte has been received (FT4222_SPISlave_GetRxStatus func). The last two bits are lost. Can I force on chip/driver to read next not-full byte?

thanks in advance
Title: Re: FT4222H non-byte sized data transfer?
Post by: FTDI Community on August 16, 2022, 04:32:46 PM
Hello,

All API functionality can be found in AN_329 User Guide for LibFT4222 (https://www.ftdichip.com/Support/Documents/AppNotes/AN_329_User_Guide_for_LibFT4222.pdf).

What happens if you just try to call another read without checking if there is any data available?

Best Regards,
FTDI Community
Title: Re: FT4222H non-byte sized data transfer?
Post by: TMa on August 17, 2022, 08:28:58 AM
After sending 10-bit packet I'm executing following scenarios:

Scenario 1
Actions                                        Result
FT4222_SPISlave_GetRxStatus      rxSize = 1
FT4222_SPISlave_Read 1 byte      First 8 data bit of packet
FT4222_SPISlave_GetRxStatus      rxSize = 0
FT4222_SPISlave_Read 0 byte       FT4222_INVALID_PARAMETER


Scenario 2
Actions                                        Result
FT4222_SPISlave_GetRxStatus      rxSize = 1
FT4222_SPISlave_Read 1 byte      First 8 data bit of packet
FT4222_SPISlave_Read 1 byte       FT4222_INVALID_PARAMETER


Scenario 3
Actions                                        Result
FT4222_SPISlave_GetRxStatus      rxSize = 1
FT4222_SPISlave_Read 2 byte      Waiting forever until 2nd byte will be received

I'm also checking if the last 2 bits are accumulated during multi-10bits transmission. E.g. 4 packets (10bit each) could be received as 5 full bytes (5 * 8bits), but unfortunately are not.


 
Title: Re: FT4222H non-byte sized data transfer?
Post by: FTDI Community on August 17, 2022, 04:43:53 PM
Hello,

Here is some feedback from our R&D team:

FT4222H SPI Slave can only receive bytes.
It cannot accept bit transmission.

The workaround might be for the SPI master to send additional dummy bits.

Best Regards,
FTDI Community
Title: Re: FT4222H non-byte sized data transfer?
Post by: TMa on August 19, 2022, 07:45:52 AM
Hi,

unfortunately I don't have possibility to change the number of bits sending by the SPI master.
I've figured out a workaround with tiny fpga board. It's waiting on the last pulse of SPI clock and adding extra six dummy pulses with the same properties as the previous ones.

Now everything works :) Thanks for support.

Best Regards