Part Number: MSP430G2453
I expect to see RSELx=15 after loading the factory calibration for 16Mhz operation with s DCOCTL value somewhere mid-range. Found two micros with RSELx=14 and DCOCTL near maximum value to achieve 16MHz. I guess that’s ok if we are not calibrating further – but we are now and hitting the maximum value on DCOCTL.
I think we have the solution (see below) but I would like to know what range of factory cal I can expect and if RSELx=14 is intentional. (looks like a process bug to me).
The system uses 60Hz line frequency sampled over 30 seconds to adjust the microcontroller clock. The process is continuous and will automatically adjust for DCO source changes due to temperature.
Register RSELx for this device select the base frequency range. Typically the value of RSELx is 15.
Registers DCOx and MODx are calibrated values that fine tune the operating frequency inside the range defined by RSELx
RSELx in BCSCTL1, DCO and MODx in DCOCTL are loaded from the manufacturers pre-programed calibration data space at power up. Every 30 seconds of time the captured 60Hz frequency is compared with ideal values and the DCOCTL register is incremented or decremented to bring the clock frequency in line.
Typical values at power up:
RSELx = 0x0F (according to the data sheet this should always be 0x0F)
DCOCTL = 0xAA
Value of the faulting sample:
RSELx = 0x0E
DCOCTL = 0xE0
As the controller heats up the value of DCOCTL must be increased to compensate for the clock drift due to temperature. In the faulted unit DCOCTL was incremented until it wrapped around to 0x00 causing the clock and motor speed to drop. The lower bits of DCOCTL have no effect on the clock frequency above a value of 0xE0 so the code kept adjusting until the register wrapped around to 0.
Simple limits have now been placed on the value of DCOCTL to prevent wrap-around. However that does not solve the adjustment problem. The faulted motor now will loose a small amount of speed as the control heats because the value of DCOCTL is at maximum.
Solution:
Code has been added to detect when RESEL value is 14 and when the DCOCTL value is maxed out (0xE0). If this case is persistent for 60 seconds the software writes RSEL=15 and resets DCOCTL to the mid range value. Continuous calibration then proceeds as normal.
Thanks
Viktorija