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.
I believe that the ACLK on my MSP430FG4618 does not work or needs re-calibrating. Is there a way to reset to factory settings?
Now you are changing subject, you have already a couple of thread’s with this question open. Continue with one of these, but in the mean time you can check if you power-up your board correctly, battery or AC-mains with the proper jumper settings, and not powered by FET.
Why not FET? That is how its powered at school. Here is a picture of the target board .
Here is my C code. This works at school.
#include <msp430xG46x.h> #define SW1 BIT0&P1IN #define SW2 BIT1&P1IN void main(void) { WDTCTL = WDT_MDLY_32; // WDT is clocked by fSMCLK - 32ms interval (default) P5DIR |= BIT1; // Set P5.1 output direction (LED4) P5OUT |= BIT1; // Turn of LED4 P3DIR |= BIT5; // Set P3.5 output direction (SP1... Speaker) P3SEL |= BIT5; // Turns off SP1 IE1 |= WDTIE; // Enable WDT interrupt _EINT(); // Enables global interrupts TB0CCTL4 = OUTMOD_4; // TB0 output is in toggle mode TB0CTL = TBSSEL_1 + MC_1; // ACLK is clock source (32,768 Hz), UP mode TB0CCR0 = 31; // f = 32,768/(2*31)... 'C' note / 523.25 Hz TB0CCR4 = 1; // set count value _BIS_SR(LPM0_bits + GIE); // CPU off while (1) { if((SW1) != 0 && (SW2) !=0) // Neither SW1 or SW2 is pressed { TB0CCR0 = 31; // f = 32,768/(2*31)... 'C' note / 523.25 Hz } if((SW1) == 0) // SW1 is pressed { TB0CCR0 = 28; // f = 32,768/(2*28)... 'D' note / 587.33 Hz } if((SW2) == 0) // SW2 is pressed { TB0CCR0 = 25; // f = 32,768/(2*25)... 'E' note / 659.26 Hz } } } // Watchdog Timer interrupt service routine #pragma vector=WDT_VECTOR __interrupt void watchdog_timer(void) { static int i = 0; i++; if (i == 16) { // 1/2 second on, 1/2 second off (31.25 * 16 ms = 0.5s) P5OUT ^= BIT1; // Toggle P5.1 using exclusive-OR i = 0; } }
Can you clarify what doesn't work?San Badger Dude said:My program uses ACLK for timing purposes to operate the buzzer. It works at school but not for me at home on my board. My PC's COM port is set the same as school.
E.g. does the buzzer not sound, sound at the wrong frequency, or something else?
San Badger Dude said:Why not FET? That is how its powered at school
And that’s exactly the difference with your school! Maybe the new FET gives for some reason a too low voltage for the buzzer. Why not try that?
Buzzer does not sound. Let me also mention that based on the code above an LED is to blink 1/2 sec on 1/2 sec off. It does blink but slower than 1/2 sec on 1/2 sec off.
Still nothing. I did get a sound from the buzzer using the SMCLK. Found this just to test buzzer. I need ACLK to work though.
#include <msp430xG46x.h> void main(void) { WDTCTL = WDTPW+WDTHOLD; // Stop WDT P3DIR |= BIT5; // P3.5 output P3SEL |= BIT5; TBCCR0 = 436-1; // PWM Period TBCCTL4 = OUTMOD_7; // CCR4 reset/set TBCCR4 = 218; // CCR4 PWM duty cycle TBCTL = TBSSEL_2+MC_1; // SMCLK, upmode _BIS_SR(LPM0_bits + GIE); // CPU off }
I got it! I don't understand completely but maybe someone can explain... I added the following line of code to my original program and it worked:
FLL_CTL0 |= XCAP14PF;
The software-selectable XCAPxPF bits configure the internally provided load capacitance for the LFXT1 crystal. The circuit diagram for the MSP430FG4618/F2013 Experimenter’s Board shows that no external load capacitors are fitted for the LFXT1 Oscillator.San Badger Dude said:I don't understand completely but maybe someone can explain... I added the following line of code to my original program and it worked:FLL_CTL0 |= XCAP14PF;
Section 5.2.3 LFXT1 Oscillator of the MSP430x4xx Family User’s Guide states:
Therefore, by not selecting any internal load capacitance for the LFXT1 crystal the crystal may not operate reliably.The default value of XCAPxPF is 0, providing a crystal load capacitance of ~1 pF. Reliable crystal operation may not be achieved unless the crystal is provided with the proper load capacitance, either by selection of XCAPxPF values or by external capacitors.
The part number for the 32.768 KHz crystal on the MSP430FG4618/F2013 Experimenter’s Board is not given, so am not sure what load capacitance the crystal requires. However, the FG4618_RTC.c code in MSP430FG4618/F2013 Experimenter’s Board Software (Rev. C) does use XCAP14PF:
FLL_CTL0 |= XCAP14PF; // Configure load caps
Which suggests XCAP14PF is the required load capacitance to get reliable operation of the crystal.
**Attention** This is a public forum