4 years, 10 months ago.

Can I create a deep-sleep wake-up event using the capacitive (TSI) sensor as interrupt on FRDM-KL25Z

I am trying to save battery life and want to see if I can use the TSI sensor (touch sensor) to wake up my FRDM-KL25Z from a deep sleep, but have no idea if this is possible and if it is then how to do it.

2 Answers

4 years, 10 months ago.

As I recall it is, you just need to set it up.. There's TSS library which does not have a license for publishing here on mbed. You can look at it, there's TSI file there in the library, where you can see how interrupt is set up and handled. One channel can be use as interrupt source.

Accepted Answer

According to the user manual it can indeed run in VLPS, which is the mode deepsleep uses.

posted by Erik Olieman 19 Mar 2015

Erik ,it can go even deeper, I recall adding reset routines to TSS for the mode which goes that deep that resets the MCU :)

posted by Martin Kojtal 19 Mar 2015

Yeah but I think for most tasks 10 years on a coin cell should suffice, and it is alot easier programming wise ;). But you are correct, it should work in any mode. And possibly use enough current to make it a bit pointless to go into deeper sleep mode. But you can check that in the datasheet.

You can also set current values to low values.

posted by Erik Olieman 19 Mar 2015

It's all a bit pointless unless the peripherals that have been activated can be shut down and restarted easily, standard Mbed deep sleep API does not do this on the Freescale MCU's.

posted by Paul Staron 19 Mar 2015

Yeah but the TSI itself should consume little. And if he wants it to run in deepsleep, you don't want it to shut down ;).

posted by Erik Olieman 20 Mar 2015

Sorry to say but I'm still scrambling around trying to work out how to implement as information overload. Firstly I have now discovered that there are a number of mbed libraries, which is very confusing indeed.

So all this time I'm trying to work out what to do using TSIsensor library, which offers very basic functionality, when in fact I could have saved so much time if I had started with what appears to be a more comprehensive library tsi_sensor.

So are there functions within this library that could be used or are there any pointers as to which functions within this library could readily be adapted to set this up.

Appreciate any assistance as still on huge learning curve with TSI module and freescale MCU's.

posted by Gerriko IO 21 Mar 2015

download TSS library from Freescale webpage, look at the code base there. I believe there are even some bare metal demos using wake up somewhere shared by Freescale.. I recall frdmklxx demo is part of TSS 3.1, look at that one if you are using KLxx boards .They have simplified TSI module compared to the Kxx MCU.

tsi_sensor and TSIsensor cover basic functionality.

posted by Martin Kojtal 21 Mar 2015
4 years, 10 months ago.

I would suggest firstly to enable the touch sense API and check the deep sleep current consumption, You may find that touch peripheral will draw current in this mode particularly if is set to service the IRQ.

If this is the case then it may be advisable to use a simple digital in pin for the hardware wake up.

The ADC does add 100uA in deep sleep if that peripheral is enabled.

Depending if you need a manual wake up, you could use a timer to wake up that will not add extra current during deep sleep.

Erik's API is a very good example for this and will run in deep sleep @ approximately 3.4uA


That's the catch... does it warrant leaving touch sensor "on" in shallow sleep or do I use an appropriate timer method to wake up periodically. I like your suggestion of using manual periodic wakeup method to check but then the question is, how long does it take for touch sensor to stabilise and provide readings once I've switched back on. Does anyone know? How long should I wait before going back to sleep again.

posted by Gerriko IO 19 Mar 2015

Depends on what your application is. I find its difficult to remove power from the other sensors on the FRDM boards and their regulators are not low IQ so make my own boards. That way I can get the power down to a level that enables me to 'solar power' my projects. I tend to use a combination of dynamic deep sleep modes where the MCU is only awake to update the display and check a few functions. That all happens in 12mS every 10 seconds. So most of the time the MCU is in deep sleep mode. I have a two switch select and set menu function that manually wakes the MCU where I need to.

But if you want really low energy these are the best or will be when added to the Mbed platforms in April.


posted by Paul Staron 19 Mar 2015