Cycle Counting--Too Many

"'Redd, Emmett R' [email protected] [msp430]" <[email protected]> Thu, 17 Sep 2015 14:27:16 -0500
Newsgroups gmane.comp.hardware.texas-instruments.msp430.discuss
Message-ID <[email protected]>
I am using Tom Baugh's MSP430F2274 board and software in a class.  We are also using IAR Kickstart.

In his second lab exercise, BetterNextProject, we see various timing interrupt methods and LPM3 to reduce the number of cycles and power consumed.  Each time the LED output, P1.0, toggles due to a timer firing its interrupt, the SMCLK can be seen making a burst of 28 cycles of running in active mode.  Analyzing the disassembly code and reading the Family User's Guide, I can only account for 24 cycles.

Here are the details:

Action/Instruction (in execution order)          Cycles (from Tables 3-14 & 16 in the Family User's Guide)

            Interrupt Accepted                             6
008094  bic.w #0xF0, 0x0(SP)                         5     // First line of WatchdogTimer_ISR.  All low-power modes cleared.
00809A  reti                                                  5
008050  xor.b #0x1,&P1OUT                          4      // Constant Generator register source to absolute destination. 
                                                                           // This toggles the LED.
008054  jmp 0x804C                                      2      // End of While Loop.

00804C  bis.w #0xD8,SR                                2      // Beginning of While Loop.  Start LPM3.  Instruction immediately    
                                                                 ___     //before the XOR.
Total                                                          24 cycles
 
When I monitor SMCLK on P2.1 on an oscilloscope, it idles high and has 28 falling edges.  In addition, the LED toggles on the 22nd falling edge.  

I count 24 cycles in the code, but measure 28 on the oscilloscope.  (And I count 20 until the end of the instruction toggling the LED but measure it occurring on the 22nd falling edge.

So, what am I missing?

Thanks,

Emmett Redd Ph.D.   mailto:[email protected]
Professor                                 (417)836-5221
Department of Physics, Astronomy, and Materials Science
Missouri State University             Fax (417)836-6226
901 SOUTH NATIONAL                   Lab (417)836-3770
SPRINGFIELD, MO  65897   USA    Dept (417)836-5131

In statesmanship get the formalities right, never mind about the moralities. -- Mark Twain.


------------------------------------
Posted by: "Redd, Emmett R" <[email protected]>
------------------------------------

To unsubscribe from the msp430 group, send an email to:
[email protected]