This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430F5510 and FLL

Other Parts Discussed in Thread: MSP430F5510

Hi,
I'm not sure if i understood correctly how the FLL works. So please follow my consderations and let me know whether

i'm right or not. I want to know the FLL accuracy.

I'm using a MSP430F5510 with a 32768 crystal.

I'm using the FLL with the following settings:
- The FLL reference is XT1 (the 32768 crystal)
- FLL reference divider at 1
- FLLD: Fllrefclock / 4
- FLLN: 30
- DCORSEL = 3

Therefore, in theory, the DCOclok is

32768 x 4 * (30+1) = 4063232 Hz

Now, at page 56 of the datasheet there is the DCO Frequency table.
From that table i can see that for DCORSEL = 3 (which seems the best choice for 4 Mhz frequency):

DCO frequency (DCOx = 0, MODx = 0)          0.64(min)     1.51(max)    MHz
DCO frequency (DCOx = 31, MODx = 0)         6.07(min)     14.0(max)     MHz

So the worst thing it can happen is to have:
DCO frequency (DCOx = 0, MODx = 0) = 0.64 MHz
DCO frequency (DCOx = 31, MODx = 0) = 14.0 MHz
so the frequency range is between 0,64 Mhz and 14 Mhz, with a a span of 13.36 Mhz.

The five DCO bits divide the DCO range selected by the DCORSEL bits into 32 frequency steps of:
13.36 / 32 = 0.4175 Mhz

The worst case is if the frequency i want is exactly in the middle between 2 steps. I know that 4063232 will

probably will not be exactly in the middle, but it's the worst case.

Therefore over many microcontroller my MCLCK will be:
4.063232 +- 0.4175/2 = 4.063232 +- 0.20875 Mhz

Is that correct?

