0
\$\begingroup\$

I am trying to reduce the power consumed by microcontroller pic16f1618, and hence I thought of using SLEEP(). All interrupts such as timer, and pin are disabled. The code is generated with the help of MCC(code configurator). The function call to timer and pin initialization is commented. Microcontroller is running at 16MHz. I am measuring the current consumed by microcontroller under two circumstances.

  1. There is just a main() function after system initialization, there is a code to read a pin inside main(). - current consumed is 8.4mA
  2. There is SLEEP() after reading the pin in main(). - current consumed is 6.6mA

The pic16f1618 is powered through a battery management chip, bq40z60. Multimeter is placed between the voltage source of 12V and the battery chip input voltage. Hence the current measured is a total of current consumed by battery chip and pic16f1618. BQ40z60 consumes a maximum of 1.8mA.

Even though there is reduction in current consumption, it is not significant. The data sheet documents in nA. Considering the pins are not inputs, the current consumption should at least be in uA. Is there anything I need to look into?

\$\endgroup\$
6
  • \$\begingroup\$ What this sleep function is doing? In order to reduce consumption you have to turn off peripherals, reduce the clock frequency and so on. Also where are you measuring the current? Do you have a schematic? \$\endgroup\$
    – Eugene Sh.
    Commented Jun 22, 2016 at 20:24
  • \$\begingroup\$ I will not be able to post the schematic, since it is a custom board and I cannot reveal the schematic. There is a battery management IC, I have my multimeter between source and the input voltage pin of Battery management chip. Without initializing the peripherals, wouldn't the pins be turned off? \$\endgroup\$
    – Abhishek G
    Commented Jun 22, 2016 at 20:35
  • \$\begingroup\$ SLEEP() is a #define for asm("sleep"). This is available in pic.h \$\endgroup\$
    – Abhishek G
    Commented Jun 22, 2016 at 20:37
  • \$\begingroup\$ @SamGibson I am sorry. I can try to improve my description. The battery management chip being BQ40Z60, consumes a maximum of 1.8mA while in normal state. The pic16f1618 is powered through this chip. The source over here is a voltage generator set at 12V. The mulitmeter is between this source and the input voltage of battery chip. So the current drawn would be combining both the battery chip and pic16f1618. \$\endgroup\$
    – Abhishek G
    Commented Jun 22, 2016 at 21:35
  • \$\begingroup\$ @AbhishekG - Thanks. I was going to improve my request and re-post it, but you have replied already :-) You have confirmed one of my suspicions; the measured current is the PIC + something else, not only the PIC. This means that the excessive measured current might not be due to excessive current consumption by the PIC, but might be due to excessive current consumption by the "something else". Yes the BQ40Z60 max current is ~1.8 mA but only if used within its specified parameters and we can't start to check that without a schematic. You've got a good guess from Olin, so I'll stop here. \$\endgroup\$
    – SamGibson
    Commented Jun 22, 2016 at 21:52

1 Answer 1

2
\$\begingroup\$

Almost certainly one or more of your I/O pins are sourcing current. The pin drivers are still on during sleep. If you want the pins to be high impedance during sleep, you have to explicitly set them that way.

Put the processor to sleep and look at all the pin voltages. For any that are high, examine the circuit carefully to see if keeping that line high requires current.

Some peripherals continue to draw power during sleep. For the lowest power consumption, make sure things like the watchdog timer, brownout detect, and the like are off. However, 6.6 mA is a lot for a few peripherals on during sleep. The real problem is pins set high sourcing current, as described above.

\$\endgroup\$
2
  • \$\begingroup\$ I tried measuring the voltage at each peripheral and there are 5 peripherals that are high. These peripherals being an input, a Tx pin, a Rx pin, a PWM pin and SCL pin of I2C. what would be the typical current consumption in a sleep mode with few peripherals being configured as output? \$\endgroup\$
    – Abhishek G
    Commented Jun 22, 2016 at 21:39
  • \$\begingroup\$ @AbhishekG - "what would be the typical current consumption [...]" Look in the PIC16F1618 datasheet; it has some info on this for the various peripheral modules. You can also answer this yourself with a quick breadboard prototype - use your existing code; no attached components to I2C, UART etc; then measure the PIC current during sleep. Also review carefully Olin's suggestion not just about what pins are high, but which pins are sourcing current. Readers here can't give suggestions without a schematic. But if I2C SCL is high during sleep, then imho it is very suspicious for SDA to be low. \$\endgroup\$
    – SamGibson
    Commented Jun 24, 2016 at 12:39

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.