Re: looking for suggestions
Posted: Thu Dec 07, 2017 5:36 pm
I've had a look at the adafruit library that you are using, and the code could hang (infinite loop) if it doesn't receive 6 bytes back from the sensor in Adafruit_HMC5883_Unified::read ... while (Wire.available() < 6);
That appears to be the only place it could hang in the getEvent call so I suggest it is not receiving enough data. I would make a change to the library and add a timeout so that it does not loop indefinitely (I HATE rubbish code like that... Thanks Adafruit!!). Or as a cheap and nasty, just return from the read early to prove where it is hanging.
This would of course point to a hardware problem.
Please do NOT ask for the code to do a timeout as it is rudimentary stuff.
That appears to be the only place it could hang in the getEvent call so I suggest it is not receiving enough data. I would make a change to the library and add a timeout so that it does not loop indefinitely (I HATE rubbish code like that... Thanks Adafruit!!). Or as a cheap and nasty, just return from the read early to prove where it is hanging.
This would of course point to a hardware problem.
Please do NOT ask for the code to do a timeout as it is rudimentary stuff.