Thanks,
Carloalberto

  • Just a little update in order to explain why i need to evaluate the the FLL accuracy.
    I'd like to implement a software uart.
    So i'd like to know the frequency variation in order to evaluate the frequecy drift in the software uart baudrate.
    I need a baudrate of 19200. Do you think it's possible to do a software uart with a 19200 baudrate?

     

    Best Regards,

    Carloalberto

  • Carloalberto Torghele said:
    Therefore over many microcontroller my MCLCK will be:
    4.063232 +- 0.4175/2 = 4.063232 +- 0.20875 Mhz

    The min/max values are really worst case values. Usually, you'll have a minimum and maximum much closer to each other. But two RSEL settign swill always overlap and the rate of frequency increase is also specified. Additionally, teh steps of the DCO are not equidistant. From DCO_x to DCO_x+1, the increase is also specified. It is more an exponential increase than a linear one.

    But basically you're right. That's why there is the modulation. Modulation lets the DCO run for some ticks on DCO_x and for some on DCO_x+1, giving over a range of 32 ticks an average frequency that is between DOC_x and DCO_x+1. With a significant jitter.

    That's the static DCO configuration.

    The FLL goes one step further. It counts the number of DCO ticks between two reference ticks and adjusts the DCO (inlcuding the modulation) up or down according to the result. So over a longer time period, DCO matches the reference with the given factor. (here I wouldn't go with a x4 divider, but rather increase the factor, as the divider would reduce the adjustment interval)

    When using the internal REFO, the results are good enough so that I can get a reliable 115200Bd connection using the hardware uart.

    Carloalberto Torghele said:
    Do you think it's possible to do a software uart with a 19200 baudrate?

    It rather depends on the absolute MCLK frequency. For 19200Bd, the bit time is 52µs. The FLL update interval (without divider) is 1/32768 = 30.5µs. So for the bit timing, the DCO should be as correct as it can get. On 4MHz MCLK, you have 218 MCLK cycles per bit. So the modulation jitter is swallowed by the long time. Leaves only the jitter between two FLL adjustment steps, which is ~1/32 of two DCO_x steps.
    Also, 218 clock cycles should be enough to do all the calculations. However, a higher MCLK would be better, especially if you want full duplex. And allows doing the job more precisely on sub-bit timing. Letting a capture and a compare unit do the clock-synchronous timing instead of doign it yourself based on CPU cycle counting, will get even more precise results. IIRC, there is an example fo a timer UART implemented in the LaunchPad demo application.

     

  • Thank you for your reply!

    I apologize, I wrote a mistake when i wrote

    " FLLD: Fllrefclock / 4"

    what i wanted to write is

    FLLD: FDCOCLK / 4

     

    After I read your answear, I read again the mcu user manual and the datasheet.

    What i still can not exactly understand it's the modulation. What i can understand from the manual it's that the modulation produce an intermediate effective frequency between F(dco) and F(dco+1), reducing EMC intereference. But is this intermediate frequency the closest value to my target Fdco frequency or it's just a energy spreding for EMI? In other word, can I treat (option 1)  the modulator as other 32 finer frequency steps (between DCO_x and DCO_x +1 there are other 32 finer steps)?  Or is it that (option 2) the Fdco will be for some ticks equal to Fdco(dco_x) and for some other ticks equal to Fdco(dco_x+1)?

    Jens-Michael Gross said:

    But basically you're right. That's why there is the modulation. Modulation lets the DCO run for some ticks on DCO_x and for some on DCO_x+1, giving over a range of 32 ticks an average frequency that is between DOC_x and DCO_x+1. With a significant jitter.

    ....

    Leaves only the jitter between two FLL adjustment steps, which is ~1/32 of two DCO_x steps.

    From the first thing quoted i understand that the right thing it's option 2. But from the second thing quote i would say that the modulation are 32 additional finer steps.

     

    In the datasheet i found the parameter Sdco (frequency step between tap DCO and DCO +1) = fdco(dcorsel,dco+1) / fdco(dcorsel,dco) =  1.02 - 1.12 ratio.

    Therefore the worst case is a 1.12 ratio.

    I know that all the following it's not perfectly correct because you don't know where my frequency is between the taps, but

    at my FDCOCLK = 4.063232 Mhz, there is a space between adjacent taps of about (worst case 1.12 ratio):

    4.063232 * 0.12 = 0.4876 Mhz

    and therefore if you assume that my frequency it's in the middle between two taps, the errore is +- 0.2438 Mhz

    If the modulation consist in 32 finer steps, this number should be divided by 32, that is +- 0.00761875 Mhz.

     

    Last thing.

    In the user manual there is writte "the modulator mixes F(dco) and F(dco+1) for 32 DCOCLK.
    Isn't the update time for the modulator based on FreqFLLref (as the FLL) ?

    There is written that in the worst case, the DCO in order to settle requires n x 32 x 32 x FreqFLLref (where n it's the divider). So I assume that one x 32 is due to the modulator ticks and the other x 32 it's due to that in the worst case you have to scan all the DCO_xs. So from that i would say that also the modulator it's based on FreqFLLref.

     

    Thanks again!

    Best regards,

    Carloalberto

     

     

  • Carloalberto Torghele said:
    What i can understand from the manual it's that the modulation produce an intermediate effective frequency between F(dco) and F(dco+1), reducing EMC intereference.

    EMI reduction is just a side effect.

    Basically, the DCO is an R/C oscillator that oscillates on a base frequency which you can select with RSEL. Then you can switch on several additional resistors that 'tune' it higher.

    What modulation does is with every output tick of the DCO, it switches these 'tuning' resistors to the next higher settign and back based on the modulation pattern, from 0 of 32 tick to 31 of 32 ticks, evenly distributed. So the effective DCO output consists of some longer (DOCx) and soem shorter (DCOx+1) ticks. The resulting average frequency then is somewhere between a full DCOx or DCOx+1 setting.

    Carloalberto Torghele said:
    From the first thing quoted i understand that the right thing it's option 2. But from the second thing quote i would say that the modulation are 32 additional finer steps.

    Any single DCO tick is either DCOx or DCOx+1. But if you divide DCO by 32, the resulting (1/32th) frequency has no jitter anymore. And is a finetuned, constant frequency somewhere between DCOx/32 and DCOx+1/32.

    If you use the DCO for e.g. UART, then you usually have a divider far bigger than 32 and the clock jitter caused by modulation doesn't count anymore.

    The FLL, however, adjusts modulation first, and DCOx only if modulation has reached min or max. So the superimposed jitter caused by the FLL is only a slight change in the modulation and jitter pattern of the DCO, but this change happens only on every reference tick. So it is well in the range of an UART bit clock. Normally not a big problem since it is small. But it is noticeable and should be considered when debugging connection problems.

    Sometimes, switching to a different RSEL setting (the ranges overlap) results in a better modulation/FLL pattern and increases the connection.

    It is even possible to drive the DCo with a frequency far above the maximum for MCLK and only use a divided DCO for them. In this case, the modulation jitter has already been smoothed by the DCO divider.

    Carloalberto Torghele said:
    4.063232 * 0.12 = 0.4876 Mhz
    and therefore if you assume that my frequency it's in the middle between two taps, the errore is +- 0.2438 Mhz

    If you switch from frequency to cycle time, things get clearer.

    let's assume that the output frequency on DCOx is 1MHz = 1µs cycle time. On DCOx+1 it is 2MHz = 0.5µs cycle time (I know that's more than 1.12 :) ).

    Then with a modulation of 0, you'll get 32 clock cycles of 1µ = 32µs total modulation cycle time = 32/32µs = 1MHz.
    With a modulation of 1, you'll get 15 clock cylces of 1µs, one woth 0.5µs and another 16 with 1µs, resulting in 31.5µs total cycle time and 32/31.5µs = 1.01587MHz average frequency (still you only have 1MHz and 2MHz ticks). For modulation = 2 it is 32/31µs = 1.03225MHz. You can see, the second step is bigger than the first.
    With modulation=32, you'll get 32/16.5µs = 1.9393MHz. The last step is 0.0606MHz while the first was only 0.01587MHz. Still each individual tick was eitzher 1MHz or 2MHz.

    Carloalberto Torghele said:
    So I assume that one x 32 is due to the modulator ticks and the other x 32 it's due to that in the worst case you have to scan all the DCO_xs.

    Yes.

    Carloalberto Torghele said:
    So from that i would say that also the modulator it's based on FreqFLLref.

    No, not based on, adjusted by (or modulated by, once you found the best match, as there is a very high probability that you won't find a perfect match but rather an over/undershoot).

    You can halve this time by manually setting the DCO into the middle (or another start value that is near the likely final value, based on experience). Or you can disable modulation, so you spare the 32 modulation steps and wait until the FLL starts steppign back and forth, then enable modulation again to get nearer.
    In theory, the optimum algorithm should be able to rech the perfect result in ~48 reference ticks. However, even worst case is ~30ms only. Which in teh very most applications is not worth mentioning. You only need to know it and wait for this time before you enter any critical timing.

  • Thank you, now everything it's (almost) clear!

    I have just one little doubt that help me undestand if I really understood everything because it seems to me a countersense.

    If i understood correctly DCO_X and MOD_X are updated syncronized with FLLRefCLK while "the modulation pattern" acts every DCO tick (selecting DCO_x or DCO_x+1).

    What's happen if for example I try to get a DCO frequency of 1 Mhz from a 32768 Hz crystal?

    Between 2 FLLRefCLK ticks ( 1 / 32768 = 30,51 us) there is not enough time to run the full "modulation pattern", which it last for 32 DCO tick (32 us).

    Is it a configuration (1 Mhz from 32768 Hz) which has to be avoided?

    Regards,

    Carloalberto

  • Carloalberto Torghele said:
    Is it a configuration (1 Mhz from 32768 Hz) which has to be avoided?

    The update mechanism is a bit more complex than liek I described it. It is not only updated on each REF tick. It is rather updated when either a REF tick happened without the required number of DCO ticks (too slow) or when the required number of DCO ticks happened without a REF tick (too fast).

    But basically you're right, in this constellation, there may be more updates than modulation patterns. However, the increment/decrement of the modulation does not mess things up that much. The pattern is rather squeezed/relaxed, so the maximum effect is one more or less 'high' pulse during the remainder of the pattern.

    Unless you're very sensitive to clock jitter and the jitter of the jitter, you can ignore this.

  • ok, thank you very much! Everything it's clear!

    You are the best!


    Regards,

    Carloalberto

**Attention** This is a public forum