Peter A. Bigot - 2013-03-14

Further research indicates that TI's compiler tools have this fixed with code generation version 4.1.3 and beyond. Note that ccs-5.2.1 uses tool version 4.1.1.

This problem has been reproduced in code that does the following when TA0
has a pending interrupt at the point the interrupt is enabled.

mov &TA0R, r15

This code can be generated with something like:

while (1) {
  unsigned int t0, t1;
  t0 = TA0R;
  t1 = TA0R;
  printf("Time difference %u\n", t1-t0);

Inserting __nop() between the __enable_interrupt() and the while(1) fixes the bug. The bug is due to CPU42. msp430mcu does not currently provide MCU erratum information to the compiler, but doing so wouldn't help since TI's provided devices.csv does not include information about CPU42.