EmbeddedRelated.com
Forums

Watchdog and PID

Started by acastel November 29, 2004
Hi
I'm having problems with the watchdog in a C program. When I 
set the flags, the program reset and it doesn't go to main(). 
If I don't stop the watchdog, the program work fine, and if I 
stop the watchdog, the program work fine too.
Can anyone help me?
Another question.... Did someone make a PID algorithm in 
msp430f149?

Thanks a lot!!!

Anderson Castellar
 
__________________________________________________________________________
Acabe com aquelas janelinhas que pulam na sua tela.
AntiPop-up UOL - gris!
http://antipopup.uol.com.br/



Beginning Microcontrollers with the MSP430

Hello

I am also having a problem with the watchdog. If I do a reset as a 
result of the watchdog, sometimes I get back into the main loop, 
sometimes I dont. I have just come across the problem and I am 
looking into it. If anyone else has any information cold they please 
let me know

many Thanks
Peter

--- In msp430@msp4..., "acastel" <acastel@u...> wrote:
> Hi
> I'm having problems with the watchdog in a C program. When I 
> set the flags, the program reset and it doesn't go to main(). 
> If I don't stop the watchdog, the program work fine, and if I 
> stop the watchdog, the program work fine too.
> Can anyone help me?
> Another question.... Did someone make a PID algorithm in 
> msp430f149?
> 
> Thanks a lot!!!
> 
> Anderson Castellar
>  
> 
______________________________________________________________________
____
> Acabe com aquelas janelinhas que pulam na sua
tela.
> AntiPop-up UOL - gris!
> http://antipopup.uol.com.br/




Which flags are you setting? What do you want it to do? 

-Micah 


On Monday 29 November 2004 02:09 pm, acastel wrote:
>  Hi
>  I'm having problems with the watchdog in a C program. When I
>  set the flags, the program reset and it doesn't go to main().
>  If I don't stop the watchdog, the program work fine, and if I
>  stop the watchdog, the program work fine too.
>  Can anyone help me?
>  Another question.... Did someone make a PID algorithm in
>  msp430f149?
>
>  Thanks a lot!!!
>
>  Anderson Castellar
>
>  __________________________________________________________________________
>  Acabe com aquelas janelinhas que pulam na sua tela.
>  AntiPop-up UOL - gris!
>  http://antipopup.uol.com.br/
>
>
>
>
>  .
>
>
>
>
>
>
> 
>
>
>
>
>
>
>
>  .

Post your watchdog timer settings, is it going into a power-up reset, or do 
you have it set to something else? 

-Micah 

On Thursday 02 December 2004 05:08 am, pjascol wrote:
>  Hello
>
>  I am also having a problem with the watchdog. If I do a reset as a
>  result of the watchdog, sometimes I get back into the main loop,
>  sometimes I dont. I have just come across the problem and I am
>  looking into it. If anyone else has any information cold they please
>  let me know
>
>  many Thanks
>  Peter
>
>  --- In msp430@msp4..., "acastel" <acastel@u...> wrote:
>  > Hi
>  > I'm having problems with the watchdog in a C program. When I
>  > set the flags, the program reset and it doesn't go to main().
>  > If I don't stop the watchdog, the program work fine, and if I
>  > stop the watchdog, the program work fine too.
>  > Can anyone help me?
>  > Another question.... Did someone make a PID algorithm in
>  > msp430f149?
>  >
>  > Thanks a lot!!!
>  >
>  > Anderson Castellar
>  >
>
>  ______________________________________________________________________
>  ____
>
>  > Acabe com aquelas janelinhas que pulam na sua tela.
>  > AntiPop-up UOL - gris!
>  > http://antipopup.uol.com.br/
>
>  .
>
>
>
>
>
>
> 
>
>
>
>
>
>
>
>  .

Hi
With or without this code my program works fine.
WDTCTL = WDTPW + WDTHOLD;

But when I put the code below my program stop. In the 
disassembler window I see the program working but it never 
goes to main().

WDTCTL = WDTPW + ~WDTTMSEL + WDTSSEL +WDTIS0 + WDTIS1

Thanks!

Anderson Castellar


