Shop OBEX P1 Docs P2 Docs Learn Events
HMC6352 working intermittently - help! — Parallax Forums

HMC6352 working intermittently - help!

reubenwilcockreubenwilcock Posts: 2
edited 2011-01-29 21:35 in Propeller 1
Hi,

I have hooked up a HMC6352 compass module to a propeller board. I get data from the compass module, and most of the time it sends back the heading very convincingly.

However, sometimes it sends back the heading in a very small range - for example, despite the actual orientation it might range from only 200 - 230 degrees. It seems fairly random whether this happens or not. I would say that 9/10 times it works just fine, but then it will just get stuck in this dodgy mode where the heading is limited.

The calibration isnt an issue - after all, it works fine most of the time. I have tried calibrating it though - no difference.

This sensor is used to control a robot I'm building so its pretty important it works properly! By the way, I have tried another identical sensor - same thing happens.

Any suggestions?

Thanks,

Reuben

Comments

  • LeonLeon Posts: 7,620
    edited 2011-01-29 15:13
    Is the supply to the compass decoupled properly?
  • reubenwilcockreubenwilcock Posts: 2
    edited 2011-01-29 15:34
    Yep, it has a 22uf and a 100nf in parallel.
  • TimmooreTimmoore Posts: 1,031
    edited 2011-01-29 21:35
    I haven't used this particular chip but I have used other hmc compasses and I found they need i2c clock stretching. Other people have had i2c clock stretching issues with the hmc6352 chip on the arduino (see http://forum.sparkfun.com/viewtopic.php?t=6236). The standard i2c code for the prop doesn't support clock stretching. What you describe sounds about right without clock stretching, it mostly works and sometimes you get bad values.
    I have attached a version of basic_i2c_driver that I added clock stretching support, you can see if this helps.
Sign In or Register to comment.