Hi, I'm trying to get the watchdog timer working on my teensy 3.6. After doing a little digging around I stumbled upon this post:
https://forum.pjrc.com/threads/57131...981#post211981
I decided to copy-paste the code to give it a try but when I tried compiling it I got the following errors:
Most of these errors originate in the kinetis.h file. I tried googling around to see if something was wrong with the syntax in the kinetis file but found nothing.Code:In file included from C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/core_pins.h:34:0, from C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/wiring.h:39, from C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/WProgram.h:45, from C:\Users\MNI~1\AppData\Local\Temp\arduino_build_294619\pch\Arduino.h:6: C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/kinetis.h:5675:56: error: expected ')' before '::' token #define __disable_irq() __asm__ __volatile__ ("CPSID i":::"memory"); ^ C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/wiring.h:158:24: note: in expansion of macro '__disable_irq' #define noInterrupts() __disable_irq() ^ E:\Projects\Plane\Flight Software\Various tests\WatchdogTest\WatchdogTest\WatchdogTest.ino:38:1: note: in expansion of macro 'noInterrupts' noInterrupts(); ^ C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/kinetis.h:2615:26: error: expected unqualified-id before 'volatile' #define WDOG_REFRESH (*(volatile uint16_t *)0x4005200C) // Watchdog Refresh register ^ E:\Projects\Plane\Flight Software\Various tests\WatchdogTest\WatchdogTest\WatchdogTest.ino:39:1: note: in expansion of macro 'WDOG_REFRESH' WDOG_REFRESH = 0xA602; ^ C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/kinetis.h:2615:26: error: expected ')' before 'volatile' #define WDOG_REFRESH (*(volatile uint16_t *)0x4005200C) // Watchdog Refresh register ^ E:\Projects\Plane\Flight Software\Various tests\WatchdogTest\WatchdogTest\WatchdogTest.ino:39:1: note: in expansion of macro 'WDOG_REFRESH' WDOG_REFRESH = 0xA602; ^ C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/kinetis.h:2615:26: error: expected ')' before 'volatile' #define WDOG_REFRESH (*(volatile uint16_t *)0x4005200C) // Watchdog Refresh register ^ E:\Projects\Plane\Flight Software\Various tests\WatchdogTest\WatchdogTest\WatchdogTest.ino:39:1: note: in expansion of macro 'WDOG_REFRESH' WDOG_REFRESH = 0xA602; ^ C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/kinetis.h:2615:26: error: expected unqualified-id before 'volatile' #define WDOG_REFRESH (*(volatile uint16_t *)0x4005200C) // Watchdog Refresh register ^ E:\Projects\Plane\Flight Software\Various tests\WatchdogTest\WatchdogTest\WatchdogTest.ino:40:1: note: in expansion of macro 'WDOG_REFRESH' WDOG_REFRESH = 0xB480; ^ C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/kinetis.h:2615:26: error: expected ')' before 'volatile' #define WDOG_REFRESH (*(volatile uint16_t *)0x4005200C) // Watchdog Refresh register ^ E:\Projects\Plane\Flight Software\Various tests\WatchdogTest\WatchdogTest\WatchdogTest.ino:40:1: note: in expansion of macro 'WDOG_REFRESH' WDOG_REFRESH = 0xB480; ^ C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/kinetis.h:2615:26: error: expected ')' before 'volatile' #define WDOG_REFRESH (*(volatile uint16_t *)0x4005200C) // Watchdog Refresh register ^ E:\Projects\Plane\Flight Software\Various tests\WatchdogTest\WatchdogTest\WatchdogTest.ino:40:1: note: in expansion of macro 'WDOG_REFRESH' WDOG_REFRESH = 0xB480; ^ C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/kinetis.h:5676:55: error: expected ')' before '::' token #define __enable_irq() __asm__ __volatile__ ("CPSIE i":::"memory"); ^ C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/wiring.h:157:22: note: in expansion of macro '__enable_irq' #define interrupts() __enable_irq() ^ E:\Projects\Plane\Flight Software\Various tests\WatchdogTest\WatchdogTest\WatchdogTest.ino:41:1: note: in expansion of macro 'interrupts' interrupts(); ^ WatchdogTest: In function 'void startup_early_hook()': WatchdogTest:63: warning: unused variable 'toval' uint16_t toval = 1000; ^ Error compiling for board Teensy 3.6.
Can anyone give any help with solving this issue?
For the curious, I'm using Arduino 1.8.12 and Teensyduino 1.52 on a Windows 10 computer.