question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I2C writeto_then_readfrom on FT232H: AttributeError: 'bytearray' object has no attribute 'tobytes'

See original GitHub issue

While 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:closed
  • Created 4 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ladyadacommented, Dec 27, 2019

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to use I2C connection between FT232H and ...
I get an AttributeError: 'bytearray' object has no attribute 'tobytes' when trying to setup I2C connection. Code: Select all led = digitalio.
Read more >
AttributeError:'bytes' object has no attribute 'encode'
new is bytes/bytearray/memoryview, and I assume that text is already of type bytes , then we just have to convert the pad part...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found