Finding intermittent faults in PIC PCB Peripherals OSHONSOFT

Thread Starter

camerart

Joined Feb 25, 2013
3,730
Hi,
I tried: [ Define SPICLOCK_INVERT = 1 ]
No change to the error, the AK8963 is still not working properly.

I also checked the BMP280 ALTIMETER D/S and the SPI SCL is also resting HIGH.
The READings from this look ok, so I'll leave [Define SPICLOCK_INVERT = 1 ]
C.
 
Last edited:

jjw

Joined Dec 24, 2013
823
Hi,
I tried: [ Define SPICLOCK_INVERT = 1 ]
No change to the error, the AK8963 is still not working properly.

I also checked the BMP280 ALTIMETER D/S and the SPI SCL is also resting HIGH.
The READings from this look ok, so I'll leave [Define SPICLOCK_INVERT = 1 ]
C.
SCl resting high in BMP280 is strange. Or do you mean after SPICLOCK_INVERT=1?
 

jjw

Joined Dec 24, 2013
823
Hi J,
No feedback on my examples #80, so I'll carry on screen shots as they are.

When I meant BMP280 resting High, see example: SCK
C
I understand what it means. I asked if it has been so all the time or after the clock has been inverted?
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
I understand what it means. I asked if it has been so all the time or after the clock has been inverted?
Hi J,
I wasn't explaining what it means, I was showing you a graph from the BMP280 which if you compare from the AK8963C you will see that with both of these peripherals the SPI_SCL starts from HIGH (resting) to LOW.

The BMP280 has never failed, even when SPICLOCK_INVERT=1 or 0, so I said I would leave SPICLOCK_INVERT set to 1.

Now the BMP280 is still working, but the COMPASS is not. Perhaps this isn't the problem then?

AK8963: Following a previous post regarding old working programs. I've found an old working program, which is working on a simple PCB I use for MAGMASTER calculations, I'll continue investigating.
C.
 

Attachments

Last edited:

Thread Starter

camerart

Joined Feb 25, 2013
3,730
Hi,
I'm fairly sure that the problem is with the SPI signal.

The DATA is arriving at the PIC MISO PIN ok, on working and not working times.

The Digital analyser shows sensible results from the DATA, but the PIC. The Oscilloscope show 'raggy' signals.

EDIT: This is from a working example.
C.
 

Attachments

Last edited:

Thread Starter

camerart

Joined Feb 25, 2013
3,730
Hi,
Here's a line from the Oshonsoft manual: [ The assumed settings are active-high for Clock line and active-low for ChipSelect line. ]
Does it match this AK8963C example?

I'm not sure if the CLK is active HIGH or LOW.
EDIT: I recall previously 'E' explaining all this to me, but I've got to re-look at it. Here is an image from 'Nsaspook' which shows the AK8963C is SPIMode3, which is opposite to the [ --- ] line above. I think then I should always have OSH CLK set to INVERT?? Correct me if I'm wrong.
C.
 

Attachments

Last edited:

Thread Starter

camerart

Joined Feb 25, 2013
3,730
Hi,
Having a closer look at timing!
Here's a shot from the Oscilloscope, which shows the MISO switching on the CLK switch, which doesn't look correct.
I tried OSH clock stretch, but it seemed to more error.
C.
 

Attachments

jjw

Joined Dec 24, 2013
823
Hi,
Having a closer look at timing!
Here's a shot from the Oscilloscope, which shows the MISO switching on the CLK switch, which doesn't look correct.
I tried OSH clock stretch, but it seemed to more error.
C.
It looks correct, if read/write is at clock low to high.
 

sagor

Joined Mar 10, 2019
912
I notice a difference in pulse heights (voltages). Your display shows 2V per division. Top trace seems to be a 3.3V pulse (or close to it), but bottom is only around 2V. Check the datasheet as to what the minimum detectable voltage levels are. Around 2V, with some "noise" on the line, it may be dipping well below 2V.
Notice also, that on EVERY upwards step (and downwards step too) on the top trace, you get a small impulse on the lower trace at exactly the same time. Something is interacting between the two signals. It could be signal line layout, your probe connections, or something else.
 
