1 Reply Latest reply on Nov 5, 2020 11:57 PM by GaneshD_41

    Changing IMO and ADC Sampling frequencies in code

    MiAu_3808196

      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

        • 1. Re: Changing IMO and ADC Sampling frequencies in code
          GaneshD_41

          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