Hallo!
Ich nutze den MSP430F149 auf dem Headerboard von Olimex und habe auch
erste lauffähige Programme erstellt. Nun habe ich einen 8 MHz Quarz an
XT2 angeschlossen und möchte den MSP damit betreiben; an XIN liegt
immer noch der mitgelieferte Uhrenquarz. Trotz vieler Versuche messe
ich aber nur eine Frequenz von ca. 490 kHz. Ich habe bisher sowohl den
Quarz als auch die zugehörigen Kondenstoren (2X 30pF und 2X 12pF
probiert) gewechselt.Vesorgungsspannung liegt bei 3,3V.
Zur Initialisierung habe ich u.a. den beigefügten Code probiert, der
mit dem msp430gcc kompiliert wurde.
Kann mir jemand weiterhelfen?
Gruß, Daniel
versuchs mal hiermit
void init_Clock( void )
{
// Turning XT1 (32kHz) on
_BIC_SR (OSCOFF); // Turn on XT1
BCSCTL1 &= ~XTS; // LF mode
for (i = 0xFFFF; i > 0; i--); // Time for osc. to set
// XT1 is on
// Turning XT2 (8MHz) on
BCSCTL1 &= ~XT2OFF; // Turn on XT2
do
{ // pruefroutine, ob 8 Mhz-oszillator schon
stabil ist
IFG1 &= ~OFIFG; // OSCFault flag loeschen (zeigt
oszillatorfehler an)
for (i=0xFF;i>0;i--); // warten, ob es wieder gesetzt wird
}
while ((IFG1 & OFIFG) != 0); // OSCFault immer noch gesetzt?
BCSCTL2 |= SELM_2 + DIVM_0 + // MCLK source is XT2, MCLK div is 1
SELS + DIVS_0; // SMCLK souce is DCO, SMCLK div is 1
BCSCTL1 |= DIVA_0; // Divider for ACLK is 1
// At this point we have the following clock configuration:
// MCLK is 8 MHz (from XT2)
// SMCLK is 8 MHz (from XT2)
// ACLK is 32 kHz (from XT1)
}
Das Problem besteht leider weiterhin. Ich habe mittlerweile auch schon
das Headerboard getauscht und auch versucht den Quarz an XIN statt XT2
anzuschließen; natürlich mit entsprechender Anpassung bei der
Initialisierung. Leider hat es alles nichts gebracht und ich erhalte
immer noch nur die Frequenz von ca. 490 kHz.
490 kHz hat der der DCO defaultmäßig, wenn ich mich richtig erinnere.
Die Frequenz muß man direkt am Quarz messen, und zwar an beiden Seiten
um sicherzugehen.
Ich kann den MSP430F149 mit einem 16 MHz-Quarz (nur 7 pF Lastkapazität
u. 1 MOhm parallel) mit mind. 4,0 V betreiben, also 100 % übertakten.
Übrigens schwingen Keramik-Resonatoren schneller an als Quarze.
Cool, das mit den 16MHz habe ich ja noch gar nicht ausprobiert. Aber
lustig, dass man den so gnadenlos übertakten kann.
Die Default-Frequenz des internen DCO ist rund 800kHz.
Die 8 MHz gelten ja für 3,6 V, die auch offizielle maximale
Versorgungsspannung sind und für den gesammten Temperaturbereich
garantiert werden.
Dazu kommen ein paar Prozent Sicherheit und wenn man weniger als 85°C
Temperatur hat und zudem mehr Spannung benutzt, kann man noch weiter
übertakten; das ist ähnlich wie beim Übertakten von PC-CPUs ;-)
Hello to all, I am a student that this programming MSP430f169 for a
project, but I have a small problem with the programming of the clock,
my code for init the osccillator is the following one:
1
voidInitOsc(void)
2
{
3
WDTCTL=WDTPW|WDTHOLD;// Paramos el watchdog timer
4
BCSCTL1|=XTS;// XT1 ~ high-frequency
5
_BIC_SR(OSCOFF);// turn on XT1 oscillator
6
7
do// wait in loop until crystal is stable
8
IFG1&=~OFIFG;
9
while(IFG1&OFIFG);
10
11
BCSCTL1|=DIVA1|DIVA0;// ACLK = XT1 / 8 = 1 MHz
12
IE1&=~WDTIE;// desactiva WDT int.
13
IFG1&=~WDTIFG;// clear WDT int. flag
14
WDTCTL=WDTPW|WDTTMSEL|WDTCNTCL|WDTSSEL|WDTIS1;
15
// use WDT as timer, flag each. 512 pulses from ACLK
16
17
while(~(IFG1&WDTIFG));// cuenta 1024 pulsos XT1
18
19
IFG1&=~OFIFG;// clear osc. fault int. flag
20
DCOCTL|=DCO2|DCO1|DCO0;
21
BCSCTL1|=RSEL2|RSEL1|RSEL0;// MCLK = DCO, 8 MHz (MCLK=Reloj de la CPU)
22
}
And not because he still has to me blocked in the intruccion:
While (~ (IFG1 and WDTIFG));
It is supposed that on having put the Watchdog already not deberia to
enter(approach) of indefinite form, but does it.
Regards to all, I wait for answers
> And not because he still has to me blocked in the intruccion:> While (~ (IFG1 and WDTIFG));> It is supposed that on having put the Watchdog already not deberia to> enter(approach) of indefinite form, but does it.
I'm very sorry, but I don't understand a word of what you are saying.
Perhaps you could rephrase your problem more clearly.
On a sidenote: You do realize that this thread is from 2004, do you?
My problem is that in the instruction "While (~ (IFG1 and WDTIFG)); " it
is blocked, and it doesn't leave the While, and I hoped somebody can
help me.
I thought that to attempt it it could not lose anything, although the
one finishes message was of the 2004:)
Greetings and thank you ahead of time.
1
voidInitOsc(void)
2
{
3
WDTCTL=WDTPW|WDTHOLD;// Paramos el watchdog timer
4
BCSCTL1|=XTS;// XT1 ~ high-frequency
5
_BIC_SR(OSCOFF);// turn on XT1 oscillator
6
7
do// wait in loop until crystal is stable
8
IFG1&=~OFIFG;
9
while(IFG1&OFIFG);
10
11
BCSCTL1|=DIVA1|DIVA0;// ACLK = XT1 / 8 = 1 MHz
12
IE1&=~WDTIE;// desactiva WDT int.
13
IFG1&=~WDTIFG;// clear WDT int. flag
14
WDTCTL=WDTPW|WDTTMSEL|WDTCNTCL|WDTSSEL|WDTIS1;
15
// use WDT as timer, flag each. 512 pulses from ACLK
16
17
while(~(IFG1&WDTIFG));//// cuenta 1024 pulsos XT1 [[infinite cycle]]
18
19
IFG1&=~OFIFG;// clear osc. fault int. flag
20
DCOCTL|=DCO2|DCO1|DCO0;
21
BCSCTL1|=RSEL2|RSEL1|RSEL0;// MCLK = DCO, 8 MHz (MCLK=Reloj de la CPU)
Some hints:
1.) MSP430F169 features two different oscillator inputs XT1 and XT2
In your program you use XT1. Are you sure, you connected the crystal
also to the XIN/XOUT pins and not to XT2IN/XT2OUT ?
2.) Do you use the correct load capacitance for your crystal in the
hardware design ?
3.) Your stabilization loop is almost useless since you must provide
some time for the fault detection circuit to be able to set OFIFG:
1
do// wait in loop until crystal is stable
2
{
3
IFG1&=~OFIFG;
4
for(i=0xFF;i>0;i--);// <-- Add this
5
}
6
while(IFG1&OFIFG);
Without this modification this first loop will immediately exit even if
XT1 is not oscillating at all! If this happens, you will -of course- be
stuck in the second while-loop, because ACLK sourced by XT1 is not
working, so WDT (sourced by ACLK) will never be incremented and will
never set WDTIFG!
Or even I am simulating it with the gdb, and the problem is not in this
while (though already I corrected it), to avoid problems, thanks for the
information Stefan.
Thank you also to you Johnny Maxwell, but to clean the flag after to
initiate WatchDog, the problem does not arrange if that remaining in the
instruction:
1
while(~(IFG1andWDTIFG));//// one counts(tells) 1024 pulses XT1 [[infinite cycle]]
Another thing that has clarified neither the guide of user, nor the
datasheet, it is the capacity and the resistance that I must put in
order that it ranges to 8Mhz, I have not seen any formulates to look for
her someone can to explain it to me?
I strongly recommend that you first check your crystal at XT1.
Because as I stated previously, if there is no ACLK there will be no
WDT-Interrupt Flag!
You can either use the ACLK-output feature on P2.0 or P5.6
or use a general GPIO to be toggled by ACLK and measure the frequency
with an oscilloscope.
>Another thing that has clarified neither the guide of user, nor the>datasheet, it is the capacity and the resistance that I must put in>order that it ranges to 8Mhz, I have not seen any formulates to look for>her someone can to explain it to me?
The load capacitance depends on the crystal and not on the MSP430.
Consult the datasheet of your crystal for the appropriate load
capacitance.
For example AppNote SLAA081 (p.14) from TI specifies a load cap. of 20pF
for a 8MHz crystal. Therefore the recommendation is to use 40pF caps, as
the the caps from XIN to GND and XOUT to GND must be twice the load cap
each!
To what you say without to the capacities that it puts in the datasheet
(http: // focus.ti.com/lit/ds/symlink/msp430f1611 .pdf) pag37?? If they
are to this to that you refer if ls I have puttings and in my case for
using HF they are of 2pF (I have a comecada XIN-GND and another
XOUT-GND).
Even I continue without seeing problem of the while, any occurrence
to small that is to comment on her(it).
Thanks and regards to all!!!
Sorry, I only understand railstation (joking :-))
The 2pf mentioned in the datasheet is the internal (stray)capacitance
inside the MSP430 for XT1/2 in HF mode (by the way there is 12pf inside
for XT1 in LF mode, so you wouldn't need additional C's if you use a
watch crystal 32kHz).
You will need additional external C's (with adequate value according to
your crystal) which will add to the internal ones in parallel (so their
values will add).
I Don't understand, if I have to put other values of capacity in XIN and
XOUT, where I look for the it formulates that me of the approximate
values of those condensers??
My inexperience in killing me. jejeje
Greetings!!!
>where I look for the it formulates
There is no formula!
The crystal manufacturer defines the load capacitance needed for the
specific crystal. This is statet in the datasheet of the crystal!
>the approximate values of those condensers??
If you don't know the exact type of crystal you use, then you might
compare several manufacturer's datasheets to get an idea about the range
of load capacitance needed. I suppose almost all 8MHz crytals have
similar requirements.
The formula is:
C = 2* (Cload-Cpin)
C: each Capicator at XIN and XOUT
Cload: Load-Capicaty demanded by the crystal (found in crystal
datasheet
Cpin: parasitic capacity at the pins of the MSP430 (appr. 2 pF)
Then I will need for it formulates it of Christian R." 2 capacities
of approximate mind of 16,4pF.
But does it put that it is a glass of 32.768kHz, it will serve this
capacity so that it works at 8MHZ??
>finally I understand it
No, you do not ...sorry!
Your link describes a low frequency watch crystal (32kHz).
Such crystals can (normally) be operated with MSP430 without additional
C's, because these are already integrated in MSP430, but you then have
to activate the low-frequency mode (LF) in BCSCTL1 (XTS cleared).
You cannot operate this watch crystal with 8MHz !!!
Please refer to the datasheet of your crystal !!!
If I use crystal internally, I Can to have these characteristics
(http://www.ecsxtal.com/store/pdf/csm_7.pdf), and then I should put a
capacity of 36 pF in XIN and XOUT. I expect to go catching on little by
little. I greet and thanks.
Trotz des alten Threads muss ich das Thema nochmal aufgreifen:
Ich habe hier ein MSP430F2274 und will den aktuell angeschlossenen
32k-Quarz durch einen 8 MHz-Quarz ersetzen, welcher wiederum nicht mehr
ohne die Kondensatoren am Xin und Xout auskommt. Welche größe müssen
diese Kapazitäten sein, damit der Quarz sauber schwingt?
Ich habe ein Referenzdesign einer Platine gefunden mit einem 16
MHz-Quarz dort wurden 22 pF-Kondensatoren eingesetzt. Gehen die auch bei
8 MHz oder sollte die Kapazitäten besser 18, 15, 12 oder gar nur 10 pF
groß sein?
Edit:
Dies hier ist der besagte Quarz
http://de.farnell.com/jsp/search/productdetail.jsp?CMP=i-ddd7-00001003&sku=1216212
Ist der als "Kapazität, Last:10pF" im Datenblatt angegebenen Wert meine
gesuchte Größe oder etwas völlig anderes?
Danke
MfG Denis
Je tiefer die Frequenz, desto größer dürfen die C's sein. Was bei 16 MHz
schwingt dürfte auch bei tieferen Quarzfrequenzen schwingen.
Verkleinerung der C's begünstigt das Schwingen eher. Nur wird dann der
Einfluss der nicht genauen C's zu groß (C-Leitung und C-ein des
Kotrollerpins).Man sollte also bei den 22pF bleiben.
Jeder Quarz schwingt auch bei andren Werten der Lastkapazität (der
Kapazität, die zwischen den beiden Quarzanschlüssen richtung Oszillator
"zu sehen" ist). Nur gibts dann eine Frequenzabweichung (max. ca. 300ppm
= 0,003%) die aber bei Kontrolleranwendungen normalerweise keine Rolle
spielt.
Ob 10pF Lastkapazität oder nicht wäre nur für sehr genaue Frequenz
wichtig.
Norman Freitag schrieb:> Ist der als "Kapazität, Last:10pF" im Datenblatt angegebenen Wert meine> gesuchte Größe oder etwas völlig anderes?
Nein, das ist die Kapazität, die der Quarz gerne als Last hätte. Er
"sieht" die beiden Kondensatoren aber in Reihe geschaltet, parallel dazu
die geringe Streu-Kapazität der Anschlusspins, Leiterplatte usw.
Der Wert jedes der beiden Kondensatoren muss also etwa das doppelte der
vom Quarz geforderten Last-Kapazität sein. 22pF kommen im dem Fall also
schon ganz gut hin.
Wieviel mal hab ich das eigentlich schon vorgebetet hier? Man müsste
echt mal nachsuchen...