6 years, 2 months ago.

Need help with saving power, i.e. down clock for LPC1768

Hello everyone!

I am developing small project with my mbed LPC1768 005.1.

It is about reading from 2 temperature sensors MLX90615 via I2C @ 25khz, every 15 (20 also will do) minutes, log data to flash memory. Between readings, device should save power as much as possible. Device should operate 30-48 hours, from 9V brick battery, noname (as I'm in small town far from big towns, no alkaline battery available).

Semihost disable - I will be using it, but I should learn timings to disable it before sleep and enable again to be able write log data.

I learned about PHY powerdown and applied it. Some peripherals also powered off (I made small excel file to make easier switch on/off necessary peripheral, but couldn't share it here, even as ZIP file. Can I use file sharing services?).

But despite all my research here, I couldn't find out how to run processor clock at lowest value possible. 48, 24, 12Mhz - how I can achieve that?

Also trying enable and use RTC with 3.3V battery, so it can keep time and program could read time and log it too.

Also should mention that: I am using gcc4mbed (thanks to all wizards who made it possible), it helps me very much here, when I have no internet.

below my pseudocode (I will clean out and share it via mbed site when i will have better connection):

  1. include "mbed.h"
  2. include "string.h"
  3. include "stdlib.h"
  4. include "ClockControl/ClockControl.h"
  5. include "PowerControl/PowerControl.h"
  6. include "PowerControl/EthernetPowerControl.h"
  1. define USR_POWERDOWN (0x104)

PHY_EnergyDetect_Disable(); PHY_PowerDown();

Peripheral_PowerDown(0x09426B2E);

Some Thoughts. AA batteries have a lot more mAhrs in them - say 2850mA vs 650mA for the 9V battery. If you a rolling your own board AA's would be better. But I guess the devboard requires 4.5V min in, so if you are using that it's trickier.

I have not used this micro, but the Clock must be set at power on as part of the startup sequence. Since you are running gcc offline, I suggest you do a debug build and manually step through every line of startup code. If you do this you will of course bump right into the clock configuration code. Looks like it is the system_LPC17xx.c file. Cross reference this with the micro datasheet (clock section) and you should be able to figure out how to adjust PLLs to lower the clock frequencies. https://github.com/ARMmbed/mbed-os/blob/master/targets/TARGET_NXP/TARGET_LPC176X/device/system_LPC17xx.c

Lowering the frequency may or may not help given that you are putting it to sleep anyway. Lower frequency may just take longer to do the work when the device is awake. I suppose testing would be in order.

posted by Graham S. 16 Feb 2018

Regarding battery, I found laptop 6 cell battery, plan to open it and use 3 cells sequentally to get something between mentioned 4.5V and 5.4V. I was sticking to 9V battery due to size and weight. Device I'm building is "wearable" proof of concept, so I can't ask user to carry 2-3 kg 12V 9Ah battery :)) I could find file you mentioned, now I will have to figure it out how to use it in my project. Thanks for your comment and advice.

posted by Hyperione One 16 Feb 2018
Be the first to answer this question.