Which flags are you setting? What do you want it to do?
> 
> -Micah
> 
> 
> On Monday 29 November 2004 02:09 pm, acastel wrote:
> >  Hi
> >  I'm having problems with the watchdog in a C program. 
When I
> >  set the flags, the program reset and it
doesn't go to 
main().
> >  If I don't stop the watchdog, the
program work fine, and 
if I
> >  stop the watchdog, the program work fine
too.
> >  Can anyone help me?
> >  Another question.... Did someone make a PID algorithm in
> >  msp430f149?
> >
> >  Thanks a lot!!!
> >
> >  Anderson Castellar
> >
> >  
______________________________________________________________
____________
> >  Acabe com aquelas janelinhas que pulam na
sua tela.
> >  AntiPop-up UOL - gris!
> >  http://antipopup.uol.com.br/
> >
> >
> >
> >
> >  .
> >
> >
> >
> >
> >
> >
> > 
> >
> >
> >
> >
> >
> >
> >
> >  Yahoo! Groups Links
> >
> > To visit your group on the web, go to:
> > http://groups.yahoo.com/group/msp430/
> >  
> > .
> >  
> > Your use of Yahoo! Groups is subject to the Yahoo! Terms 
of Service.
> 
> 
> .
> 
> 
> 
> 
> 
>       [click_here]
> 
> 
=============================================================================>
Yahoo! Groups Links
>     * To visit your group on the web, go to:
>       http://groups.yahoo.com/group/msp430/
>        
>     * .
>        
>     * Your use of Yahoo! Groups is subject to the Yahoo!
_Terms_of_Service.
> 
> 
 
__________________________________________________________________________
Acabe com aquelas janelinhas que pulam na sua tela.
AntiPop-up UOL - gris!
http://antipopup.uol.com.br/



Hi Micah

Thanks for your offer of assistance. I have found my mistake, it was 
as follows:
I set the Wdog control to be a timer, enabled the interrupt and did 
not have a routine to handle the interrupt therefore it caused me a 
problem. I didn't want it to run as a timer - my mistake.

I have now set it to be a watchdog,counting to 32768 and NOT set the 
interrupt enable flag. So it is just running as a counter
(presumably!). I then clear the wdog (timeout 35.5msec) every 20 msec 
in my timerB routine. Then every 2 seconds I check that my software 
has been everywhere it should have been . If not, I write 0 to the 
wdog control to force a reset.  
It seems to work fine

Once again, thanks for the offer

Cheers
Peter

--- In msp430@msp4..., Micah <micah@9...> wrote:
> 
> Post your watchdog timer settings, is it going into a power-up 
reset, or do 
> you have it set to something else? 
> 
> -Micah 
> 
> On Thursday 02 December 2004 05:08 am, pjascol wrote:
> >  Hello
> >
> >  I am also having a problem with the watchdog. If I do a reset as 
a
> >  result of the watchdog, sometimes I get back
into the main loop,
> >  sometimes I dont. I have just come across the problem and I am
> >  looking into it. If anyone else has any information cold they 
please
> >  let me know
> >
> >  many Thanks
> >  Peter
> >
> >  --- In msp430@msp4..., "acastel" <acastel@u...>
wrote:
> >  > Hi
> >  > I'm having problems with the watchdog in a C program. When
I
> >  > set the flags, the program reset and it doesn't go to
main().
> >  > If I don't stop the watchdog, the program work fine, and if
I
> >  > stop the watchdog, the program work fine too.
> >  > Can anyone help me?
> >  > Another question.... Did someone make a PID algorithm in
> >  > msp430f149?
> >  >
> >  > Thanks a lot!!!
> >  >
> >  > Anderson Castellar
> >  >
> >
> >  
______________________________________________________________________
> >  ____
> >
> >  > Acabe com aquelas janelinhas que pulam na sua tela.
> >  > AntiPop-up UOL - gris!
> >  > http://antipopup.uol.com.br/
> >
> >  .
> >
> >
> >
> >
> >
> >
> > 
> >
> >
> >
> >
> >
> >
> >
> >  Yahoo! Groups Links
> >
> > To visit your group on the web, go to:
> > http://groups.yahoo.com/group/msp430/
> > 
> > .
> > 
> > Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service.




Well, this is what you're telling the cpu to do:

WDTPW - Password for WD config. 

~WDTTMSEL - Watchdog mode (as opposed to interval timer)

WDTSSEL - Use ACLK as the clock source (I assume you've got a crystal in 
there, 32768 hz?)

WDTIS0 - Interval at every 32768 ticks, so one second if you're using the 
watch xtal. 

WDTIS1 - Interval at every 8192 ticks, because the above value is 0, and this 
value is 1, this will supercede the above setting. Having both doesn't make

sense, do one or the other. In any case, this will trigger every 4th of a 
second if my math is right, (and my assumption about the watch xtal is right)

So, by not setting the WDTNMI function, you're leaving it in reset mode, so

this will reset the CPU every 250 milliseconds or thereabouts.. (if I 
understand the Interval setting correctly)

So, this may explain your issue? 

-Micah 



