Adafruit HMC5883 Breakout with esp32 error

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
s_ramki
 
Posts: 2
Joined: Thu Dec 01, 2022 9:52 pm

Adafruit HMC5883 Breakout with esp32 error

Post by s_ramki »

While running the Breakout board with ESP32 Arduino sketch i am getting the following error message.

I am using the example given as part of Library : magsensor

07:14:32.958 -> [131956][E][Wire.cpp:499] requestFrom(): i2cWriteReadNonStop returned Error -1
07:14:34.000 -> [133020][E][Wire.cpp:499] requestFrom(): i2cWriteReadNonStop returned Error -1
07:14:35.104 -> [134099][E][Wire.cpp:499] requestFrom(): i2cWriteReadNonStop returned Error -1
07:14:35.915 -> [134922][E][Wire.cpp:499] requestFrom(): i2cWriteReadNonStop returned Error -1
07:14:36.930 -> [135947][E][Wire.cpp:499] requestFrom(): i2cWriteReadNonStop returned Error -1

Any Suggestion or help on resolving this issue!..

Details : Below.
I have connected SDA to Pin 4 , SDC to Pin 0 in ESP32 PICO DevKit

Serial Output:
07:30:02.865 -> HMC5883 Magnetometer Test
07:30:02.865 ->
07:30:02.865 -> ------------------------------------
07:30:02.865 -> Sensor: HMC5883
07:30:02.865 -> Driver Ver: 1
07:30:02.865 -> Unique ID: 12345
07:30:02.865 -> Max Value: 800.00 uT
07:30:02.865 -> Min Value: -800.00 uT
07:30:02.865 -> Resolution: 0.20 uT
07:30:02.914 -> ------------------------------------
07:30:02.914 ->
07:30:03.384 -> [ 538][E][Wire.cpp:499] requestFrom(): i2cWriteReadNonStop returned Error -1
07:30:03.384 -> X: -0.09 Y: -0.09 Z: -0.10 uT
07:30:03.384 -> Heading (degrees): 237.61
07:30:03.910 -> [ 1050][E][Wire.cpp:499] requestFrom(): i2cWriteReadNonStop returned Error -1
07:30:03.910 -> X: -0.09 Y: -0.09 Z: -0.10 uT
07:30:03.910 -> Heading (degrees): 237.61
07:30:04.418 -> [ 1561][E][Wire.cpp:499] requestFrom(): i2cWriteReadNonStop returned Error -1
07:30:04.418 -> X: -0.09 Y: -0.09 Z: -0.10 uT
07:30:04.418 -> Heading (degrees): 237.61
07:30:04.948 -> [ 2072][E][Wire.cpp:499] requestFrom(): i2cWriteReadNonStop returned Error -1
07:30:04.948 -> X: -0.09 Y: -0.09 Z: -0.10 uT
07:30:04.948 -> Heading (degrees): 237.61
07:30:05.434 -> [ 2583][E][Wire.cpp:499] requestFrom(): i2cWriteReadNonStop returned Error -1
07:30:05.434 -> X: -0.09 Y: -0.09 Z: -0.10 uT

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Adafruit HMC5883 Breakout with esp32 error

Post by mikeysklar »

Are you running the Adafruit HMC5883 Unified library? I ask just to confirm as there are other libraries with almost identical names like the HMC5883L version. Which version are you on?

https://github.com/adafruit/Adafruit_HMC5883_Unified

From what I've read in other forums about the HMC5883 and i2c communication you could be encountering a clock stretching situation where SCL is being held low to long.

Let's verify your setup first. Can you post a photo of the connections and any soldering you have done?

User avatar
s_ramki
 
Posts: 2
Joined: Thu Dec 01, 2022 9:52 pm

Re: Adafruit HMC5883 Breakout with esp32 error

Post by s_ramki »

I am using Adafruit HMC5883 Unified lib. In ESP32 PICO Board (ESP32 PICO Development Board) . Pins needs to be Configured. I am using different PIN and hence was creating the issue.

Solved : by Manually Adding Wire(4,0); in Library File when this was being initiated.!!

Driver does not have a way to change the PINS or configure custom pins while running.

Thanks for the support.

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Adafruit HMC5883 Breakout with esp32 error

Post by mikeysklar »

Thank you for sharing the solution. Much appreciated.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”