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.

MSP430F2370: TimerB1, TimerB2 CCIFG set to 1 automaticaly when CCIE is set to 0 causing ISR trap.

Part Number: MSP430F2370
Other Parts Discussed in Thread: TRF7970A,

Hi,

I am using MSP430F2370 with TRF7970A. I am using code based on sloa214.

In sloa214 TimerA0 used for RFID read APIs for timeout but in modified code we used TimerA0 for Application logic and for RFID API we used TimerB0.

So what happed when there is a failurein Mifare authentication process sometimes code  jumps to ".text:_isr:__TI_ISR_TRAP" so I written all INT vector handler to get idea which INT occured so after debugging it is found that timerB1 INT Vector handler called but code get stucks there it does not return from handler.

So my question is why TimerB1, TimerB2 CCIFG set to 1 automaticaly when CCIE is set to 0 and INT handler called. 

Timer B SFR Status on ISR trap and earlier status is attached in screen shot. 

TBIV value changes to 0x000E. 

void 
McuCounterSet(void)
{
	TBCTL |= TBCLR;
	TBCTL &= ~TBCLR;				// reset the timerA
	TBCTL |= TBSSEL0 + TBIE;	// ACLK (@ 3KHz), interrupt enable, timer stoped

	TBR = 0x0000;
	TBCCTL0 |= CCIE;				// compare interrupt enable
}

  • On the MSP430, IFGs are set independent of their respective IEs. It is routine to have IFGs set for events you're not interested in.

    >    TBCTL |= TBSSEL0 + TBIE;    // ACLK (@ 3KHz), interrupt enable, timer stoped

    This is what's causing your TIMER0_B1_VECTOR (which evidently isn't defined) to be called. Since you don't seem to be interested in TBIFG, I recommend you Not set TBIE.

    In Up mode, TBIFG happens at (almost) the same time as TBCCTL0:CCIFG (TIMER0_B0_VECTOR) so there's rarely a reason to enable both.

    Unsolicited: The TBCLR bit clears by itself, so there's no need for your code to clear it.

  • Hi,

    It still generates issue. see attached screenshot.

    void 
    McuCounterSet(void)
    {
    	TBCTL |= TBCLR;
    	TBCTL &= ~TBCLR;				// reset the timerA
    	TBCTL |= TBSSEL0;	// ACLK (@ 3KHz), interrupt enable, timer stoped
    
    	TBR = 0x0000;
    	TBCCTL0 |= CCIE;				// compare interrupt enable
    }

  • TB0CCTL1:CCIE is set. This will (also) cause a problem. If you're not interested in catching the CCIFG, don't set the CCIE. [Ref User Guide (SLAU144J) Sec 13.2.6]

    You didn't post any code that sets that CCIE, so the code you're interested in is somewhere else.

  • Regarding, TB0CCTL1:CCIE I know that and not set in code. It was not setting earlier before your suggestion but after you suggested change applied this is the state at INT. But in code TB0CCTL1:CCIE is not used.

  • TB0CCTL1:CCIE doesn't become 1 by itself, so something somewhere is setting it. Are you using any external libraries?

    I suppose you could try explicitly clearing it. That might get rid of your symptom at least.

  • Hi,

    we have taken Application sloa214 as base code for our application in that MifareCryptoLibrary.lib is included can you confirm there is anything related to this issue in Library.

    Regards,

    Hardik Harpal

  • Unfortunately I can't confirm, since I don't have the source. [I've requested it but I don't expect to be approved, since I had to admit I probably wasn't going to buy any of these any time soon.] Using a timer in a "Crypto" library would be rather unusual.

    I don't see any TimerB references in the appnote source. Is the code you posted above something you added?

**Attention** This is a public forum