2 Replies Latest reply on Jun 4, 2011 9:07 PM by jeffrey.nonken

    How to set global resources when there's a conflict

    chen.nate

      Good morning!
      I am using Timer8 and UART modules in my design.Here is the problem:
      in order to use Timer8 to generate a specific time,I have to set the global resources as follows:  sysClk:6Mhz; VC1=sysClk/N:16; Vc2=Vc1/N:15;  VC3 source:VC2;  VC3 divider:100. the VC3 is used as Timer8's clock;
      But in order to use UART modules,I have to get a baud rate of 19200,and i have to set the global resources as follows:  sysClk:24Mhz;
       VC3 source:SysClk/1;  VC3 divider:156. the VC3 is used as Timer8's clock;

         

      so,this is the question,i don't know  how to set the global resources to satisfy the both modules,i really don't know how to solve the problem,hope you can help me ,Thank you !

        • 1. Re: How to set global resources when there's a conflict
          pmad

           Hi,

             

           

             

          Please let me know what is the timing which you want to generate from Timer8 block. You want to source a clock of 250Hz to Timer8 block. There are a couple of solutions for this:

             

           

             

          1. If operation of UART and Timer8 block is mutually exclusive: In this case, whenever you want to use Timer8, at that time you can modify the VC dividers to generate a clock of required frequency. But you cannot change the SysClk, so clock of Timer8 should be sourced from some other module and when UART has to be used VC dividers should be switched back to the normal mode. Please note that both of them cannot work simultaneously.

             

          2. If both of them are supposed to work together, then you'll need another block which should divide the VC dividers to a required clock and then source it to Timer8 block. This would depend on the number of digital blocks your device have.

             

           

             

          Best regards,

             

          Pushek

          • 2. Re: How to set global resources when there's a conflict
            jeffrey.nonken

            As far as I know you can't change SYSCLK, you can only change CPU_CLK's divider.

               

            If you're trying to generate a 250Hz clock for your timer8 you can't do it that way. The lowest value you can get from VC3 is 366Hz. You're either going to have to use two timers, a 16-bit timer or do some division in an interrupt and bit-bang whatever output the timer is supposed to drive.

               

            The good news is that leaves VC3 available for the UART. :)