Finding intermittent faults in PIC PCB Peripherals OSHONSOFT

jjw

Joined Dec 24, 2013
823
I don't understand what you mean by:
"The SCK is oscillating opposite to the D/S recommendations"
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
#193 is for HW SPI.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
I don't understand what you mean by:
"The SCK is oscillating opposite to the D/S recommendations"

#193 is for HW SPI.
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
 

Attachments

jjw

Joined Dec 24, 2013
823
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
The default for the SPICLOCK is active high.
Try Define SPICLOCK_INVERT=1
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
The default for the SPICLOCK is active high.
Try Define SPICLOCK_INVERT=1
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
 
Last edited:

jjw

Joined Dec 24, 2013
823
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
What are the different configurations?
In Oshonsoft there are not many of them.
Edit: or do you mean compass settings?
 
Last edited:

Thread Starter

camerart

Joined Feb 25, 2013
3,730
What are the different configurations?
In Oshonsoft there are not many of them.
Edit: or do you mean compass settings?
Hi J,
configurations: e,g, putting
[Define SPICLOCK_INVERT=1] at the beginning of the program.

[Define SPICLOCK_INVERT=0] at the beginning of the program.

[Define SPICLOCK_INVERT=1] just before the COMP READ section

[Define SPICLOCK_INVERT=0] just before the COMP READ section

[Define SPICLOCK_INVERT=1] just before the COMP READ section
and [Define SPICLOCK_INVERT=0] just after the COMP READ section
ETC.
-------------------------------------------------------
Different configurations as shown in [Work not work +GRAPH 181019] #43 Note: RED
---------------------------------------------------------
NOTE: If I change the Oshonsoft CLK then all of the other working peripherals may error.
The Compass can't be changed.(I don't think)

C
 

jjw

Joined Dec 24, 2013
823
Hi J,
I either get sensible READing or a fixed one like [COMPSS DEG 306.14] only
C.
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.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
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.
Hi 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
 

jjw

Joined Dec 24, 2013
823
Hi 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
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
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
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?
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
 

ericgibbs

Joined Jan 29, 2010
18,862
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.
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.??
 

jpanhalt

Joined Jan 18, 2008
11,087
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,
This set-up, with opposite clocks, between 18F4620 and AK8963C peripheral has been working for a year or so.
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.
 

jjw

Joined Dec 24, 2013
823
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
Is this happening in the test program for the compass or in the full program with other Spi devices + Usart with interrupts enabled etc.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
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 E,
To clarify:
We've been adding peripherals to the 184620, where the MASTER CLK is resting LOW, and goes HIGH. Up to now the COMPASS module has worked with this. When this problem started I noticed the COMP CLK rests HIGH and goes LOW. I have been calling opposite phases. If the image in #43 is clear enough, you will see this shown with RED. From Analyser and COMP D/S
C
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
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 J2,
I think you've explained that this may well be the problem, and either way it needs changing.

Running the MASTER and 'this only' SLAVE device in different modes was only found by fault finding, not intent. I will have to check all of the other devices, but they seem to be working ok. The COMPASS however doesn't appear to be able to be changed, and changing the MASTER to suit, upsets all of the other peripherals, and the DATA analyser. I'm trying to figure out what to do?
C
 
Last edited:

Thread Starter

camerart

Joined Feb 25, 2013
3,730
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
Hi J,
1/ I think J2 has answered this.

2/The analyser shows what's arriving at the MISO PIN, mostly without error, the PIC hasn't been READing the DATA.
These tests are the whole program. You may recall in my other threads, that this COMP module has had a lot of testing, including MAGMASTER the clever calibrating programs, and has given good results, with maybe some errors.
The GPS uses an INTERRUPT, which is ON. This was asked previously, and I tried switching the INTERRUPT of with the same results.
The 18F4620 D/S gives alternatives for the CLK, the AK8953C COMP only has one MODE.
3/ I carried out the i=0 to 7 test, but it gives the same confusing results, as we are looking at.

All of the other peripherals are working, but only the C/S from the COMP is being READ, if I changed the C/S to one of the other modules, then it would be working OK.
C
 
Top