MPL3115A2 altimeter fails due to software

saunj

Senior Member
I made a board to use as an altimeter on road trips. It has a SparkFun Serial LED display, a Freescale MPL3115A2 on a SparkFun breakout board, and a Picaxe 14M2, all connected via I2C.
On initial power up at 3.3V from a regulated power supply. it drew 10 MA and all voltages were as expected.
The first test program displayed a word counter successfully. Only the display was activated.
On the next step I changed the test program as shown to display the integer part of the altitude.
Then the current draw went up to 30 MA, and tests showed both SCL and SDA clamped at 0.7 V. This is due to the sensor board. All I did was to load the program.
I have not been able to change this. Do I have a dud sensor, or some design problem? I am reluctant to order a replacement without explanation.
 

Attachments

darb1972

Senior Member
So just to clarify, when the current jumped up to 30mA, at that point in time had you connected the sensor board, or was that in play the entire time? If it was connected the entire time, did the current draw increase once you changed the program? Is that also the time at which the I2C lines clamped to 0.7V?

Have you tried disconnecting the sensor board? If so, what happened?

From what I've read above, all you did was change the program in the PICaxe and that's when the trouble started. I'm not even sure how a software change could clamp the I2C bus. Sorry, I'm not near my computer top look at the software. I might get a chance later today but there's plenty of software gurus on this forum who'll probably beat me to it and have more experience than I do.
 

darb1972

Senior Member
I'm not seeing pull-up resistors on you I2C line...do those exist on one of the PCBs?
I don't want to steal the OPs thunder, but they are there. I thought the same thing at first. Each bus line has a 4k7 resistor which is part of a resistor array. The schematic is a bit confusing. Traces crossing each other with some connected and others aren't. There is no "connector" (dot) on the traces that are connected. Hard to follow but I think the schematic is correct.

Maybe the OP should post some photos of the setup so we can double check things.
 

darb1972

Senior Member
John, one thing I did just notice is that there are no resistors on the PICaxe serial in. Even if these are put into play during programming (which you definitely need for programming), not having (at a minimum) a pulldown resistor on this pin might cause all kinds of weird things to happen. Also, pin C.2 is left floating. You might want either a pulldown resistor pin that too or make sure that it's changed to an output in the program very early in the process.

All floating inputs can have all manner of undesirable effects.

Edit: Also just noticed B.1 and B.5 are also floating.
 
Last edited:

saunj

Senior Member
Here is a photo

I don't want to steal the OPs thunder, but they are there. I thought the same thing at first. Each bus line has a 4k7 resistor which is part of a resistor array. The schematic is a bit confusing. Traces crossing each other with some connected and others aren't. There is no "connector" (dot) on the traces that are connected. Hard to follow but I think the schematic is correct.

Maybe the OP should post some photos of the setup so we can double check things.
Here is a photo
 

Attachments

saunj

Senior Member
John, one thing I did just notice is that there are no resistors on the PICaxe serial in. Even if these are put into play during programming (which you definitely need for programming), not having (at a minimum) a pulldown resistor on this pin might cause all kinds of weird things to happen. Also, pin C.2 is left floating. You might want either a pulldown resistor pin that too or make sure that it's changed to an output in the program very early in the process.

All floating inputs can have all manner of undesirable effects.

Edit: Also just noticed B.1 and B.5 are also floating.
I use a programming adapter which contains the recommended circuitry. When in use, a shorting block grounds the SERIN.
The Picaxe works just fine with floating inputs. All pins are inputs by default. C.2 is not used and remains an input.
 

saunj

Senior Member
So just to clarify, when the current jumped up to 30mA, at that point in time had you connected the sensor board, or was that in play the entire time? If it was connected the entire time, did the current draw increase once you changed the program? Is that also the time at which the I2C lines clamped to 0.7V?

Have you tried disconnecting the sensor board? If so, what happened?

From what I've read above, all you did was change the program in the PICaxe and that's when the trouble started. I'm not even sure how a software change could clamp the I2C bus. Sorry, I'm not near my computer top look at the software. I might get a chance later today but there's plenty of software gurus on this forum who'll probably beat me to it and have more experience than I do.
The sensor board was always wired up, the trouble started on programming its code and modifying the display code to display meters on w0. The display stopped updating, so I troubleshot the I2C lines.
If I remove power from the sensor board, the current goes down to 10 MA, but the clamp remains. Removing the SCL and SDA lines with or without removing the Vdd line allows the display to once again function normally.
 

