This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/MSP430G2744: GIE disable/enable not working as expected

Part Number: MSP430G2744

Tool/software: Code Composer Studio

Hello all,

I have a short section of code which absolutely must not be interrupted. Therefore, I wrapped it with a __disable_interrupt; and a __enable_interrupt(); statement. To my surprise, this code segment was still being interrupted! To see if the __disable_interrupt line was functioning correctly, I opened the Registers view in CCS and observed SR while stepping over the __disable_interrupt line. I saw that the GIE bit in SR remained set. As I continued stepping, GIE was cleared only when the processor entered the interrupt. However, GIE is automatically cleared on entering an interrupt, and set on exit, correct?

Why are these intrinsic operators not working for me? Is there a way to set and clear this bit directly, as I would for PxOUT for instance?

I'm using CCS 7.4.0.00015 for Mac. If you need any further information, let me know! Thanks in advance.

  • Here is a screenshot. As you can see, I have stepped over the __disable_interrupt() line and GIE remains set.

    It turns out that if I set a breakpoint on the __disable_interrupt() line and then step over it, the GIE bit is unaffected, as shown. However, if I set a breakpoint on the following line and the program runs over the __disable_interrupt() instruction before halting at the breakpoint, the GIE bit is cleared as expected.

  • Hi Evan,

    First, did yo mean to mark this post as answered? Or was this an accident?

    As for the GIE bit, when you set a breakpoint at the __disable_interrupt() line and then step over it, you are messing up the timing, which likely is why you are not seeing the GIE bit being cleared. When you set the breakpoint at line 110, you run over the __disable_interrupt() line in real time, so that fact that you see the GIE bit being cleared there suggests that everything is working properly.

    Regards,
    Nathan
  • Hello Nathan,

    Thanks for your reply. Yes, shortly after I posted the question, I found that the GIE bit is set properly only when running over the line rather than when stepping over it, which allowed me to get around the problem by setting the breakpoint one line "late." While not ideal, this rendered my above question effectively moot, so I posted the screenshot to show what I had been doing (to prove I'm not making this up) and that short explanation of how I worked around the problem, and marked it as answered.

    However, the Registers view is correct—the GIE bit really is not being set when stepping since the interrupt can occur after stepping over the __disable_interrupt() line. If it's not possible to set and clear this bit properly when stepping, a note to that effect in the .h file containing the declaration for this intrinsic function (or perhaps somewhere else that makes sense) would have eliminated some guesswork and saved a lot of my time as I tried to work through a problem which exists only when debugging in a specific manner.

    Thanks for your help!

**Attention** This is a public forum