pyftdi icon indicating copy to clipboard operation
pyftdi copied to clipboard

When using FT4232H with Texas Instruments "LM2571EVM Board " unable to read back

Open gaur20 opened this issue 5 months ago • 8 comments

Hi,

I am using PyFtdi.

I am trying to write and read back data. But unable to read anything on the CS pin.

This is what I get: "d:/FTDI/ftdi_initial phase.py" Available interfaces: ftdi://ftdi:4232:SPITEST/1 (SPITEST) ftdi://ftdi:4232:SPITEST/2 (SPITEST) ftdi://ftdi:4232:SPITEST/3 (SPITEST) ftdi://ftdi:4232:SPITEST/4 (SPITEST)

Connected to Device :):):):) b'\x01\x02\x03\x04\x05\x06' bytearray(b'\x00\x00') (base) PS D:\FTDI>

Can you please suggest a specific configuration I need to do ?

Kind Regards, Gauri

gaur20 avatar Jul 01 '25 16:07 gaur20

Hi,

I do not know what a "LM2571EVM" board is (and failed to get any valid result from Google) Moreover, you do not provide any source code, so I have no idea what your script is executing...

ps: please use markdown formatting, especially code code block and console text.

eblot avatar Jul 01 '25 16:07 eblot

Hi, LMX2571 Low-Power, High-Performance PLLatinum™ RF Synthesizer with FSK Modulation using with FT4232H.

I am attempting to interpret this:

# Instantiate a SPI controller
# We want to use A*BUS4 for /CS, so at least 2 /CS lines should be
# reserved for SPI, the remaining IO are available as GPIOs.

spi = SpiController(cs_count=2)

# Configure the first interface (IF/1) of the FTDI device as a SPI master
spi.configure('ftdi://ftdi:2232h/1')

# Get a port to a SPI slave w/ /CS on A*BUS4 and SPI mode 2 @ 10MHz
slave = spi.get_port(cs=1, freq=100e3, mode=2)

# Synchronous exchange with the remote SPI slave
write_buf = b'\x01\x02\x03\x04,\x05
read_buf = slave.exchange(write_buf, duplex=True)

I am unable to read back .

Attached is the output from my code:
"d:/FTDI/ftdi_initial phase.py"
Connected to Device :):):):)
b'\x01\x02\x03\x04\x05\x06'
bytearray(b'\x00\x00')

gaur20 avatar Jul 01 '25 16:07 gaur20

Fixing Markdown syntax

eblot avatar Jul 01 '25 17:07 eblot

I do not really understand:

  1. The relationship with the code and the output. It seems the output comes from another message that I received by email but does not appear on this issue for some reason and malformed as it seems to contain both raw code with lost Python indentation making it quite hard to interpret with mixed RST titles (?). I do not understand why you open a serial port then a SPI comm on the same FT4232H device port for example

  2. How the LMX2571 is connected to the first FT4232H port

  3. From the LMX2571 datasheet, this device is a register-based one, so you need to write to a specific register to read back data from it, dealing with the padding (see 7.3.15 in the datasheet). IOW, I do not understand why you write b'\x01\x02\x03\x04\x05\x06' to it

eblot avatar Jul 02 '25 08:07 eblot

Hi, You're absolutely right to question the relationship between the SPI code and the LMX2571 output. The current issue I’m facing is that LE (Latch Enable), which is acting as Chip Select (CS) for the LMX2571, is not being toggled as expected when using SpiController(cs=1) from PyFTDI. According to the connection:

LE of LMX2571 is tied to ADBUS3, which should correspond to cs=1 in PyFTDI.

However, scope traces show that ADBUS3 (LE) remains static, even though slave.write(..., start=True, stop=True) is used, indicating CS is not toggling.

This is why the register command isn't getting latched correctly into the LMX2571, which explains why the readback is not working as expected.

Image

gaur20 avatar Jul 02 '25 10:07 gaur20

LE of LMX2571 is tied to ADBUS3, which should correspond to cs=1 in PyFTDI.

ADBUS3 is cs0

eblot avatar Jul 02 '25 13:07 eblot

Thanks Resolved :)

gaur20 avatar Jul 17 '25 13:07 gaur20

This issue can be closed.

mcuee avatar Sep 29 '25 08:09 mcuee