I2C writeto_then_readfrom on FT232H: AttributeError: 'bytearray' object has no attribute 'tobytes'
See original GitHub issueWhile trying to use an MLX90640 I2C thermal camera, connected to a FT232H, connected to a Mac mini, I got the following error: AttributeError: 'bytearray' object has no attribute 'tobytes'
The full error logs is at the end.
The test code I use is taken from here: https://pypi.org/project/adafruit-circuitpython-mlx90640/
I believe the problem is in src/adafruit_blinka/microcontroller/ft232h/i2c.py on line 33
But I have no clue what is the origin of the problem, nor if it is related to my specific setup…
I am sorry for the poor quality of this report. I hope this can be reproduce and help solve a bug.
python3 testmlx.py Traceback (most recent call last): File “testmlx.py”, line 8, in <module> mlx = adafruit_mlx90640.MLX90640(i2c) File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/adafruit_mlx90640.py”, line 102, in init self._I2CReadWords(0x2400, eeData) File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/adafruit_mlx90640.py”, line 757, in _I2CReadWords i2c.write_then_readinto(addrbuf, inbuf, in_end=read_words*2) # in bytes File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/adafruit_bus_device/i2c_device.py”, line 136, in write_then_readinto in_start=in_start, in_end=in_end) File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/busio.py”, line 80, in writeto_then_readfrom in_start=in_start, in_end=in_end, stop=stop) File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/adafruit_blinka/microcontroller/ft232h/i2c.py”, line 35, in writeto_then_readfrom relax=True).tobytes() AttributeError: ‘bytearray’ object has no attribute ‘tobytes’
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (6 by maintainers)
Top GitHub Comments
MCP2221 works fine https://learn.adafruit.com/jupyter-on-any-computer-with-circuitpython-libraries-and-mcp2221/thermal-camera
ok btw, the MLX will not work with FT232H…the FT232H doesnt buffer I2C write/reads so its very slow and the MLX requires you read the data within one frame