Jump to content
43oh

GeorgeIoak

Members
  • Content Count

    31
  • Joined

  • Last visited

Reputation Activity

  1. Like
    GeorgeIoak got a reaction from bluehash in TI's MSP432 WDT Example code Error   
    While debugging my code this weekend I decided to step back and try to debug certain aspects of it. TI's Resource Explorer is a great tool with plenty of example code to look at and review. I was having issues with my WDT routine so I thought I would double check running one of the examples that was released, to be specific, I was interest in the WDT_02 example which can be seen here. The code was not working which really left me wondering since I assumed that any code published BY TI as an example MUST have been checked to see if it actually worked?!
     
    Well as it turns out the code does NOT work and has an error in it (actually more than 1). I posted over on TI's e2e forums and for a little detail you can look at that post here.
     
    For those that just want to know what is wrong, this line of code:
    WDTCTL = WDTIS_4; // WDT 250ms, ACLK, interval timer Needs to be modified to:
    WDTCTL = WDTIS_5 | WDTTMSEL | WDTSSEL_1 | WDTCNTCL | WDTPW; // WDT 250ms, ACLK, interval timer Hopefully the next person left scratching their head wondering what's wrong will find this post and not have to waste time trying to figure out what is going on.
  2. Like
    GeorgeIoak got a reaction from tripwire in "#112-D statement is unreachable" warning   
    I figured out that the compiler warnings are happening because once you enter the while(1) loop you'll be stuck in it and can never reach the statements outside of the loop.
     
    The other "error" I received this response over on the TI e2e forums:
     
  3. Like
    GeorgeIoak got a reaction from bluehash in "#112-D statement is unreachable" warning   
    I figured out that the compiler warnings are happening because once you enter the while(1) loop you'll be stuck in it and can never reach the statements outside of the loop.
     
    The other "error" I received this response over on the TI e2e forums:
     
  4. Like
    GeorgeIoak reacted to chicken in Can TimerA ISR Stop Itself?   
    A minor style suggestion:
     
    As we learned, MC_0 and MC_1 are not bits, but values (0x00 and 0x10 respectively). So the proper way to set them is to apply a mask to TACTL first. It works now, but might break when you or someone else tries different timer settings (e.g. MC_2 or MC_3).
     
    I'd do something like this:
     
    #define MC_BITMASK (~(BIT4 | BIT5))  // bit mask for timer mode in TACTL .. TACTL = (TACTL & MC_BITMASK) | MC_0;  // stop timer .. TACTL = (TACTL & MC_BITMASK) | MC_1;  // set timer up mode
×
×
  • Create New...