Clock options on the UAV2

Just out of curiousity, I do not quite follow the choice of the external 16MHz clock. In essence this means if you are using the HS setting in FOSC your CPU will be clocked with 4MHz (FCY == FOSC / 4). So your only real choice to get decent CPU performance is to use FRC w/PLL x16. In which case of course you'd loose the precision of having an external crystal.

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • T3
    On a related topic, Thomas thought that the source code for the PWM for my GentleNav firmware produced pulses that were 2-4 milliseconds wide instead of 1-2 milliseconds wide. The code is correct, the pulses are between 1-2 milliseconds wide. Here is the explanation:

    In the dsPIC30F4011, the duty cycle for PWM is measured in half clock cycles, in effect providing one fractional bit.
  • T3
    Thomas,
    Here is a shorter answer.
    The FRC is precise enough. With PLL options, it can be set for 7.5, 30, 60, or 120MHz.
    The external 16MHz clock fills the gap between 7.5 and 30, so there is a choice of FOSC between 7.5 and 120MHz, with each frequency approximately equal to double the next lower frequency. The intention is that you select the frequency that meets your power and processing requirements.
    best regards,
    Bill Premerlani
  • T3
    Thomas,
    The two options of an external 16MHz crystal and the FRC were chosen to combine with the various PLL options to give a wide range of clock frequencies for several choices for balancing computational speed with power requirements. As I am sure that you know, the power drawn by the CPU increases with crystal frequency. The FRC is not as precise as the 16MHz crystal, but it is precise enough for where it is typically used, namely pulse width generation, A/D sampling rate, and baud rate for communications with the GPS. I have tested with the FRC, it works just fine. If, for some reason you need a precise frequency, the FRC has software selectable adjustment.
    For the navigation program that I have been using, I am running with the 16MHz clock without PLL. I measured the CPU loading to be only 2%, so there is still plenty of processing power left even at the slower clock rate. So, I don't think I will ever have to run it at a higher frequency, even when I move to aerobatic algorithms. Also, all of my firmware is written in integer arithmetic. If you decide to use floating point, then you might want to use a higher clock frequency.
    best regards,
    Bill Premerlani
This reply was deleted.

Activity