0
\$\begingroup\$

Below is a short code chunk. The code locks up on the 'Serial.Begin(9600);' line. Can anybody tell me why? Also, can you tell me how to get around it?

void setup()
{
  disableWatchDog();
  Wire.setModule(0);
  Serial.begin(9600);
  while(Serial.available());
}
\$\endgroup\$
3
\$\begingroup\$

The Watch Dog timer is crucial for Energia's implementation of millis and delay, which in turn is needed for Serial. It should not be manually disabled if you intend to use Serial. Serial and other parts of the Energia framework takes care of disabling the Watchdog from it's watchdog mode, and sets it up for Interval/Timer mode. By disabling the timer, Serial locks up waiting for the timer to expire. Same for directly calling Delay().

See http://forum.43oh.com/topic/4688-watch-dog-timer/

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.