darb1972

Senior Member
I use a programming adapter which contains the recommended circuitry. When in use, a shorting block grounds the SERIN.
The Picaxe works just fine with floating inputs. All pins are inputs by default. C.2 is not used and remains an input.
But without your programming adaptor the serial in is left floating. Based on MANY past posts and issues with inputs (including the serial in), I think you will find it "best practice" to pull all unused inputs LOW. Floating inputs can cause all manner of issues because of unwanted and undesirable noise that can play havoc with a PICaxe input (and any other logic input on logic ICs for that matter). It has been discussed on this forum and many other forums in addition to being mentioned in datasheets and application notes over the entire web.

It's your choice, but in the interests of troubleshooting your issue/s, these are items that can be fairly easily rectified to eliminate them as a possible cause. I'd suggest you at least try to pull these inputs low (a 10k on each unused input would probably suffice).

Edit: You mention that a "shorting block" pulls the serin to ground. Despite the necessity to pull towards ground, I equally wouldn't suggest a dead short to ground. A pulldown resistor is the way to go.
 
Last edited:

darb1972

Senior Member
Thanks for the photo.

Is that a solder "blob" between the yellow and black wires at the front of the photo? If so, is it causing a short? Can't tell for certain from the photo.
 

darb1972

Senior Member
The sensor board was always wired up, the trouble started on programming its code and modifying the display code to display meters on w0. The display stopped updating, so I troubleshot the I2C lines.
If I remove power from the sensor board, the current goes down to 10 MA, but the clamp remains. Removing the SCL and SDA lines with or without removing the Vdd line allows the display to once again function normally.
Ok then something is either wrong with the sensor board itself or with how it is connected/installed. According to the datasheet, this board should only draw about 2mA max. A 20mA draw seems very excessive.

Have you measured the impedance (resistance) with the power off between SCL and Gnd and between SDA and Gnd? What are the readings?
 

hippy

Technical Support
Staff member
The sensor board was always wired up, the trouble started on programming its code and modifying the display code to display meters on w0. The display stopped updating, so I troubleshot the I2C lines.
If I remove power from the sensor board, the current goes down to 10 MA, but the clamp remains. Removing the SCL and SDA lines with or without removing the Vdd line allows the display to once again function normally.
Three possibilities I can see -

1) Floating Serial In pin as others have suggested.

2) The sensor module has become damaged or defective and is pulling the I2C low.

3) There is nothing wrong with the hardware and it's your modified software. Perhaps it's getting locked up because it's not being allowed to continue, disconnecting SCL and SDA returns a $FF reading which allows it to continue. Which would seem to be the case with -

Code:
DO
	HI2CIN 0x00,(b6)
	SERTXD (#b6,13,10)			'gets 0xC1
	LET b6 = b6 & 0x08
LOOP UNTIL b6 > 0
If it really is returning only 0xC1 then anding that with 0x08 will only ever give a 0x00 value which is never greater than zero. That loop simply won't end.
 

saunj

Senior Member
Three possibilities I can see -

1) Floating Serial In pin as others have suggested.

2) The sensor module has become damaged or defective and is pulling the I2C low.

3) There is nothing wrong with the hardware and it's your modified software. Perhaps it's getting locked up because it's not being allowed to continue, disconnecting SCL and SDA returns a $FF reading which allows it to continue. Which would seem to be the case with -

Code:
DO
	HI2CIN 0x00,(b6)
	SERTXD (#b6,13,10)			'gets 0xC1
	LET b6 = b6 & 0x08
LOOP UNTIL b6 > 0
If it really is returning only 0xC1 then anding that with 0x08 will only ever give a 0x00 value which is never greater than zero. That loop simply won't end.
True, I commented out the &
I get 0xC1 with the sensor board connected, 0xFF when disconnected.
 

westaust55

Moderator
For the few occasions when I have not installed the standard programming circuit, I use a 100 kOhm resistor from the SerIn pin to ground.
Sufficient to hold the SerIn pin low during operation and does not affect the ability to connect a programming circuit.

With respect to unused inputs, I have never tied them to ground on my projects.
If there are no traces or wiring connected to act as antenna for RFI and as long as not used in the code then will not have an impact on program execution.
Tying spare inputs to ground is I believe more often associated with trying to achieve minimum power draw particularly for battery powered projects and when the PICAXE is is a “sleep” mode.
 
Top