Hi all,
I wrote a simple python code to interface the FT245R FTDI chip.
With this code I am able to establish an USB connection.
After that I tried to perform some read actions (ret, readData =
ftdi.read_data(ftdic, chunksize)) and for all of them referred to a
"small" amount of data, I received completely the expected data back.
This is not true when the expected data is around 819 Bytes, some data
are missing.
It seems that the sw is not fast enough to read data back from the FTDI
chip buffer.
I executed the same read action without problem with an hyperterminal,
so now I am wondering if this is a phython language limitation or if I
am missing some settings.
Have you ever faced this problem before?
Below there is the used code.
Thank you in advance.
import os
import sys
import ftdi1 as ftdi
import time
# Establish USB connection
ftdic = ftdi.new()
ret = ftdi.usb_open(ftdic, 0x0403, 0x6001)
ret = ftdi.usb_reset(ftdic)
ret = ftdi.usb_purge_buffers(ftdic)
ret = ftdi.set_baudrate(ftdic, 115200)
ret = ftdi.set_line_property(ftdic, ftdi.BITS_8 , ftdi.STOP_BIT_1,
ftdi.NONE)
ret = ftdi.setflowctrl(ftdic,ftdi.SIO_DISABLE_FLOW_CTRL)
# Write TX buffer
wrBuffer = chr(2)+chr(82)+chr(68)+chr(49)+chr(48)+chr(49)+chr(3)
BytesWritten = ftdi.write_data(ftdic, wrBuffer, len(wrBuffer))
time.sleep(1)
# Read RX buffer
ret, readData = ftdi.read_data(ftdic, 4096)
--
--
Davide Rodomonti
--
--
Davide Rodomonti
LOEP (Linac and Operations/ Electric Power System)
Tel. +49-6159-71-1905
BR2 2.107
GSI Helmholtzzentrum für Schwerionenforschung GmbH
Planckstraße 1
64291 Darmstadt
www.gsi.de
Gesellschaft mit beschränkter Haftung
Sitz der Gesellschaft: Darmstadt
Handelsregister: Amtsgericht Darmstadt, HRB 1528
Geschäftsführung:
Ursula Weyrich
Professor Dr. Karlheinz Langanke
Vorsitzender des Aufsichtsrates: St Dr. Georg Schütte
Stellvertreter: Ministerialdirigent Dr. Rolf Bernhardt
--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
|