# Microcontroller Current Consumption when different internal and external clock modules are used simultaneously

#### FreshmanNewbie

##### Member level 2
I am using this Microcontroller - S32K142 64 pin.

From the Figure 4 in this Application Note, We can see there are 4 clock sources for the Microcontroller.

FIRC - 48MHz

SIRC - 8MHz

SOSC - 4-40MHz

LPO - 128kHz

SPLL - 112MHz

From the clocking tree diagram, Figure 4 in the application note attached, I can see that the core clock frequency of the Microcontroller can be derived from any one of the sources like FIRC, SIRC or SOSC and can be upconverted with the help of the SPLL.

My questions :

1. What is the maximum core clock frequency that the microcontroller SPLL can provide? Is it the 112MHz from the SPLL?
2. Objective is to calculate the current consumption due to different peripherals (Like I2C, SPI etc) and their clock module sources (like if I am using FIRC, SIRC and SPLL simultaneously)
Regarding current consumption - Suppose I use the 112MHz as the core clock frequency of the microcontroller i.e.HSRUN mode, from Table 13 of the datasheet,I get that, at 25degC, the current due to the oscillator is 112*360uA = 40.32mA? Isn't this a very high value? Am I correct in calculating the oscillator current, this way?

So, If I enable all the peripherals in HSRUN mode, my total microcontroller current consumption would be 52.2mA+40.32mA = 92.52mA. Is this correct?

But I am confused like, what about the current consumption due to FIRC & SIRC usage(suppose if I use FIRC & SIRC clock source also)? Suppose, I also use the FIRC module for some other peripherals, say like SPI at 48MHz. What would be the current consumption due to the FIRC module usage? Would it be 48*360uA = 17.28mA? And I use the SIRC for I2C Interface (downconverting the 8MHz SIRC to 400kHz). How to calculate the current consumption due to SIRC source?

(The 40.32mA current was only due to the HSRUN mode which derived its frequency from a external resonator of 8MHz and upconverted to 112MHz by the SPLL). So, should I add the currents as I am using 3 different clock sources (FIRC, SIRC and SPLL)?

Please help to clarify - to calculate the current consumption due to different clock source (FIRC,SIRC and SPLL) module usage and peripheral module usages?

##### Full Member level 4
You could always write a simple routine to try the different clock sources
and measure Idd on the part. A fast way of getting answers.

Regards, Dana.

#### KlausST

##### Super Moderator
Staff member
Hi,

I assume (but to be honest I didn't go deeply through the datasheet) the values in the table 13 us the total current consumption.
You just need to use the "uA/MHz" value when your frequency differs from the given frequency.

Klaus

#### FreshmanNewbie

##### Member level 2
Hi,

I assume (but to be honest I didn't go deeply through the datasheet) the values in the table 13 us the total current consumption.
You just need to use the "uA/MHz" value when your frequency differs from the given frequency.

Klaus
Thank you for the answer. If I use FIRC, SIRC and the SPLL Clock sources, does each clock sources consume current? If so, how to calculate them?

#### KlausST

##### Super Moderator
Staff member
Hi,

I'm a bit confused. Please tell me. You use all this three clock sources at the same time.
But only one can be used to run the microcontroler. Or am I wrong here?

Or what is each clock source used for?

Klaus

#### FvM

##### Super Moderator
Staff member
Most of the power consumption is caused by running controller resources (core, memory and peripherals) at a certain clock speed. In addition each activated clock source is consuming some power on its own. Not sure if it makes sense to run multiple clock sources simultaneously with this controller. If so, the power consumption will more depend on the actual clocking speed of each resources than the clock source.

I presume that the manufacturer documents allow to calculate expectable power consumption in advance, but you probably want to check it in real hardware.

#### KlausST

##### Super Moderator
Staff member
Hi,

And usually the actual consumption depends on code.
I assume a NOP consumes the least power.

Klaus

#### FreshmanNewbie

##### Member level 2
Hi,

I'm a bit confused. Please tell me. You use all this three clock sources at the same time.
But only one can be used to run the microcontroler. Or am I wrong here?

Or what is each clock source used for?

Klaus
I am thinking like, let's assume the Microcontroller core is operating at a speed of 80MHz. I am using the SPLL for this

And I am using a SPI peripheral which requires a speed of 8MHz. For this, I am using the FIRC Clock which is 48MHz and dividing it. (Yes, I know I could SIRC for this. But let's us assume I am assuming the FIRC only for this)

And also, I am using a I2C peripheral which requires a speed of 400kHz. For this, I am using the SIRC Clock which is 8MHz and dividing it.

So, in the above scenario, I am using the SPLL, FIRC and SIRC clock sources for different functions. In this case, does each clock source consume individual current and all are operating simultaneously.

So, in this case, how to calculate the current consumption due to the different internal clock sources which are running simultaneously?

#### FvM

##### Super Moderator
Staff member
For the many processors, the information is in the reference manual and datasheet. If not, make a measurement.

#### KlausST

##### Super Moderator
Staff member
Hi

But all microcontrollers I know are happy with just one clock source and all periferals can be driven from it.

Isn't this possible with your microcontroller, or why are you using multiple clock sources?

Klaus

#### Carry for cents bazar

##### Junior Member level 1
There is a possibility to switch between clock sources, but its not necessary in all cases. As for the current consumption, if its not written in the datasheet, you can only measure it.

#### FreshmanNewbie

##### Member level 2
Hi

But all microcontrollers I know are happy with just one clock source and all periferals can be driven from it.

Isn't this possible with your microcontroller, or why are you using multiple clock sources?

Klaus
I am not going to actually use multiple clock sources. Just want to understand theoretical concepts like what would happen in such cases

##### Full Member level 4
This is the clock domain overview for one series of ARM cores (M3). As you can see it consists
of multiple sources derived from oscillator and PLL sources.

Regards, Dana.

#### Carry for cents bazar

##### Junior Member level 1
In other words, it depends on the internal or external hardware/ circuit/ module that is used. Processors may look like 1 chip, but inside there are many transistors, memories, modules and others.