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.

In MSP430 , Timer stops functioning when i map port 2 pins to UCB0

HI

I am using MSP430F5 series MCU .

I have myTimer A0  running to count 2ms and perform a task every 2 ms .

Now when I port map pins P2.2 , P2.3 , P2.4 to UCB0 , immediately my timer stops functioning and the system almost stands still .

I cannot understand what happens , but the system looks to be hung or reset ..

My questions are

1. Is there any conflict with this port map with the timer

2. Is there any problem with the port mapping code (please scroll down for the code )

3. Is it mandatory to code the ISR for UCB0 ?

4. Is there any way to find whether my MCU got reset ?

 Below is my port mapping code.

  __disable_interrupt();

  PMAPPWD = 0x02D52;

  #ifdef PORT_MAP_RECFG

  PMAPCTL = PMAPRECFG;

  #endif

 P2MAP1 = PM_UCB0SIMO;

  P2MAP2 = PM_UCB0SOMI;

  P2MAP3 = PM_UCB0CLK;

 PMAPPWD = 0;

  #ifdef


PORT_MAP_EINT

  __enable_interrupt();                    

  #endif

Thanks in advance ..

Jenitta

 

  • Hi Jenitta,

    Yes, if you enable the individual interrupt bit in a peripheral and then set the general interrupt with __enable_interrupt(), the MCU will try to fetch from the interrupt vector supposed to contain the ISR. If you don't have that ISR, then this will be undefined (actually if you've erased the ISR then 0xFFFF will be fetched which I believe causes the device to halt, but I'm likely wrong).

    Tony

  • Jenitta Rex said:
    3. Is it mandatory to code the ISR for UCB0 ?

    No. You can also poll it form main, by checkign the xxxIFG bits. But then you must not set any of the xxxIE bits, as then the CPU would try to call an ISR and crash.

    Jenitta Rex said:
    4. Is there any way to find whether my MCU got reset ?

    You can read the SYSRSTIV register. after power-on, it returns 0x0002, a watchdog reset would appear as 0x0016, a PMM password violation would appear as 0x0020. IIRC, multiple readings are possible until you receive 0x0000.

**Attention** This is a public forum