Is the I2C for MLX90640 thermal sensor software/bit-bashed?

Discussion related to "under the hood" OpenMV topics.
mirkwood
Posts: 12
Joined: Tue Mar 10, 2020 4:08 am

Is the I2C for MLX90640 thermal sensor software/bit-bashed?

Postby mirkwood » Tue Apr 14, 2020 12:15 am

If so why?
Just want to understand before I spend time trying to change it to hardware.
User avatar
kwagyeman
Posts: 4107
Joined: Sun May 24, 2015 2:10 pm

Re: Is the I2C for MLX90640 thermal sensor software/bit-bashed?

Postby kwagyeman » Tue Apr 14, 2020 10:47 am

It's bit banged. Ibrahim wrote it like that a long time ago and it worked and we just didn't change it. If you look at the commits the code is from like 2015. The sensor is on a valid I2C bus however so you can use an I2C bus easily.

I think the old 16x4 MLX sensor needed the software I2C because you need to do repeated starts on it which the ST HAL might not be able to do easily. But, the MLX90640 can probably be done in hardware.

Just switch out the software i2c to hardware i2c: https://github.com/openmv/openmv/tree/m ... rc/mlx/src

You can literally see the hardware i2c code is commented out and the software code is not commented. You just need to comment the software code and then implement the interface for the hardware code.
Nyamekye,
User avatar
iabdalkader
Posts: 1180
Joined: Sun May 24, 2015 3:53 pm

Re: Is the I2C for MLX90640 thermal sensor software/bit-bashed?

Postby iabdalkader » Mon May 18, 2020 11:55 am

Hi, I've updated all the FIR I2C code, the older MLX sensor still uses soft-i2c but the other two sensors (AMG and MLX90640) are now using HW I2C. And I've also enabled FM+ for the MLX90640 to allow the fastest I2C freq possible. Note the MLX90640 driver got an update from MLX upstream, the update is an improvement and fixes some issues, but there's a side effect the read_ir and snapshot can timeout/fail now. You need to wrap these functions with try...exception OSError block and retry if it fails.

Return to “Technical Discussion”

Who is online

Users browsing this forum: Google [Bot] and 7 guests