Hi,
I'm currently working with an MSP430F5419, I'm trying to get a handle on the UCS and in particular tuning the frequency of the DCO while using the FLL to stabilize it. Are there any aplication notes and/or examples with regard to this?
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.
Hi,
I'm currently working with an MSP430F5419, I'm trying to get a handle on the UCS and in particular tuning the frequency of the DCO while using the FLL to stabilize it. Are there any aplication notes and/or examples with regard to this?
Programming the UCS is really straight.
Anyway, there is a sourcecode library that contains HAL functions for setting the UCS. You can check the code for what it does.
It is, however, really not difficult to figure it out yourself. The FLL does most of the job automatically. All you have to do is to select a proper RSEL fo rthe rough frequency range, program the reference frequency and the scaling factor and then wait until the FLL has pushed the DCO to the desired frequency.
Jens-Michael Gross said:Programming the UCS is really straight.
Anyway, there is a sourcecode library that contains HAL functions for setting the UCS. You can check the code for what it does.It is, however, really not difficult to figure it out yourself. The FLL does most of the job automatically. All you have to do is to select a proper RSEL fo rthe rough frequency range, program the reference frequency and the scaling factor and then wait until the FLL has pushed the DCO to the desired frequency.
Well anything is straight forward once you know how, all I was looking for was a bit of guidance.
That's only too true :)Ben Walpole said:Well anything is straight forward once you know how
The users guide explains almost everything. Yet I must admit that it is sometimes too detailed where you don't want it and not detailed enough where you'd like to have more info.Ben Walpole said:all I was looking for was a bit of guidance
Anyway, there is no general 'how to do it', as usage and programming of the UCS depends on what you want to achieve. This can go from 'ignore it and be happy with the defaults' up to complex background tasks for temperature-stabilizing a high-precision clock signal.
You original question was how to tune the DCO frequency and stabilize it by the FLL. Maybe my answer was too short, but I think it was exhaustive. I can try onece more with more detail:
That's all. After at most 32ms, DCO, MCLK and SMCLK are running on 10MHz. (the default for them is DCOCLKDIV, which is the current DCOCLK divided by the FLLD value, which is 0 in this case)
ACLK is per default set to LFXT1, and falls back to REFO if there is no running crystal.
Thanks that exactly what I wanted, you've explained it in much clearer terms than it does in the user guide.
Fine. You're welcome.Ben Walpole said:Thanks that exactly what I wanted
That's mostly because thsi explanation was for one specific usage/setup of the UCS module, while the users guide has to address everything, and for any device of the family (each with its own datasheet and specs), so it has to be more generic. This makes startup more difficult but greatly simplifies porting the code from one family member to another or even across families.Ben Walpole said:you've explained it in much clearer terms than it does in the user guide.
It's however not as complicated as it might look at first. The only thing is that one cannot skip chapters in teh guide because they seem to be of no interest for the current task. That turns out as a big mistake otoo often, as all parts work together this or that way and wihtout understanding at elast the basics of one module, you cannot fully understand the other. Especially clock system and timers or timers and ADC or CPU core description and interrupt management for most other modules, etc.
I have an msp430f5438a and I like your article. Using the defaults my clock is 1048576 Hz and I had the UART running at 9600 really good using your table 32.5 and a timer A1 toggling the output at a tad over 1kHz great stuff. I have moved the clock up to 8388608 Hz with difficulty. The default FLLN divide is 32 and FLLN default is 31=1Fh. To get the higher clock FLLN divide should be 256 and FLLN should be set to FFh, this gave a toggle output at a tad over 4kHz, setting FLLN = 1FFh should have given a 16k Hz output but is was still 4kHz. I eventually set FLLD =0h the default is 1. Now it all works great with the baud rate of 115200 again from table 35.2. Are you sure that there are ten bits in FLLN as only seven of em seem to have any effect? Great chip Ian.
Besides setting the FLL factor, you also have to pick the right frequency range for the DCO. If the selected (with UCSRSELx) frequency range only goes up to e.g. 6MHz and you tell the FLL to drive the DCO to 8MHz, the FLL will push it to the upper limit, but no more. The FLL can’t change the RSEL bits.
This is partly intentional, so in case of a reference problem (e.g. during low-power modes), the FLL can’t push the DCO to unwanted heights, causing a crash.
Note that different MSPs have different resulting DCO frequency ranges for the same RSEL settings. Your target frequency should be above the maximum frequency of the RSEL range for DCOX=0 and below the minimum for DCOx=31. See the tables in the datasheet.
Also, yes, FLLD is 1 by default, running the DCO on twice the target frequency and dividing the DCOCLKDIV output by 2 (which is the default source for MCLK and SMCLK). This reduces the short-term clock jitter introduced by the modulation.
**Attention** This is a public forum