Honywell HMR3200 Digital Compass on SPI?

Started by polyphon1890 March 20, 2004
Hi,

Have any of you people hooked one of these up to the SPI? I got it
working through it's UART mode by putting it on SCI1, but I'd rather
have it on the SPI. Nothing I've tried works. It is supposed to spit
out an 0x73 ('s') when it wakes up but the closest I get is an extra
1 on the front which causes the 0x73 to be missalligned by one bit
for a repeating 0xB9. Thanks.



Might not be that you set the SPI to sample at the wrong time? Try
changing the CPHA bit and/or CPOL bit.
The best way would be to check the datasheet of this compass, and set
the SPI parameters accordingly (which is described in detail in the SPI
Block User Guide). My apologies if you have already done this.

Zoltan

--- In , "polyphon1890" <polyphon1890@y...> wrote:
> Hi,
>
> Have any of you people hooked one of these up to the SPI? I got it
> working through it's UART mode by putting it on SCI1, but I'd rather
> have it on the SPI. Nothing I've tried works. It is supposed to spit
> out an 0x73 ('s') when it wakes up but the closest I get is an extra
> 1 on the front which causes the 0x73 to be missalligned by one bit
> for a repeating 0xB9. Thanks.




> Have any of you people hooked one of these up to the SPI? I got it
> working through it's UART mode by putting it on SCI1, but I'd rather
> have it on the SPI. Nothing I've tried works. It is supposed to spit
> out an 0x73 ('s') when it wakes up but the closest I get is an extra
> 1 on the front which causes the 0x73 to be missalligned by one bit
> for a repeating 0xB9. Thanks.

=============================
If its putting out ascii on a serial port, use that. I would not expect to
ever be able to read ascii characters with an spi port. SPI needs clk and
data... SCI is asynchronous... has no clk... furthermore, the sci sends start
bit, then 8 data bits... thats nine bits... how are you going to clock all that
into the spi? Furthermore, sci runs at standard wierd baud rates like 115200
bits per second. The spi doesnt have a baud rate generator to get those
particular baud rates, so I'd say its a miracle if you managed to get anything by
hooking a serial data stream to the spi.



In a message dated 3/20/04 5:04:29 PM Eastern Standard Time,
writes:

No, he's right. It puts out ASCII formatted characters on the SPI link in
SPI format (that is, no start or stop bits, and SPI bit timing). ===============================
Well I'll be darned. Thanks for the info.



At 10:05 AM 3/20/04, you wrote:
> > Have any of you people hooked one of these up to the SPI? I got it
> > working through it's UART mode by putting it on SCI1, but I'd rather
> > have it on the SPI. Nothing I've tried works. It is supposed to spit
> > out an 0x73 ('s') when it wakes up but the closest I get is an extra
> > 1 on the front which causes the 0x73 to be missalligned by one bit
> > for a repeating 0xB9. Thanks.
>
>=============================
>If its putting out ascii on a serial port, use that. I would not expect to
>ever be able to read ascii characters with an spi port. SPI needs clk and
>data... SCI is asynchronous... has no clk... furthermore, the sci sends
>start
>bit, then 8 data bits... thats nine bits... how are you going to clock all
>that
>into the spi? Furthermore, sci runs at standard wierd baud rates like 115200
>bits per second. The spi doesnt have a baud rate generator to get those
>particular baud rates, so I'd say its a miracle if you managed to get
>anything by
>hooking a serial data stream to the spi.


No, he's right. It puts out ASCII formatted characters on the SPI link in
SPI format (that is, no start or stop bits, and SPI bit timing).

That said, the compass expects to be the master, even though it is the
peripheral. Also, the clock timing is not symmetrical, which shouldn't be
a problem, but keep it in mind for later on.... It sounds like you may
have a mismatch in the phase and edge selection logic. There are only 4
combinations; just try them all...

Gary Olmstead
Toucan Technology
Ventura CA


(Gary, I meant to post this response for the group to see, but it got
emailed to you instead. So here's another try!)

Thanks for the reply Gary. I have tried all 4 combinations of CPOL
and CPHA, and I have the MSTR bit clear (HCS12 set as slave). I get
various outputs from it with the different CPOL/CPHA settings, but
each time there's extra '1's at the beginning of the transmission,
from 1 to 10 extra. On the O'scope, the data coming from the HMR3200
looks fine, but when I look at the data received by the interrupt
handler, it has the extra 1's. Also the HCS12 is supposed to
transmit an "h" or an "H" "... and the host shall transmit a valid
command character simultaneously." The bit pattern for the 'h' is
not aligned properly with the clock pulses. I'm a bit confuset as to
the SS line. I've tried tying it to the port that I activate the
HMR3200 with (CS) and tried it with it not hooked up, either way it
doesn't work properly.
--- In , BobGardner@a... wrote:
> In a message dated 3/20/04 5:04:29 PM Eastern Standard Time,
> garyolmstead@e... writes:
>
> No, he's right. It puts out ASCII formatted characters on the SPI
link in
> SPI format (that is, no start or stop bits, and SPI bit timing). > ===============================
> Well I'll be darned. Thanks for the info. >