Last edited:

jjw

Joined Dec 24, 2013
823
What are the voltages at Vdd and Vid pins?
The input signal high level should be at least 70% of Vid.
Vout high > 80% of Vid
If Vid is 3.3V, Vin high must be > 3.3 x 0.7V -> 2.3V
As Sagor said in #90, the second trace is about 2V and is too low.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
I notice a difference in pulse heights (voltages). Your display shows 2V per division. Top trace seems to be a 3.3V pulse (or close to it), but bottom is only around 2V. Check the datasheet as to what the minimum detectable voltage levels are. Around 2V, with some "noise" on the line, it may be dipping well below 2V.
Notice also, that on EVERY upwards step (and downwards step too) on the top trace, you get a small impulse on the lower trace at exactly the same time. Something is interacting between the two signals. It could be signal line layout, your probe connections, or something else.
Hi S and J,
`Ah haa! Well spotted 'S'

I didn't find the PIC VID, but the COMP VID is 1.65V.
I may have misread the D/S, and thought that if VID is connected to VD 3.3V then it will output 3.3V, but now I think it is the opposite way i,e, if 1.65 is connected to the COMP VID pin then it will work at 1.65V instead of 3.3V.

As this has been intermittent, I tried a quick PULL-UP 10K resistor on the MISO, but as expected, it didn't work. EDIT: If so would this suit?: https://uk.rs-online.com/web/p/mosfets/6395556/

I wonder if a mosfet would work as a voltage shifter?

S, perhaps you would remind me about the 'lower trace impulse' please, if this isn't solved.
C.
 
Last edited:

jjw

Joined Dec 24, 2013
823
Why is Vid connected to 1.65V?
Where do you get 1.65V?
Connect it to 3.3V if the PIC is running from 3.3V
 
Last edited:

Thread Starter

camerart

Joined Feb 25, 2013
3,730
Why is Vid connected to 1.65V?
Where do you get 1.65V?
Connect it to 3.3V if the PIC is running from 3.3V
Hi J,
The PIC is running from 3.3V
The AK8963C COMP module works at 3.3V or 1.65V but only outputs 1.65V on the MISO, so it needs to have it's level shifted up to >2.3V.
C
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
From d/s 5.3.1:
High level output voltage 1 VOH1 SO 80%Vid

If Vid is 3.3V then Vout high => 2.64V
Hi J,
This must have been what I saw when I was connecting up, but the next section 6.1 and 6.2 baffled me.

I now see [ When the power state is ON, always keep Vid≤Vdd. ] I have VID connected to VDD.

C
 
Last edited:

jjw

Joined Dec 24, 2013
823
Hi J,
This must have been what I saw when I was connecting up, but the next section 6.1 and 6.2 baffled me.

I now see [ When the power state is ON, always keep Vid≤Vdd. ] I have VID connected to VDD.

C
Then something is loading MISO. Have you checked for shorts between pins in PIC and in compass.
There should be only connection from MISO to PIC.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
Then something is loading MISO. Have you checked for shorts between pins in PIC and in compass.
There should be only connection from MISO to PIC.
Hi J,
Remember I have 3x PCBs, so I'm pretty sure I've checked everything.

I tried cutting the VID to VDD track on the COMP PCB, and the SO PIN voltage went down, then connected it went back up to 1.65V.

I think the COMP module SO PIN voltage needs level lifting to your calculated >2.3V. Will a MOSFET do this?
C.
 

jjw

Joined Dec 24, 2013
823
Hi J,
Remember I have 3x PCBs, so I'm pretty sure I've checked everything.

I tried cutting the VID to VDD track on the COMP PCB, and the SO PIN voltage went down, then connected it went back up to 1.65V.

I think the COMP module SO PIN voltage needs level lifting to your calculated >2.3V. Will a MOSFET do this?
C.
I don't understand why it goes to 1.65V.
It is strange, that is exactly half of 3.3V.
Maybe it is floating when the devices are all off.
If Vdd is 3.3V and Vid is connected to it, SO high should be at least 2.64V.
 
Top