Go Down

Topic: Where in the world is Due's reference to WDT.h ? (Read 2765 times) previous topic - next topic

Vaclav

This simple code works fine on Uno , running IDE 1.6.6 nightly build .

Code: [Select]


#include <avr\wdt.h>
void setup() {
  Serial.begin (115200);
  Serial.println(__FILE__);
  // put your setup code here, to run once:
wdt_enable(WDTO_15MS);
}

void loop() {
  // put your main code here, to run repeatedly:

}


Replacing

#include <avr\wdt.h>


with

#include <wdt.h>

does not work on ARM / Due , file not found.

 
#include <avr\wdt.h>  does not work either,( file not found) , but I  did not expect that to work on ARM anyway.

Windows "search" returns tons of "wdt.h" all of them under AVR umbrella / directories.


westfw

The relevant include file is already included via <chip.h>, but of course the Due WDT is much different than the AVR version.
You probably want something like:
Code: [Select]
  WDT_Enable(WDT, WDT_MR_WDV(1000)|WDT_MR_WDRSTEN|WDT_MR_WDRPROC);

With periodic calls to
Code: [Select]
 WDT_Restart(WDT);


The actual source files are ... numerous:
packages/arduino/hardware/sam/1.6.4/system/libsam/source/wdt.*
packages/arduino/hardware/sam/1.6.4/system/CMSIS/Device/ATMEL/sam3xa/include/component/component_wdt.h
/packages/arduino/hardware/sam/1.6.4/system/CMSIS/Device/ATMEL/sam3xa/include/sam3x8e.h

Dande80

As far as I remember the Watchdog of the Atemga SAM3X can unly be set once (after each reset) and is disabled in the standard initialization of the DUE. You would need to edit something in the board files. Only after that you can set the Watchdog to the behaviour you want.

Vaclav

The relevant include file is already included via <chip.h>, but of course the Due WDT is much different than the AVR version.
You probably want something like:
Code: [Select]
  WDT_Enable(WDT, WDT_MR_WDV(1000)|WDT_MR_WDRSTEN|WDT_MR_WDRPROC);

With periodic calls to
Code: [Select]
  WDT_Restart(WDT);


The actual source files are ... numerous:
packages/arduino/hardware/sam/1.6.4/system/libsam/source/wdt.*
packages/arduino/hardware/sam/1.6.4/system/CMSIS/Device/ATMEL/sam3xa/include/component/component_wdt.h
/packages/arduino/hardware/sam/1.6.4/system/CMSIS/Device/ATMEL/sam3xa/include/sam3x8e.h

Here are compiler error  messages when I added this WDT_Enable to Setup


WDT_Enable(WDT, WDT_MR_WDV(1000)|WDT_MR_WDRSTEN|WDT_MR_WDRPROC);


When I added #include <chip.h> just for good measure the compiler could not find it.
But that may  preprocessor messing with any includes.

So basically the compiler has an issue with WDT_Enable, which I have been getting from get go.
I'll tale a look at source code after I figure out which chip.h is actually used.

I understand that I need to comment out some initial code so I can set / initialize WDT  in my code.


I also found some "advanced library for Due" coding WDT , so I'll take a look at that.


Code: [Select]
sketch_nov05a.ino: In function 'void setup()':
sketch_nov05a.ino:13:12: error: 'WDT' was not declared in this scope
sketch_nov05a.ino:13:32: error: 'WDT_MR_WDV' was not declared in this scope
sketch_nov05a.ino:13:34: error: 'WDT_MR_WDRSTEN' was not declared in this scope
sketch_nov05a.ino:13:49: error: 'WDT_MR_WDRPROC' was not declared in this scope
sketch_nov05a.ino:13:63: error: 'WDT_Enable' was not declared in this scope
'WDT' was not declared in this scope


westfw

Quote
Here are compiler error  messages when I added this WDT_Enable to Setup
I don't know what to tell you.   It works fine here with 1.6.5 on both windows and mac, and 1.6.6 on mac.
I just added the same line to setup() in blink.ino.

Can you provide "verbose" compilation output?  You're using the IDE, right?  Not Visual Micro, or Atmel Studio, or something?


Vaclav

I don't know what to tell you.   It works fine here with 1.6.5 on both windows and mac, and 1.6.6 on mac.
I just added the same line to setup() in blink.ino.

Can you provide "verbose" compilation output?  You're using the IDE, right?  Not Visual Micro, or Atmel Studio, or something?



You got something!

I tested WDT few months back and it was definitely working BEFORE 1.6.6.!


It works just fine on 1.5.8.
CASE CLOSED!

Go Up