Jump to content
43oh

Serial does not work when watchdog timer is enabled


Recommended Posts

I'm new to micro-controller programming and am seeking some help. I'm using the MSP-EXP430G2553 Launchpad.

Following examples from online contributors I have inserted the following as the first line of code:

// WDTCTL = WDTPW + WDTHOLD;       // Stop WDT

However, when this is enabled it prevents serial monitoring and interrupts from working.

I don't know if it is relevant but the uart jumpers are set to HW.

Link to post
Share on other sites

If  I recall correctly:

 

I do not think you need to do any watchdog setup with Energia.

 

The Energia core sets it up as for use as the timebase for time functions. Any changes you make to the setting outside the Energia envelope will cause issues.

 

See:

 

Link to post
Share on other sites
23 hours ago, dave45 said:

// WDTCTL = WDTPW + WDTHOLD;       // Stop WDT

However, when this is enabled it prevents serial monitoring and interrupts from working.

This is "expected behavior." When the watchdog is enabled, it needs to be serviced regularly on a schedule that's far shorter than serial communication. The intent of the watchdog is to restart the device in the event of an unexpected endless loop, or other conditions that result in the mcu hanging.

This reference on Wikipedia will explain it better.

FWIW - it is not at all unusual for makers (or others) to disable the watchdo.

Bob

Link to post
Share on other sites
  • 3 weeks later...

Thank you both for your answers.

I think my question may have been ambiguous. The problems come when I remove the comment slashes from the line, i.e. include the WDT stop line in the compile.

As I am new to MSP430's and Energia, I hadn't realised that the IDE makes use of the watchdog timer for it's own purposes.

Link to post
Share on other sites
10 hours ago, dave45 said:

The problems come when I remove the comment slashes from the line, i.e. include the WDT stop line in the compile.

Yes. That will cause trouble. Energia sets up the WDT itself. It is used for timekeeping to support the time functions. DO NOT disable it for Energia.

If you are  NOT using Energia, you (probably) need to disable the WDT, periodically kick it, or set it up for your application if you will use it as a standard timer.

 

The purpose of Energia, or Arduino, is to provide a layer of abstraction between tasks like device setup and processor initialization  and the programmer so less experienced users don't get buried in the details, as well as provide a suite of utility functions and classes that abstract the hardware in useful ways. The price paid is that some modules are populated by system setup and become unavailable for explicit use. The WDT is one. Most users will not miss it.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...