Hi J,The manual can be seen on the Oshonsoft page in the net. Also on the simulator.
That's the one I have.
Did you mean [ SPICLOCK_INVERT ] ?
C
Hi J,The manual can be seen on the Oshonsoft page in the net. Also on the simulator.
#193 is for HW SPI.Hi,
I'm looking for likely things that would give intermittent faults, i,e, Components, soldering, programming etc.
I've got 5xCompass modules, and 3x PCBs.
We've altered the program many times.
I've searched online, and seen mentions of PULL RESISTORS, which I'll try, but having checked with a DATA Analyser, and Oscillator, doubt it's that.
I've just spotted this:
The SCK is oscillating opposite to the D/S recommendations, could this cause intermittent faults? (After past comments, I hope the detail can be seen)
NOTE: The top analysis is working, the bottom is not working. I've tried adding the DIS/ENABLEs in between the READS, but no difference.
EDIT: Here's the SPI clock modes from the 18F4620 D/S
EDIT EDIT: I'm checking this previous explanation: https://forum.allaboutcircuits.com/...wspi-in-oshonsoft.156175/page-10#post-1411674 e,g, #193
C
Hi J,I don't understand what you mean by:
"The SCK is oscillating opposite to the D/S recommendations"
#193 is for HW SPI.
The default for the SPICLOCK is active high.Hi J,
I can't concentrate on two things at once, so I'll leave SW/HW for a while.
When I analyse the SPICLK The CLK phase coming from the PIC is opposite to the COMPASS phase. Can this result in intermittent errors?
C
Hi J,The default for the SPICLOCK is active high.
Try Define SPICLOCK_INVERT=1
What are the different configurations?Hi J,
I've been trying it, but no good so far.
EDIT: I tried [Define SPICLOCK_INVERT=1/0] in different configurations. I either get the same results or [The initial (idle) state of the CLK line does not match the settings]
Could the MASTER Clock output phase being opposite to the PERIPHERAL one, result in intermittent errors?
C
Hi J,What are the different configurations?
In Oshonsoft there are not many of them.
Edit: or do you mean compass settings?
Hi J,Do you get intermittent false readings from all registers 0x80, 0x81 ...., or only x,y,z values?
I mean other values, which should be the same every time, not xyz and angle.Hi J,
I either get sensible READing or a fixed one like [COMPSS DEG 306.14] only
C.
Hi J,I mean other values, which should be the same every time, not xyz and angle.
You read values from address 0x80 to 0x92 and at least 0x80 and 0x81 should be the same every time.
The values from magnetic field could have glitches from environment, overflow etc.
So maybe something's wrong?The result I keep showing of 306.14, also shows if I remove the COMPASS.
C
1) I don't knowHi J,
1/ I'm still interested in the question I keep asking. Theoretically, if a MASTER and SLAVE SPI clocks are opposite, as shown in the GRAPH in #43. Could this cause intermittent errors.
2/ The error I'm getting is either the COMPASS is alive and sending out READings, or it looks dead, and sends NO READings, so no 0x80 or 0x81 or any other.
The result I keep showing of 306.14, also shows if I remove the COMPASS.
C
Hi J2,So maybe something's wrong?
As for using clocks of opposite polarity, what do you think? If it wasn't important, why is it specified?
There is only one Clock source from Master, this Master Clock drives the input SK pin of Compass.1/ I'm still interested in the question I keep asking. Theoretically, if a MASTER and SLAVE SPI clocks are opposite, as shown in the GRAPH in #43. Could this cause intermittent errors.
that is inconsistent with all the problems you have been having reading that module. To me, working mean getting consistent results.This set-up, with opposite clocks, between 18F4620 and AK8963C peripheral has been working for a year or so.
Is this happening in the test program for the compass or in the full program with other Spi devices + Usart with interrupts enabled etc.Hi J2,
Something is wrong! and I've been looking for the cause.
I think it is important to set both ends of the SPI clocks correctly.
This set-up, with opposite clocks, between 18F4620 and AK8963C peripheral has been working for a year or so.
My question is more about the intermittent nature of the error. Is it possible that with the clocks set to opposite phases, could work for a year, then in a different program work sometimes, then not others.
If this could be true then I think this is most likely the problem, and I'll go down that track.
C
Hi E,There is only one Clock source from Master, this Master Clock drives the input SK pin of Compass.
How can you be showing Two different Clocks.??
Hi J2,I was trying to point out my confusion as to what is actually happening and what you are trying to do with the compass module. For example, when you say, that is inconsistent with all the problems you have been having reading that module. To me, working mean getting consistent results.
As for running the master and slave devices in different modes and expecting them to behave flawlessly just doesn't make sense. (Albeit, there are some devices that automatically detect mode and adjust to it. I don't recall seeing that provision in the AK8963C ds.) Just set the master and slave to the same mode and see if you still have problems. In fact, rather that sporadic problems, the problem may be 100% of the time. At least then, you will know when it is solved.
Hi J,1) I don't know
2) Do you see in the analyzer is the MISO stuck at low or high when faulty results are coming or is some but faulty data seen ?
Are these tests of the whole program or just the compass?
Are the interrupts enabled?
Is the clock polarity specified in D/S ?
Try a test with reading only registers 0x80 -0x87
For i=0 to 7
addr=0x80+i
......
etc.
Data from 0x80 is device I'd=0x48
by Aaron Carman
by Duane Benson
by Aaron Carman
by Jake Hertz