A couple of weeks ago I was working on outputting B/W “composite” video with my TI Launchpad. During the project, I needed a way to set the processor clock to a high frequency in order to produce higher picture resolutions.   I also needed precise timing to get the sync signals right.

The result wasn’t great, as I was only able to get a horizontal resolution of about 35 pixels.  I did, however, manage a way to easily set the DCO and processor clock to a speed that was both precise and fast enough to output correct signal timing.  This involved making a few small changes to an existing MSP430 library which didn’t support the newer MSP430G line of microcontrollers.

The library requires an attached 32kHz watch crystal, like the one that comes with Launchpad.  It works by counting the number of DCO pulses per watch crystal pulse.  It then adjusts the DCO and in turn, the MCLK, homing in on the desired frequency.

The old library would check its DCO settings against factory-set values to be sure the chip wasn’t being overclocked.  Since the MSP430G line only has a factory-defined 1MHz DCO setting, there were no predefined maximums to check against, and the function would return an error.  I simply removed the overclock check.  I guess I should warn you it’s possible to overclock and possibly damage your chip with this library, but I’ve been using it consistently for over a month without issue.  On the other hand, it shouldn’t be too hard to intentionally overclock a bit, but I haven’t tried it yet.

I have attached a .zip file containing the library and some example C code.  I don’t have any equipment, so I’d love if  someone could get back to me and let me know how accurately the DCO clocks.

This compiles on Code Composer Studio.

Launchpad MSP430G set DCO library