dave45 0 Posted January 13, 2020 Share Posted January 13, 2020 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. Quote Link to post Share on other sites
enl 227 Posted January 13, 2020 Share Posted January 13, 2020 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: Quote Link to post Share on other sites
NurseBob 111 Posted January 14, 2020 Share Posted January 14, 2020 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 Quote Link to post Share on other sites
dave45 0 Posted January 31, 2020 Author Share Posted January 31, 2020 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. Quote Link to post Share on other sites
enl 227 Posted January 31, 2020 Share Posted January 31, 2020 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. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.