Changing IMO and ADC Sampling frequencies in code

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

cross mob
MikeAustin
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

Hi,

I have a situation where I am trying to reduce the current consumption when my chip is active (I need it to be able to start up on low input voltages and then go through an initialisation sequence before going into a sleep mode) and I'd like to be able to start up the chip with, say, the IMO set to 4MHz and the ADC sampling frequency set to 1MHz, then, once its gone through its start up, to change these to IMO = 24MHz and ADC sampling = 8MHz for operation thereon.

It seems I can only configure these parameters via the Clock Setup for ADC components within PSOC Creator, and can't modify these "on-the-fly" within my code.  Is that correct?  Or is there someway I can do this in my code so I can adjust things after the start up sequence has been completed.

Cheers,

Mike

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi Mike,

You can set the ADC clock settings in run time using the External ADC clock configuration. For that you have to enable the clock source as External in the ADC component GUI as shown in the image below:

clock_source.PNG

After that you can assign a clock component to the ADC as shown in the image below:

attaching_clock.PNG

Now you can set the clock frequencies in run time using the Clock APIs present in the Clock component datasheet. You can right click on Clock_1 component and get the clock component datasheet.

For changing the IMO clock frequencies in run time you can refer the APIs present in PSoC 4 System reference guide attached with this email.

You can also refer the static void ClockSetup(void) function in the cyfitter_cfg.c file to know how the IMO clock frequency is set.

Please update if you have more queries.

Thanks

Ganesh

View solution in original post

0 Likes
1 Reply
lock attach
Attachments are accessible only for community members.
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi Mike,

You can set the ADC clock settings in run time using the External ADC clock configuration. For that you have to enable the clock source as External in the ADC component GUI as shown in the image below:

clock_source.PNG

After that you can assign a clock component to the ADC as shown in the image below:

attaching_clock.PNG

Now you can set the clock frequencies in run time using the Clock APIs present in the Clock component datasheet. You can right click on Clock_1 component and get the clock component datasheet.

For changing the IMO clock frequencies in run time you can refer the APIs present in PSoC 4 System reference guide attached with this email.

You can also refer the static void ClockSetup(void) function in the cyfitter_cfg.c file to know how the IMO clock frequency is set.

Please update if you have more queries.

Thanks

Ganesh

0 Likes