Thanks Peter, I really appreciate your response. I tried so, however my
error persists. I would be really grateful if you could answer one more
question. I still get the timer stuck after 45-60 mins. I forgot to mention
that I am doing a flash write too in my program , and in doing so , I
disable and enable interrupts. This is the only place left where interrupts
are being handled/changed

/*Writes word (16 bits) to address location*/
void flash_write(uint16_t address, uint16_t word) {


  bspIState_t  intState;
    BSP_ENTER_CRITICAL_SECTION(intState);
//Disable interrupts
FCTL2 = FWKEY + FSSEL1 + FN0; //Set SMCLK/2
FCTL3 = FWKEY; //Unlock memory
FCTL1 = FWKEY + WRT; //Set to write
FLSHRD(address) = word; //Write word to *ptr
FCTL1 = FWKEY; //Clear write bit
FCTL3 = FWKEY + LOCK; //Lock memory
       BSP_EXIT_CRITICAL_SECTION(intState);
//Enable interrupts
return;
}

Now, I am using BSP_ENTER_CRITICAL_SECTION(intState); to disable interrupts
and preserve ISR state. My question, is do I still need to enable global
interrupts here? Is this any way messing up SR registers?

Thanks in advance,
Ravi


On Thu, Sep 5, 2013 at 3:57 PM, Peter Bigot-4 [via MSP430 gcc - Users] <
ml-node+s1086195n6868...@n5.nabble.com> wrote:

