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: FT4222_SPIMaster_Init issue when using other ssoMap than 0x1  (Read 647 times)

LennonNM

  • Newbie
  • *
  • Posts: 5
    • View Profile
FT4222_SPIMaster_Init issue when using other ssoMap than 0x1
« on: February 09, 2021, 05:52:02 PM »

According to the documentation, if I understand correctly, these are the values I should send for slave selection SS0 -> 0b0001, SS1 -> 0b0010, SS2 -> 0b0100, SS3 -> 0b1000, but, only the option for SS0 is working, the others return an FT4222_INVALID_PARAMETER error, however, sending any combination with the lsb in 1 (0b0011, 0b0101, …) does not return any error, however, only SS0 works in those cases.
Following is my spiMaster_Init configuration:

ioLine : SPI_IO_SINGLE
clock_div : CLK_DIV_4
cpol : CLK_IDLE_LOW
cpha : CLK_LEADING
ssoMap : 2 (0b0010)

Can't see if I'm doing something wrong or what I'm missing.
Logged

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 612
    • View Profile
Re: FT4222_SPIMaster_Init issue when using other ssoMap than 0x1
« Reply #1 on: February 10, 2021, 02:42:30 PM »

Hello,

Thank you for your question, would it be possible to see the section of code you are using to configure the device?

Best Regards,
FTDI Community
Logged

LennonNM

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: FT4222_SPIMaster_Init issue when using other ssoMap than 0x1
« Reply #2 on: February 10, 2021, 04:52:03 PM »

Should have pointed out that I'm working in Python.
openStatus value returned is 0 (FT_OK)
initStatus value returned is 0 (FT_OK) when I send the value c_uint(1) for the ssoMap, it returns 6 (FT_INVALID_PARAMETER) when I send c_uint(2)

Here is the code:
    from ctypes import WinDLL, byref, c_void_p, c_uint
    ft4222lib = WinDLL('LibFT4222-64.dll')
    ftd2xxlib = WinDLL('ftd2xx.dll')
    ftHandler = c_void_p()
    openStatus = ftd2xxlib.FT_Open(c_uint(0), byref(ftHandler))
    initStatus = ft4222lib.FT4222_SPIMaster_Init(ftHandler, c_uint(1), c_uint(2), c_uint(0), c_uint(0), c_uint(2))

Logged

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 612
    • View Profile
Re: FT4222_SPIMaster_Init issue when using other ssoMap than 0x1
« Reply #3 on: February 11, 2021, 02:50:49 PM »

Hello,

Unfortunately we do not have much experience with Python here at FTDI.

However the ssoMap value is denoted as a uint8 in the LibFT4222 User guide, and I had a look at the python ctypes library, does changing this variable from a c_uint to a c_uint8 prevent the FT_INVALID_PARAMETER from returning?

Best Regards,
FTDI Community
Logged

LennonNM

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: FT4222_SPIMaster_Init issue when using other ssoMap than 0x1
« Reply #4 on: February 11, 2021, 05:48:14 PM »

Understood.
I tried that and the result was the same, c_uint8(1) works fine, but c_uint8(2) returns FT_INVALID_PARAMETER.
I tried using LibFT4222 versions 1.4.3 and 1.4.4, both with ftd2xx 2.12.28.1, and the behavior is the same. If I change ftd2xx what I get is a status error 1000 -> FT4222_DEVICE_NOT_SUPPORTED
Is there some device configuration I may be missing prior to masterInit? In summary, these are the steps I'm following
- CreateDeviceInfoList
    These are the devices listed from a single ftd chip
    {'index': 0, 'flags': 2, 'type': 10, 'id': 67330076, 'location': 135969, 'serial': b'A', 'description': b'FT4222 A', 'handle': 0}
    {'index': 1, 'flags': 2, 'type': 10, 'id': 67330076, 'location': 135970, 'serial': b'B', 'description': b'FT4222 B', 'handle': 0}
- Open device with index 0 -> STATUS_OK
- MasterInit with ssoMap c_uint/c_uint8 (2) -> FT_INVALID_PARAMETER

----- UPDATE --------------
After writing this message I understood the problem, I was using the FT in chip mode 0 (single slave), after adjusting the JP2 and JP3 pins (in the dev kit), I managed to change to chip mode 2, this allows 4 slaves and now there are no issues if correct ssoMap value is sent to the right usb interface device.
« Last Edit: February 12, 2021, 12:38:37 AM by LennonNM »
Logged

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 612
    • View Profile
Re: FT4222_SPIMaster_Init issue when using other ssoMap than 0x1
« Reply #5 on: February 12, 2021, 11:52:33 AM »

Hello,

Thank you for the update, I'm glad you managed to resolve the issue.
Please let us know if you run into any more issues.

Best Regards,
FTDI Community
Logged