Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

How 3x axis sine waves act on a Compass module Oshonsoft BASIC.

Status
Not open for further replies.
Sorry, I haven't read the whole d/s.
I2C is disabled with a pin in the chip.
Hi J,
i2c Here:

I think I'll swap the chip set-up back to in front of the 'self test' routine, and hope I can keep the relevant settings, without the 'self test' routine changing them.
C
 

Attachments

  • i2c.jpg
    i2c.jpg
    106.9 KB · Views: 257
From the D/S
AK8963 supports I2C bus interface and 4-wire SPI. A selection is made by CSB pin.
CSB pin=“L”: 4-wire SPI
CSB pin=“H”: I2C bus interface
 
From the D/S
AK8963 supports I2C bus interface and 4-wire SPI. A selection is made by CSB pin.
CSB pin=“L”: 4-wire SPI
CSB pin=“H”: I2C bus interface
Hi J,
It appears that I've been using 2x ways of disabling i2c!
1/The method in #62
plus
2/ Each time I WRITE or READ the chip, I use this method:
______________________________________________________________________
SPI COMPSS = CSB H or L

compss = 0 'CHIP SELECT COMPASS ON
SPISend 0x0f 'CONFIG I2C Disable
SPISend 0x1b '1B=27 WRITE CONFIG I2C OFF
compss = 1 'CHIP SELECT COMPASS OFF
_____________________________________________________________________________
Thanks
C.
 
Hi J,
The program has stopped getting the normal READings, so I think it's better that I start again, with what I've learnt, but this time without the normal READ of measurement.
C
 
Hi J,
I've been re-writing the 'self test' program, item by item, and got to the offending ASTC WRITE READ here are the results.
As you can see the ASTC shows 64 which is 0x40 as WRITTEN.
Good, I'll stop for now.
C.
________________________________________________________
[00][00]Ready!
AT+C002
CNTL2 0.00
i2cDIS 27.00
CNTL2 22.00
CNTL1 16.00
ASTC 64.00
 
Hi J,
Does this look ok?
Note SELF TEST and NORMAL RUNNING
C.
__________________________________________________
[00]Ready!
AT+C002
SELF TEST
CNTL1 22.00
ASTC 64.00
CNTL1 24.00
WIA 72 ST2 16 CNTL1 22 ASTC 0 I2C 27
-85.00, 67.00, -111.00
ASTC 0.00
CNTL1 16.00
CNTL2 0.00
i2cDIS 27.00
CNTL2 22.00
NORMAL RUNNING
-86.00,68.00,-114.00
-84.00,68.00,-106.00
-83.00,69.00,-103.00
-88.00,68.00,-110.00
-85.00,75.00,-107.00
-94.00,72.00,-108.00
-82.00,74.00,-114.00
-75.00,65.00,-109.00
-85.00,65.00,-105.00
-82.00,72.00,-110.00
-83.00,71.00,-111.00
-88.00,68.00,-108.00
-67.00,79.00,-109.00
-52.00,88.00,-112.00
-29.00,103.00,-103.00
-19.00,109.00,-115.00
-31.00,107.00,-119.00
-4.00,102.00,-114.00
18.00,108.00,-106.00
31.00,109.00,-107.00
54.00,102.00,-100.00
69.00,103.00,-113.00
73.00,93.00,-111.00
92.00,80.00,-112.00
97.00,73.00,-107.00
94.00,66.00,-116.00
95.00,57.00,-113.00
95.00,57.00,-113.00
103.00,59.00,-109.00
104.00,56.00,-114.00
109.00,57.00,-111.00
112.00,52.00,-110.00
93.00,65.00,-107.00
 

Attachments

  • 18F4520 INT8MHz HC12, AK8963C PCB3 XYZ-SELF_TEST 260920.txt
    8.5 KB · Views: 243
Hi J,
Does this look ok?
Note SELF TEST and NORMAL RUNNING
C.
__________________________________________________
[00]Ready!
AT+C002
SELF TEST
CNTL1 22.00
ASTC 64.00
CNTL1 24.00
WIA 72 ST2 16 CNTL1 22 ASTC 0 I2C 27
-85.00, 67.00, -111.00
ASTC 0.00
CNTL1 16.00
CNTL2 0.00
i2cDIS 27.00
CNTL2 22.00
NORMAL RUNNING
-86.00,68.00,-114.00
-84.00,68.00,-106.00
-83.00,69.00,-103.00
-88.00,68.00,-110.00
-85.00,75.00,-107.00
-94.00,72.00,-108.00
-82.00,74.00,-114.00
-75.00,65.00,-109.00
-85.00,65.00,-105.00
-82.00,72.00,-110.00
-83.00,71.00,-111.00
-88.00,68.00,-108.00
-67.00,79.00,-109.00
-52.00,88.00,-112.00
-29.00,103.00,-103.00
-19.00,109.00,-115.00
-31.00,107.00,-119.00
-4.00,102.00,-114.00
18.00,108.00,-106.00
31.00,109.00,-107.00
54.00,102.00,-100.00
69.00,103.00,-113.00
73.00,93.00,-111.00
92.00,80.00,-112.00
97.00,73.00,-107.00
94.00,66.00,-116.00
95.00,57.00,-113.00
95.00,57.00,-113.00
103.00,59.00,-109.00
104.00,56.00,-114.00
109.00,57.00,-111.00
112.00,52.00,-110.00
93.00,65.00,-107.00

While drdy = 0
SPISend 0x82
SPIReceive drdy
<------------- Wend should be here, not at the end of the loop
 
What do you mean?
Hi J,
I used the program, you've seen with 3x diferent compasses (modules) and the results were the same, I found this suspicious.

I tried a different method of READing the 'self test' measurement DATA, (simply a READ for each sensor). This resulted in different READings, but I still don't think they look correct, also all of them are out of the correct 'self test' values
I'll keep changing, till it looks better, then post the program.
C
 
Hi J,
Success!!
I found a major typo, XXX instead of XYZ, changed and now it works. Similar results with 3x modules.
Thanks, C
 

Attachments

  • XYZ RESULTS.txt
    2 KB · Views: 243
  • 18F4520 INT8MHz HC12, AK8963C PCB3 XYZ-SELF_TEST 270920.txt
    8.4 KB · Views: 242
Hi,
I've just been reminding myself about the Magmaster and Magviewer.
Magmaster is for producing correction settings for each Compass module, and Magviewer is to show how far out it is before and after.
Here is 1x Module in Magviewer:

Previouslt we made a READing average program, which I've got to combine into the 'Self test'/Magmaster program.
C
 

Attachments

  • Magviewer.jpg
    Magviewer.jpg
    90.1 KB · Views: 265
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top