SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By UhClem
#83444
I finally got around to playing with the SparkFun breakout for the HMC5843. It didn't work.

I ended up writing a short program to verify that it was reseting itself. I wrote values to the two configuration registers different from the default and then set the mode to continuous. I immediately read back the registers to verify the values written. After than wait a second or so and read them back. At which it was in the default configuration and in idle mode.

I sent an email to SparkFun describing this and I received a response confirming that a tantalum capacitor with an ESR of ~2 Ohms was used and that they are switching to a ceramic part for future production.

Notable for its absence was any mention of what would be done about defective product already sold.

I dug around in my parts collection and turned up a 1206 size 10uF ceramic cap that I had forgotten about. Installing it was not easy as one pad is well heatsinked. I am not happy with the soldering job but it will have to do as I am afraid that more heat will damage the capacitor.

With the new capacitor the HMC5843 is happily churning out data.

Unfortunately my SD card code is acting up so I have yet to record enough data to see if it is any good.
By kabla002
#83507
Hi Everyone,

I'm Just getting started with the HMC5843. I'm trying to communicate with it using a dsPIC33FJ256GP710. I'm starting out by trying to read the ID register at address 0xA0. The code I'm using is posted below. The uC makes it to this line
Code: Select all
value=MasterReadI2C1();   //read 
and then freezes waiting for I2C1CONbits.RCEN to clear.

I took a look at the SCLK and SDA lines. Below is a trace I captured. Note that the trace below isn't from running the exact code below, however I see the same problem when I run the code below. You can see from the trace that I can send the write command as well as the address of the register I want to read from successfully( I get an acknowledge back). However, after sending the read command, 0x3D, the SCLK and SDA lines go low and stay low permanently. This seems like some sort of clock stretching gone haywire.

Has anyone seen this before or have any ideas of what the problem might be? Thanks for the help

~ John

Image
Code: Select all
IdleI2C1();

StartI2C1();			//set start condition
IdleI2C1();

MasterWriteI2C1(0x3C);                 //send write command
IdleI2C1();   

MasterWriteI2C1(10);   	            //set reg pointer to register 10
IdleI2C1();

StopI2C1();				    //end packet
IdleI2C1();

//start read

StartI2C1();			           //set start condition
IdleI2C1();

MasterWriteI2C1(0x3D);               //send read command
IdleI2C1();   

value=MasterReadI2C1();            //read 
AckI2C1();				  //acknowledge
IdleI2C1();  
By Laurent D.
#83855
Hi,

Have you tested without the first write command (the one to set up ne register you want to read): just try to read data from HMC: 3D and then read command ? what is the result ?
By lehmanna
#83862
I have no clue about how I2C is implemented in the libraries you're using with respect to the PIC controller, but instead of sending a definite StopI2C followed by a StartI2C there should be something like a RepeatedStartI2C. This might well be the reason why the controller has to wait endlessly for an answer...
By MostlyHarmless
#84349
UhClem wrote:
I dug around in my parts collection and turned up a 1206 size 10uF ceramic cap that I had forgotten about. Installing it was not easy as one pad is well heatsinked. I am not happy with the soldering job but it will have to do as I am afraid that more heat will damage the capacitor.

With the new capacitor the HMC5843 is happily churning out data.
Thanks, UhClem! Wish I'd read your post _before_ I spent 4 hours trying to debug my own hardware and code... In any case, I got my breakout board working after I removed the original cap and put on a 4.7 uF ceramic.
Cheers,
MH
By UhClem
#84393
I have been playing with this part and the news is good/bad.

The bad is that once again the data sheet fails to document a key bit of behavior. According to the data sheet you can set the device to do continuous conversions at various rates. What they fail to tell you is how accurate those rates are. I configured my copy for 50 SPS. I was very surprised to find that it wasn't even close. The actual rate was 73.46 SPS. From this I conclude that the internal clock is a pretty simple RC oscillator and that this rate will vary with temperature. Possibly a lot.

I tried out some code for calibration of the sensor. The usual method of calibrating magnetic sensors is to carefully rotate them to find the minimum and maximum values which gets pretty tedious. This automatic method requires only that you get 6 different values. Diversity in those helps a lot but you don't have to be fanatical about it. The output is gains and offsets assuming a field strength of 1. This is fine for orientation but not so good if you want to measure absolute field strength.

While looking for information on quaternions I ran across a paper that discussed an analysis technique called the Allan Variance. It looked interesting so I wrote some code and captured some data. I am not sure how to get actual numbers out of the plot. But it does show the expected -1/2 slope for white noise, a minimum, and then a positive slope. I am trying to locate more information so that I can use this to put numbers on things like noise, offset drift, and perhaps other processes. (While searching I discovered that the NIST program Dataplot does Allan Variance. If I had thought to check its vast bag of tricks I would have saved some time coding.)
By MostlyHarmless
#85007
Just noticed the HMC5843 breakout board is for sale again. Can anyone verify that the problem cap was replaced by one with a lower ESR?
Cheers,
MH
By nrp
#85098
MostlyHarmless wrote:Just noticed the HMC5843 breakout board is for sale again. Can anyone verify that the problem cap was replaced by one with a lower ESR?
Cheers,
MH
I just got one today. I haven't tried interfacing it yet though. It looks identical to pictures on Sparkfun.
By nrp
#85101
nrp wrote:
MostlyHarmless wrote:Just noticed the HMC5843 breakout board is for sale again. Can anyone verify that the problem cap was replaced by one with a lower ESR?
Cheers,
MH
I just got one today. I haven't tried interfacing it yet though. It looks identical to pictures on Sparkfun.
No luck. I just get TW_MT_SLA_NACK when sending the address. The local electronics shop is closed tomorrow too. Guess I'll have to wait until Monday to get a better cap.
By UhClem
#85122
No luck. I just get TW_MT_SLA_NACK when sending the address. The local electronics shop is closed tomorrow too. Guess I'll have to wait until Monday to get a better cap.
Then you have a different problem.

With a high ESR capacitor the device will respond as usual to I2C commands. But any attempt to actually measure anything will result in a reset and return to IDLE mode.
By Etienne
#85125
Hi,

I bought one last week. The capacitor on DVDD is always a tantalum one but I changed it.

The I2C communication is ok.

Problem:
Config: F=50Hz, Mode=Normal, Gain=+-4.5
When I put the card horizontal, I have +-100 on x and y axis, and I can find the north.
When I rotate the card in 3D, I can have until 200 and -200 on x and y axis which is impossible.

I thinked that was because there is metal near the card, so I desoldered it and I put a wire to the card. I have always the same problem. I tried to change the frequency and gain but it's the same thing.

When I change the mode (1 or 2), output x y and z move about 1 or 2 LSB around 220.
By nrp
#85135
Oops. Never mind then. It was just my code. I was attempting to use the Wire library in Arduino. I guess thats what happens when you take shortcuts.

Just using the code on the Sparkfun product page, it works fine without having to change the capacitor. It seems they might have switched it out for a lower ESR one on the latest batch.
By m1tch37
#85152
Could you please share your Arduino code? I am also having issues, and it would be good to be able to rule out my code as the problem. Thanks alot.
By Etienne
#85175
Hi,

If somebody have a chip which works, can you post pictures of the data x,y,z when you turn the magnetometer on 360° when it's horizontal and the same when you rotate it on an other axis.

Thanks

Etienne
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]