Hi guys,
let me ask for some help here. I've read in the forums the DCO in the MSP430F2350 (sorry, I usually work with 8051) may have a frequency from 0.4MHz to 2MHz depending on several factors as the voltage and the temperature when starting.
I have an external chip which, after sending a SPI command to it, you have to provide 65 pulses of the frequency you wanna set it to oscillate.
// set MSP frequency
BCSCTL1 = CALBC1_1MHZ;
DCOCTL = CALDCO_1MHZ;
.....
// start for 65 calibration pulses
while(calibration_steps--) {
P3OUT ^= BIT3;
__delay_cycles(6);
}
The callibration procedure is done, because I see a change in the oscilloscope after doing it :) No problem till the moment.
Unfortunately, I would wish always the same frequency, and, perhaps due to that voltage things (the voltage in the battery is lower after some time) the callibrated value is not always the same. In fact, it varies between 28kHz and 30kHz between different runs.
Do you have a hint about how to better achieve this? I guess the __delay_cycles is NOT the best option. We are also contemplating using a 28kHz crystal but it would be nice to know the best way to do this in software, as well as what am I doing wrong.
Thanks a lot for your time!