> It's not necessarily wrong, but if there's a control path through
> sendPacket that leaves interrupts disabled what you observe would happen.
> Test that by either looking for GIE to be clear in SR when sendPacket
> returns, or work around it by using __bis_SR_register(LPM1_bits | GIE).
>
> There is a more esoteric possibility at
> https://sourceforge.net/p/mspgcc/bugs/341/ but I don't believe it affects
> the 2xx MCUs.
>
> Peter
>
>
> On Thu, Sep 5, 2013 at 2:20 PM, ravim <[hidden 
> email]<http://user/SendEmail.jtp?type=node&node=6868&i=0>>
> wrote:
>
> > Thank you Gentlemen for the responses. I fear the same, my device does
> not
> > wake up from LPM, and since everything depends on timer interrupt and it
> > ceases to fire, the whole system does not other then interrupt of
> receiving
> > packets.
> >
> > Here is my implementation of timer interrupt. Please correct me if I am
> > doing it wrong.
> >
> > I call this initializeRandomTimer in main function
> > void initializeRandomTimer(){
> >
> >     BCSCTL3 |= LFXT1S_2;
> >     TACCTL0 = CCIE;
> >     TACCR0= 437 ;
> >     TACTL = MC_1 | TASSEL_1 | ID_3;
> >   }
> >
> >
> > here is my ISR
> >
> > interrupt(TIMERA0_VECTOR) Timer_A (void)
> > {
> >    if(++sendInterval >= SENDINTERVAL){
> >           radioReady=1;
> >      sendInterval = 0;
> >
> >    }
> >
> >    P1OUT ^= 0x01;
> >         if(++timercounter>=20){
> >                 globaltimer++;
> >                 timercounter=0;
> >           // radioReady=1;
> >         }
> >
> >     __bic_SR_register_on_exit(LPM1_bits);
> > }
> >
> >
> > and here is my for loop in main
> >
> > for(;;){
> >
> >         //enter LPM1
> >     __bis_SR_register(LPM1_bits);
> >
> >         //TIMER interrupt fired
> >
> >
> >     //If our radio is ready to fire
> >     if(radioReady==1){
> >
> >            mrfiPacket_t packet;
> >            packet.frame[0] = 8+20;
> >            packet.frame[RXPACKET_HEADER]  = TXHI;
> >            sendPacket(LOWPOWER, &packet);
> >     }
> >
> > }
> >
> > my global interrupts are enabled in main.  Timer gets stuck after an
> hour
> > or so, when receiving a packet from similar other device.
> >
> >
> > Thanks and Regards,
> > Ravi
> >
> >
> > On Thu, Sep 5, 2013 at 6:52 AM, Peter Bigot-4 [via MSP430 gcc - Users] <
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=6868&i=1>>
> wrote:
> >
> > > Are you sure that there is an interrupt that will wake you from LPM1,
> > that
> > > it is firing, and that when it finishes it clears the LPM flags on the
> > > stack so that the MCU will return to active mode?  What you describe
> so
> > > far
> > > is exactly what should happen if no wakeup occurs.  You should be able
> to
> > > examine the SR value from mspdebug or gdb since it's r2.
> > >
> > >
> > > On Thu, Sep 5, 2013 at 3:06 AM, Wayne Uroda <[hidden email]<
> > http://user/SendEmail.jtp?type=node&node=6866&i=0>>
> > > wrote:
> > >
> > > > I don't think bt actually works correctly on mspgdb (at least it
> never
> > > has
> > > > for me in the last 6 years). I recommend you check the sp directly
> with
> > > the
> > > > "info registers" command (or simply "i r"). The sp is r1 if I recall
> > > > correctly.
> > > >
> > > > Then you can dump the memory in your stack and do something of a
> manual
> > > > backtrace - if you know the current pc (again available through the
> > > > registers) and you have a full assembly listing it should be
> possible
> > to
> > > > spot the return addresses in the stack (or simply check every word,
> if
> > > it
> > > > corresponds to a location in code just following where you called a
> > > > function then it is likely a return address - note I've only ever
> done
> > > this
> > > > in my own software which I know back-to-front and it is all 16bit
> > > > addressing, no msp430x).
> > > >
> > > > Or, you could try mspdebug - I think it has many debugging features
> and
> > > > probably has a working "bt" command (I am still use mspgdb though so
> > I'm
> > > > not sure).
> > > >
> > > > - Wayne
> > > >
> > > > On 05/09/2013, at 16:38, ravim <[hidden email]<
> > http://user/SendEmail.jtp?type=node&node=6866&i=1>>
> > > wrote:
> > > >
> > > > > I am working on a project which involves CC2500 and msp430f2274. I
> > > have
> > > > been
> > > > > struggling with a bug for more than 4 weeks, and still unable to
> > debug
> > > > it.
> > > > > My code stops working after an hour (just time, however device
> keep
> > > > > receiving packets)
> > > > >
> > > > > During my debugging, I have checked stack which is fine. I checked
> > > > globals
> > > > > too, which have legitimate values too.
> > > > >
> > > > > Whenever my code gets stuck, msp430-gdb bt  always always gives me
> > > just
> > > > this
> > > > >
> > > > > 0x00008092 in main ()
> > > > >
> > > > > When I dissemble my code around that address,
> > > > >
> > > > > 08084: b0 12 72 86               CALL    #wor_start
> > > > >    08088: b0 12 38 90               CALL    #initializeRandomTimer
> > > > >    0808c: 32 d2                     EINT
> > > > >    0808e: 32 d0 50 00               BIS     #0x0050, SR
> > > > >    08092: 5f 42 0e 02               MOV.B   &radioReady, R15
> > > > >    08096: 5f 93                     CMP.B   #0x0001, R15
> > > > >
> > > > >
> > > > > I believe some how my SR is getting corrupted. I would really
> > > appreciate
> > > > why
> > > > > it could be getting corrupted. I mean what could be possible
> reasons
> > > for
> > > > > getting SR corruption.
> > > > >
> > > > > Thanks and regards.
> > > > > Ravi
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > View this message in context:
> > > >
> > >
> >
> http://msp430-gcc-users.1086195.n5.nabble.com/SR-getting-corrupted-tp6864.html
> > > > > Sent from the MSP430 gcc - Users mailing list archive at
> Nabble.com.
> > > > >
> > > > >
> > > >
> > >
> >
> ------------------------------------------------------------------------------
>
> > >
> > > > > Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012,
> > more!
> > > > > Discover the easy way to master current and previous Microsoft
> > > > technologies
> > > > > and advance your career. Get an incredible 1,500+ hours of
> > > step-by-step
> > > > > tutorial videos with LearnDevNow. Subscribe today and save!
> > > > >
> > > >
> > >
> >
> http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
> > > > > _______________________________________________
> > > > > Mspgcc-users mailing list
> > > > > [hidden email] <http://user/SendEmail.jtp?type=node&node=6866&i=2>
>
> > > > > https://lists.sourceforge.net/lists/listinfo/mspgcc-users
> > >
> > > >
> > > >
> > > >
> > >
> >
> ------------------------------------------------------------------------------
>
> > >
> > > > Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012,
> more!
> > > > Discover the easy way to master current and previous Microsoft
> > > technologies
> > > > and advance your career. Get an incredible 1,500+ hours of
> step-by-step
> > > > tutorial videos with LearnDevNow. Subscribe today and save!
> > > >
> > >
> >
> http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
> > > > _______________________________________________
> > > > Mspgcc-users mailing list
> > > > [hidden email] <http://user/SendEmail.jtp?type=node&node=6866&i=3>
> > > > https://lists.sourceforge.net/lists/listinfo/mspgcc-users
> > > >
> > >
> > >
> >
> ------------------------------------------------------------------------------
>
> > >
> > > Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
> > > Discover the easy way to master current and previous Microsoft
> > > technologies
> > > and advance your career. Get an incredible 1,500+ hours of
> step-by-step
> > > tutorial videos with LearnDevNow. Subscribe today and save!
> > >
> >
> http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
> > > _______________________________________________
> > > Mspgcc-users mailing list
> > > [hidden email] <http://user/SendEmail.jtp?type=node&node=6866&i=4>
> > > https://lists.sourceforge.net/lists/listinfo/mspgcc-users
> > >
> > >
> > > ------------------------------
> > >  If you reply to this email, your message will be added to the
> discussion
> > > below:
> > >
> > >
> >
> http://msp430-gcc-users.1086195.n5.nabble.com/SR-getting-corrupted-tp6864p6866.html
> > >  To unsubscribe from SR getting corrupted, click here<
> >
> >
> > > .
> > > NAML<
> >
> http://msp430-gcc-users.1086195.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
>
> > >
> > >
> >
> >
> >
> >
> > --
> > View this message in context:
> >
> http://msp430-gcc-users.1086195.n5.nabble.com/SR-getting-corrupted-tp6864p6867.html
>
> > Sent from the MSP430 gcc - Users mailing list archive at Nabble.com.
> >
> >
> >
> ------------------------------------------------------------------------------
>
> > Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
> > Discover the easy way to master current and previous Microsoft
> technologies
> > and advance your career. Get an incredible 1,500+ hours of step-by-step
> > tutorial videos with LearnDevNow. Subscribe today and save!
> >
> http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
> > _______________________________________________
> > Mspgcc-users mailing list
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=6868&i=2>
> > https://lists.sourceforge.net/lists/listinfo/mspgcc-users
> >
> >
>
> ------------------------------------------------------------------------------
>
> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
> Discover the easy way to master current and previous Microsoft
> technologies
> and advance your career. Get an incredible 1,500+ hours of step-by-step
> tutorial videos with LearnDevNow. Subscribe today and save!
> http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
> _______________________________________________
> Mspgcc-users mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=6868&i=3>
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://msp430-gcc-users.1086195.n5.nabble.com/SR-getting-corrupted-tp6864p6868.html
>  To unsubscribe from SR getting corrupted, click 
> here<http://msp430-gcc-users.1086195.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=6864&code=cmF2aS5tYW5kbGl5YUBnbWFpbC5jb218Njg2NHw4MjM1NTA4OTY=>
> .
> NAML<http://msp430-gcc-users.1086195.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://msp430-gcc-users.1086195.n5.nabble.com/SR-getting-corrupted-tp6864p6871.html
Sent from the MSP430 gcc - Users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to