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 BitWizard breakout and Python  (Read 168 times)

gmetaxas

  • Newbie
  • *
  • Posts: 3
    • View Profile
FT4222H BitWizard breakout and Python
« on: November 02, 2022, 10:15:26 AM »

I recently purchased a FT4222H breakout board from BitWizard.nl to evaluate the FT4222H IC. My intention is to use that IC in a design and control it using Python.
Configuration for FT4222H: DCNF0=DNCF1=0, VCCIO=3.3 V
Python library that I use to talk to the IC: https://msrelectronics.gitlab.io/python-ft4222/api.html
I hooked up a 'scope to the four SPI lines and put up a "hello, world" style of Python program that continuously sends a byte over SPI. Please find attached a snapshot from the 'scope's screen, as well as my Python code.
It turns out that the signal on the SS0O pin has the wrong polarity: it should be low when SCK is active and high elsewhere.
What should I do to get this right? Should I pull up that pin, or is there any software setting that has been overlooked? Please advise.
Logged

gmetaxas

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: FT4222H BitWizard breakout and Python
« Reply #1 on: November 04, 2022, 09:38:45 AM »

Well, I checked the hardware and found nothing wrong with it. However, after carefully examining the Python code I noticed the following:
In the code I posted here, the call to the SPI initialization method is:
Code: [Select]
    dev.spiMaster_Init(ft4222.SPIMaster.Mode.SINGLE,
                       ft4222.SPIMaster.Clock.DIV_512,
                       ft4222.SPI.Cpol.IDLE_HIGH,
                       ft4222.SPI.Cpha.CLK_LEADING,
                       ft4222.SPIMaster.SlaveSelect.SS0)
and in the example that is listed in the library webpage, the SPI is initialized like this:
Code: [Select]
import ft4222
from ft4222.SPIMaster import Mode, Clock, SlaveSelect
from ft4222.SPI import Cpha, Cpol
...
# open 'device' with default description 'FT4222 A'
devA = ft4222.openByDescription('FT4222 A')
...
# init spi master
devA.spiMaster_Init(Mode.SINGLE,
                    Clock.DIV_128,
                    Cpol.IDLE_LOW,
                    Cpha.CLK_LEADING,
                    SlaveSelect.SS0)
Using the code in the PyPI.ft4222 library webpage, the signals on the SPI lines are correct. Refer to the attached screenshot from the 'scope.
Clock frequency is 465.65 kHz and clock divider is set to 128, therefore the system clock for the FT4222 IC runs at 60 MHz.
Therefore, I consider the problem to be solved and I would ask the moderator to move that post to the software section, as there is nothing special about hardware in this.
Logged