Skip to content
This repository was archived by the owner on Sep 30, 2019. It is now read-only.
This repository was archived by the owner on Sep 30, 2019. It is now read-only.

Not work for python3 with too many problems... #61

Closed
@dukelec

Description

@dukelec

First:

Python 3.5.2 (default, Jul 28 2016, 18:18:57) 
[GCC 5.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> import Adafruit_GPIO as GPIO
>>> import Adafruit_GPIO.FT232H as FT232H
>>> FT232H.use_FT232H()
>>> ft232h = FT232H.FT232H()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/mnt/TT/SA/tools/Adafruit_Python_GPIO/Adafruit_GPIO/FT232H.py", line 165, in __init__
    self._mpsse_sync()
  File "/mnt/TT/SA/tools/Adafruit_Python_GPIO/Adafruit_GPIO/FT232H.py", line 249, in _mpsse_sync
    data = self._poll_read(2)
  File "/mnt/TT/SA/tools/Adafruit_Python_GPIO/Adafruit_GPIO/FT232H.py", line 229, in _poll_read
    raise RuntimeError('Timeout while polling ftdi_read_data for {0} bytes!'.format(expected))
RuntimeError: Timeout while polling ftdi_read_data for 2 bytes!
>>> 

after comment out this line: self._mpsse_sync():

Python 3.5.2 (default, Jul 28 2016, 18:18:57) 
[GCC 5.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import Adafruit_GPIO as GPIO
>>> import Adafruit_GPIO.FT232H as FT232H
>>> FT232H.use_FT232H()
>>> ft232h = FT232H.FT232H()
>>> 
>>> ft232h.setup(8, GPIO.OUT)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/mnt/TT/SA/tools/Adafruit_Python_GPIO/Adafruit_GPIO/FT232H.py", line 341, in setup
    self.mpsse_write_gpio()
  File "/mnt/TT/SA/tools/Adafruit_Python_GPIO/Adafruit_GPIO/FT232H.py", line 313, in mpsse_write_gpio
    self._write(self.mpsse_gpio())
  File "/mnt/TT/SA/tools/Adafruit_Python_GPIO/Adafruit_GPIO/FT232H.py", line 309, in mpsse_gpio
    return str(bytearray((0x80, level_low, dir_low, 0x82, level_high, dir_high)))
TypeError: an integer is required
>>> 

after remove all chr in function mpsse_gpio:

Python 3.5.2 (default, Jul 28 2016, 18:18:57) 
[GCC 5.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import Adafruit_GPIO as GPIO
>>> import Adafruit_GPIO.FT232H as FT232H
>>> FT232H.use_FT232H()
>>> ft232h = FT232H.FT232H()
>>> 
>>> ft232h.setup(8, GPIO.OUT)
>>> ft232h.output(8, GPIO.HIGH)
>>> ft232h.output(8, GPIO.LOW)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/mnt/TT/SA/tools/Adafruit_Python_GPIO/Adafruit_GPIO/FT232H.py", line 368, in output
    self.mpsse_write_gpio()
  File "/mnt/TT/SA/tools/Adafruit_Python_GPIO/Adafruit_GPIO/FT232H.py", line 313, in mpsse_write_gpio
    self._write(self.mpsse_gpio())
  File "/mnt/TT/SA/tools/Adafruit_Python_GPIO/Adafruit_GPIO/FT232H.py", line 194, in _write
    raise RuntimeError('ftdi_write_data failed with error {0}: {1}'.format(ret, ftdi.get_error_string(self._ctx)))
RuntimeError: ftdi_write_data failed with error -1: usb bulk write failed
>>> 

Adafruit_Python_GPIO version:

commit 060f6d6782768b1f6a4713f369db2740e79ec61e
Author: Tony DiCola <tony@tonydicola.com>
Date:   Mon Mar 6 22:44:49 2017 -0800

    Minor bump for Pi 3 on 4.9.x kernel detection.

libftdi vertion:
libftdi1-1.2

python version:
Python 3.6.0 Python 3.5.2

no problem with Python 2.7.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions