How to measure consumption of individual (sub)systems in PSoC

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
MuKa_284621
Level 3
Level 3

 Hello,

   

 

   

I've been trying to find a way to measure the consumption of each individual components in the PSoC 5LP. The most logical way that I thought about is to enable ONLY that component (and NOTHING ELSE) and measure the consumption.

   

 

   

And this is where the problem comes in. How exactly do you do that?

   

 

   

I've done some reading and I stumbled across this in cyfitter_cfg.c :

   

 

   

/* Enable UDB array */

   

CY_SET_XTND_REG8( (void CYFAR *)CYREG_PM_ACT_CFG0,

   

                  CY_GET_XTND_REG8((void CYFAR *)CYREG_PM_ACT_CFG0) | 0x40u );

   

 

   

CY_SET_XTND_REG8( (void CYFAR *)CYREG_PM_AVAIL_CR2,

   

                  CY_GET_XTND_REG8((void CYFAR *)CYREG_PM_AVAIL_CR2) | 0x10u );

   

 

   

I did some research on what CY_SET_XTND_REG8, CYREG_PM_ACT_CFGx and CYREG_PM_AVAIL_CRx are, and this is what I understood :

   

 

   

> CY_SET_XTND_REG8 is a method used to write to registers

   

> CYREG_PM_ACT_CFGx are a set of registers used to enable/disable specific subsystems (UDB, clkdist, analog if, etc.)

   

> CYREG_PM_AVAIL_CRx are a set of registers used to make specific subsystems available/unavailable (more or less the same subsystems as above)

   

 

   

So far, I though of using all zeros (0x00) as the second argument in the CY_SET_XTND_REG8 method to disable certain registers that are not used (example, comparators). But is that the way to go?

   

 

   

And what is the difference between CYREG_PM_ACT_CFGx and CYREG_PM_AVAIL_CRx since it looks like they both do more or less the same thing?

   

 

   

My references are the TRM, Systems Ref Guide, Register Map and the generated code (cyfitter_cfg.h).

0 Likes
7 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Is there any reason why you do not trust into the datasheets?

   

For nearly each module there is a start() function, and some have additional power-saving states which you can send them into with the sleep() APIs.

   

 

   

Bob

0 Likes
MuKa_284621
Level 3
Level 3

 Hello Bob,

   

 

   

For the time being, I don't have any components in the Schematic (i.e. the Schematic is blank).

   

 

   

I just compiled that to have the source codes.

   

 

   

Yes, I do know that each components have a <comp_name>_[Start|Stop]() function. I will take that into account when the Schematic is populated in the future.

   

 

   

But just for the time being, I was thinking of how to turn off everything else. For example, if I had only one DelSig ADC in the Schematic, I would like to turn off the CPU, UDB, Flash, etc. and leave only the DelSig ADC running with the necessary resources (clocks, etc.).

   

 

   

They did mention that the CPU can be stopped. Is that using the low-power modes?

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Use CyHalt() API, it executes a BKPT-instruction.

   

 

   

Bob

0 Likes
MuKa_284621
Level 3
Level 3

 Alright.

   

 

   

Thanks, I'll try and see if I could get any more results. I'll keep this thread updated when I get one.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

This might be useful -

   

 

   

    

   

          

   

http://www.cypress.com/?docID=44199     AN77900

   

 

   

Regards, Dana.

0 Likes
MuKa_284621
Level 3
Level 3

 Hello again,

   

 

   

I've fixed my problems for this one. It turns out that there are APIs for turning off components like clocks, etc.

   

 

   

But I have one weird remark.

   

 

   

When I try to turn off certain components that is not used in the design (for example, the analog routing pump) using its API, the global consumption increases. And when I comment or delete this line of code in the main, the consumption falls back down.

   

 

   

Any ideas why that is so?

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

You might consider posting a CASE on this and when you get answer

   

posting back on forum for everyone -

   

 

   

    

   

                    

   

To create a technical case at Cypress -

   

 

   

www.cypress.com

   

“Support”

   

“Technical Support”

   

“Create a Case”

   

 

   

You have to be registered on Cypress web site first.

   

 

   

Regards, Dana.

0 Likes