Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update read_reg() to use repeated start #38

Merged
merged 1 commit into from
Mar 28, 2024
Merged

Conversation

caternuson
Copy link
Contributor

Possible fix for #37.

Basically just switches to using a repeated start in the read_reg() function.

All of the I2C examples in the MLX90393 datasheet show repeated start. The MLX90393 seems to be somewhat OK with a stop/start split write/read transaction, since that is used in a few places. But that mixed with the additional I2C overhead dealing with setting the muxer does not seem to work (see traces in issue thread).

Tested with QT PY RP2040 + PCA9546A + MLX90393, the same setup that was failing before, works now:

Adafruit CircuitPython 8.2.6 on 2023-09-12; Adafruit QT Py RP2040 with rp2040
>>> import board
>>> import adafruit_mlx90393
>>> import adafruit_tca9548a
>>> i2c = board.STEMMA_I2C()
>>> mux = adafruit_tca9548a.PCA9546A(i2c)
>>> SENSOR = adafruit_mlx90393.MLX90393(mux[2], address=0x0c)
>>> SENSOR.magnetic
(-34.35, -9.9, 78.65)
>>> SENSOR.magnetic
(-34.2, -10.05, 78.65)
>>> SENSOR.magnetic
(-595.95, -68.1, -163.592)
>>>

And still works without the muxer and simply connected directly:

Adafruit CircuitPython 8.2.6 on 2023-09-12; Adafruit QT Py RP2040 with rp2040
>>> import board
>>> import adafruit_mlx90393
>>> i2c = board.STEMMA_I2C()
>>> SENSOR = adafruit_mlx90393.MLX90393(i2c, address=0x0c)
>>> SENSOR.magnetic
(-44.4, 2.25, 55.176)
>>> 

@caternuson caternuson requested a review from a team March 27, 2024 18:24
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me! Thank you!

@tannewt tannewt merged commit 8d1d24c into adafruit:main Mar 28, 2024
1 check passed
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Apr 2, 2024
Updating https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SH1107 to 1.7.0 from 1.6.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_DisplayIO_SH1107#21 from FoamyGuy/displayio_9x_compatibility

Updating https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SSD1306 to 2.0.1 from 2.0.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_DisplayIO_SSD1306#41 from FoamyGuy/9x_compatibility

Updating https://github.com/adafruit/Adafruit_CircuitPython_EK79686 to 1.1.0 from 1.0.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_EK79686#1 from FoamyGuy/root_group_update

Updating https://github.com/adafruit/Adafruit_CircuitPython_HX8357 to 1.4.3 from 1.4.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_HX8357#22 from tyeth/adjust_setosc

Updating https://github.com/adafruit/Adafruit_CircuitPython_IL91874 to 1.4.0 from 1.3.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_IL91874#19 from FoamyGuy/9x_compatibility

Updating https://github.com/adafruit/Adafruit_CircuitPython_MLX90393 to 2.1.4 from 2.1.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_MLX90393#38 from caternuson/mux_fix

Updating https://github.com/adafruit/Adafruit_CircuitPython_TCA8418 to 1.0.12 from 1.0.11:
  > Merge pull request adafruit/Adafruit_CircuitPython_TCA8418#14 from FoamyGuy/root_group_update

Updating https://github.com/adafruit/Adafruit_CircuitPython_BluefruitConnect to 1.2.14 from 1.2.13:
  > Merge pull request adafruit/Adafruit_CircuitPython_BluefruitConnect#39 from vin1953/example-url-fix

Updating https://github.com/adafruit/Adafruit_CircuitPython_HTTPServer to 4.5.7 from 4.5.6:
  > Merge pull request adafruit/Adafruit_CircuitPython_HTTPServer#91 from DJDevon3/DJDevon3-CMSimpleTest

Updating https://github.com/adafruit/Adafruit_CircuitPython_MagTag to 2.2.10 from 2.2.9:
  > Merge pull request adafruit/Adafruit_CircuitPython_MagTag#92 from makermelissa/main

Updating https://github.com/adafruit/Adafruit_CircuitPython_PyBadger to 4.0.0 from 3.8.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_PyBadger#69 from FoamyGuy/root_group_prop

Updating https://github.com/adafruit/Adafruit_CircuitPython_Requests to 3.2.3 from 3.2.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_Requests#179 from FoamyGuy/remove_pylint_disable
  > Merge pull request adafruit/Adafruit_CircuitPython_Requests#175 from DJDevon3/DJDevon3-RocketLaunchLive
  > Merge pull request adafruit/Adafruit_CircuitPython_Requests#174 from DJDevon3/DJDevon3-Youtube

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Updated download stats for the libraries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants