So I recently ran into great trouble with a header file for the MSP430, I think it's in almost every header which actually uses calibration values for DCO. In my specific project I used a MSP430F2122.
So what my problem was (but the root still remains), I tried to set the DCO to it's calibrated 1MHz frequency. An easy task. Just set BCSCTL1 and DCOCTL accordingly like:
BCSCTL1 = CALBC1_1MHZ;
DCOCTL = CALDCO_1MHZ;
Now if you are using the auto-completion feature of Code Composer Studio v4 you will notice (or not as in my case) that you'll most likely use this:
BCSCTL1 = CAL_BC1_1MHZ;
DCOCTL = CAL_DCO_1MHZ;
Now this is totally wrong. If you take a look in the header you will see:
#define CAL_DCO_1MHZ (0x0006) /* Index for DCOCTL Calibration Data for 1MHz */
SFR_8BIT(CALDCO_1MHZ); /* DCOCTL Calibration Data for 1MHz */
So the meaning of them is quite different. But the name of both won't tell us. In the special case of 1MHz the offset values give roughly a frequency of 1MHz, which makes debugging even harder. I used this for a serial communication, and the bytecount was correct but some bits had randomly errors. As I replaced the MSP because I thought it was damaged during soldering, the next one worked correctly.
I soldered another four boards and well they all didn't work. Handsoldering QFN parts is a bit tricky but I never failed four times in a row and not in such a way (as it's half working). So after scoping the serial transmission I found out it took too long, so the frequency was off. I investigated and found out about these two defines (well more or less defines) which had basically the same name but a different meaning.
So what I really would like to see is a clear difference in naming defines, I don't care about long names, just make it as clear as possible what this thing defines. Call it CAL_DCO_1MHZ_FLASH_INDEX or something like that, so that it's obviously the wrong thing to put into the control register. I don't want to imagine a product which actually writes the offset into the registers and works half of the time.