On Friday 03 December 2004 02:44 am, acastel wrote:
>  Hi
>  With or without this code my program works fine.
>  WDTCTL = WDTPW + WDTHOLD;
>
>  But when I put the code below my program stop. In the
>  disassembler window I see the program working but it never
>  goes to main().
>
>  WDTCTL = WDTPW + ~WDTTMSEL + WDTSSEL +WDTIS0 + WDTIS1
>
>  Thanks!
>
>  Anderson Castellar
>
>
>  Which flags are you setting? What do you want it to do?
>
>  > -Micah
>  >
>  > On Monday 29 November 2004 02:09 pm, acastel wrote:
>  > > Hi
>  > > I'm having problems with the watchdog in a C program.
>
>  When I
>
>  > > set the flags, the program reset and it doesn't go to
>
>  main().
>
>  > > If I don't stop the watchdog, the program work fine, and
>
>  if I
>
>  > > stop the watchdog, the program work fine too.
>  > > Can anyone help me?
>  > > Another question.... Did someone make a PID algorithm in
>  > > msp430f149?
>  > >
>  > > Thanks a lot!!!
>  > >
>  > > Anderson Castellar
>  > >
>  > >
>
>  ______________________________________________________________
>  ____________
>
>  > > Acabe com aquelas janelinhas que pulam na sua tela.
>  > > AntiPop-up UOL - gris!
>  > > http://antipopup.uol.com.br/
>  > >
>  > >
>  > >
>  > >
>  > > .
>  > >
>  > >
>  > >
>  > >
>  > >
>  > >
>  > > 
>  > >
>  > >
>  > >
>  > >
>  > >
>  > >
>  > >
>  > > .


--- In msp430@msp4..., Micah <micah@9...> wrote:

> Well, this is what you're telling the cpu to
do:
> WDTPW - Password for WD config. 
> ~WDTTMSEL - Watchdog mode (as opposed to interval timer)
> WDTSSEL - Use ACLK as the clock source
> WDTIS0 - Interval at every 32768 ticks
> WDTIS1 - Interval at every 8192 ticks

Actually, he's ADDING in the bitwise complement of WDTTMSEL!  The 
complement of 0x0010 is 0xFFEF.  The value it looks like he's using 
is as follows:

WDTPW     = 0x5A00
~WDTTMSEL = 0xFFEF
WDTSSEL   = 0x0004
WDTIS0    = 0x0002
WDTIS1    = 0x0001
=================sum       = 0x59F6

The password check will FAIL, and the system will start a PUC.
Does THAT match the symptoms you have?  Perhaps you should just leave 
out the inverted value.

Hope that helps!

William

> On Friday 03 December 2004 02:44 am, acastel
wrote:
> >  With or without this code my program works fine.
> >  WDTCTL = WDTPW + WDTHOLD;
> >
> >  But when I put the code below my program stop. In the
> >  disassembler window I see the program working but it never
> >  goes to main().
> >
> >  WDTCTL = WDTPW + ~WDTTMSEL + WDTSSEL +WDTIS0 + WDTIS1








You're very correct it seems. Doh!

On Thursday 16 December 2004 07:02 pm, William J.
Watson wrote:
>  --- In msp430@msp4..., Micah <micah@9...> wrote:
>  > Well, this is what you're telling the cpu to do:
>  > WDTPW - Password for WD config.
>  > ~WDTTMSEL - Watchdog mode (as opposed to interval timer)
>  > WDTSSEL - Use ACLK as the clock source
>  > WDTIS0 - Interval at every 32768 ticks
>  > WDTIS1 - Interval at every 8192 ticks
>
>  Actually, he's ADDING in the bitwise complement of WDTTMSEL! The
>  complement of 0x0010 is 0xFFEF. The value it looks like he's using
>  is as follows:
>
>  WDTPW = 0x5A00
>  ~WDTTMSEL = 0xFFEF
>  WDTSSEL = 0x0004
>  WDTIS0 = 0x0002
>  WDTIS1 = 0x0001
>  =================>  sum = 0x59F6
>
>  The password check will FAIL, and the system will start a PUC.
>  Does THAT match the symptoms you have? Perhaps you should just leave
>  out the inverted value.
>
>  Hope that helps!
>
>  William
>
>  > On Friday 03 December 2004 02:44 am, acastel wrote:
>  > > With or without this code my program works fine.
>  > > WDTCTL = WDTPW + WDTHOLD;
>  > >
>  > > But when I put the code below my program stop. In the
>  > > disassembler window I see the program working but it never
>  > > goes to main().
>  > >
>  > > WDTCTL = WDTPW + ~WDTTMSEL + WDTSSEL +WDTIS0 + WDTIS1
>
>  .
>
>
>
>
>
>
> 
>
>
>
>
>
>
>  .