I'm using a PIC24F to interface with an SD card in SPI mode. When the card is idle, the device still draws ~200 uA of current which is unacceptable for this device's purpose. To correct this, I am using a bit-enabled Linear Regulator (NCP694H33HT1GOSCT-ND) to kill power to the SD card's power rail. However, the leakage current remained at ~200 uA even when the SD card's power was cut off. Then I realized that upon physically disconnecting the wires for the SPI clock and Data In to the SD card from the PIC, the current drops down to ~10 uA, which is very acceptable.

So, I am assuming that power is somehow leaking through the PIC24F and the signal lines to the SD card. I have tried reconfiguring those pins as digital outputs set to 0 and as digital inputs, but neither methods have had the same results as physically disconnecting those two lines.

Is there something I'm missing here? I would think that being set as a digital inputs would result in those pins becoming high impedance and thus blocking out the excessive leakage current, but it doesn't seem to be working. Any help would be appreciated.


1 Answer 1


I believe your assumption is correct in that the card is leaking current from the signal lines.

Did you ensure that the PIC did not have its weak pull-ups active when you modified the port settings?

  • \$\begingroup\$ I am using macros (which have previously worked in correctly setting up ports) to modify the port settings. For example, DISABLE_RA0_PULLUP(); sets the _CN2PUE register bit to 0. Then I set _TRISA0 = 1 and _PCFG0 = 1. Does that seem correct? Are the PIC's pull-ups notoriously weak? I was unaware of that. \$\endgroup\$
    – James
    Commented Feb 6, 2011 at 22:38
  • 1
    \$\begingroup\$ You want the pull-ups to be weak if you're not disabling them. The problem is that you're trying to bring the SCK and MOSI lines higher than their (0V) VCC, so there's a current path from VCC, through the internal pullups, and out through the diodes internal to the SD card. \$\endgroup\$ Commented Feb 7, 2011 at 15:26
  • \$\begingroup\$ Well, I am definitely disabling the pull-ups, but it is not correcting the issue. There is still a significant amount of current leakage through the SCK and MOSI lines. \$\endgroup\$
    – James
    Commented Feb 17, 2011 at 20:18
  • \$\begingroup\$ Is the leakage equal between SCK and MOSI, or more so one than the other? \$\endgroup\$ Commented Feb 18, 2011 at 3:44
  • \$\begingroup\$ Well, I tested them simultaneously with 2 different types of ammeters and I'm afraid that they may have had slightly different impedances. I was getting ~80mA on one line and ~120mA on the other. However, I can't remember which is which. I assumed they are very close to equal. \$\endgroup\$
    – James
    Commented Feb 18, 2011 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.