juanboy 0 Posted February 7, 2016 Share Posted February 7, 2016 Hi, do anybody has a simple software watchdog script for cc3200. Kind of frustrated now as spending a lot of time to build a HW reset, only to realise that the RESET on the 20 pin connector is only an output... regard, Quote Link to post Share on other sites
energia 485 Posted February 7, 2016 Share Posted February 7, 2016 Have not tried it but the Sketch below should give you an idea of how to use the wtachdog on the CC3200. Should work for both EMT and none EMT. #include <stdio.h> #include <stdint.h> #include <inc/hw_types.h> #include <inc/hw_ints.h> #include <inc/hw_memmap.h> #include <driverlib/prcm.h> #include <driverlib/wdt.h> #include <driverlib/rom.h> #include <driverlib/rom_map.h> #include <driverlib/interrupt.h> #if defined(USE_TIRTOS) || defined(USE_FREERTOS) || defined(SL_PLATFORM_MULTI_THREADED) #include "osi.h" #endif volatile unsigned long g_ulWatchdogCycles; #define WD_PERIOD_MS 1000 #define MAP_SysCtlClockGet 80000000 #define MILLISECONDS_TO_TICKS(ms) ((MAP_SysCtlClockGet / 1000) * (ms)) void setup() { // put your setup code here, to run once: // // Enable the peripherals used by this example. // MAP_PRCMPeripheralClkEnable(PRCM_WDT, PRCM_RUN_MODE_CLK); // // Unlock to be able to configure the registers // MAP_WatchdogUnlock(WDT_BASE); #if defined(USE_TIRTOS) || defined(USE_FREERTOS) || defined(SL_PLATFORM_MULTI_THREADED) // USE_TIRTOS: if app uses TI-RTOS (either networking/non-networking) // USE_FREERTOS: if app uses Free-RTOS (either networking/non-networking) // SL_PLATFORM_MULTI_THREADED: if app uses any OS + networking(simplelink) osi_InterruptRegister(INT_WDT, &WatchdogIntHandler, INT_PRIORITY_LVL_1); #else MAP_IntPrioritySet(INT_WDT, INT_PRIORITY_LVL_1); MAP_WatchdogIntRegister(WDT_BASE,&WatchdogIntHandler); #endif // // Set the watchdog timer reload value // MAP_WatchdogReloadSet(WDT_BASE,MILLISECONDS_TO_TICKS(WD_PERIOD_MS)); // // Start the timer. Once the timer is started, it cannot be disable. // MAP_WatchdogEnable(WDT_BASE); } void loop() { // put your main code here, to run repeatedly: } void WatchdogIntHandler(void) { // // Clear the watchdog interrupt. // MAP_WatchdogIntClear(WDT_BASE); // // Increment our interrupt counter. // g_ulWatchdogCycles++; } Rei Vilo 1 Quote Link to post Share on other sites
juanboy 0 Posted February 8, 2016 Author Share Posted February 8, 2016 Thanks.. Quote Link to post Share on other sites
hungtran 0 Posted October 12, 2016 Share Posted October 12, 2016 If the watchdog is used as the program running on the device to loop hangs the watchdog is not activated. Quote Link to post Share on other sites
hungtran 0 Posted October 12, 2016 Share Posted October 12, 2016 I need to use to reset the watchdog timer when it crashes cc3200 ..Can someone help me please Quote Link to post Share on other sites
Rei Vilo 695 Posted November 11, 2017 Share Posted November 11, 2017 On 07/02/2016 at 8:44 PM, energia said: Have not tried it but the Sketch below should give you an idea of how to use the wtachdog on the CC3200. Should work for both EMT and none EMT. The example works fine on Energia. To rearm the watchdog and start to 10 seconds again, just perform g_ulWatchdogCycles = 0; Now, how to deactivate the watchdog? In a typical application, I want to check one specific part, i.e. WiFi provisioning. The process looks like: Set and start watchdog WiFi provisioning If WiFi provisioning fails, the watchdog resets the board. Stop and clear watchdog Once this part has been completed successfully, I want to deactivate the watchdog. Quote Link to post Share on other sites
Rei Vilo 695 Posted November 11, 2017 Share Posted November 11, 2017 The WDT_IF_DeInit function doesn't seem to deactivate the interrupt. void WDT_IF_DeInit() { // // Unlock to be able to configure the registers // MAP_WatchdogUnlock(WDT_BASE); // // Disable stalling of the watchdog timer during debug events // MAP_WatchdogStallDisable(WDT_BASE); // // Clear the interrupt // MAP_WatchdogIntClear(WDT_BASE); // // Unregister the interrupt // MAP_WatchdogIntUnregister(WDT_BASE); } Quote Link to post Share on other sites
Rei Vilo 695 Posted November 16, 2017 Share Posted November 16, 2017 @energia Any hint on how to deactivate the watch-dog? Quote Link to post Share on other sites
Rei Vilo 695 Posted November 17, 2017 Share Posted November 17, 2017 See the other thread at Quote Link to post Share on other sites
prabuselva 0 Posted September 10, 2019 Share Posted September 10, 2019 Hai, try this code in CC3220SF internal Watchdog timer program, its working Fine #include <inc/hw_types.h> #include <inc/hw_ints.h> #include <inc/hw_memmap.h> #include <driverlib/prcm.h> #include <driverlib/wdt.h> #include <driverlib/rom.h> #include <driverlib/rom_map.h> #include <driverlib/interrupt.h> int Cycles; #define WD_PERIOD_MS 1000 #define MAP_SysCtlClockGet 80000000 #define MILLISECONDS_TO_TICKS(ms) ((MAP_SysCtlClockGet / 1000) * (ms)) void setup() { Serial.begin(115200); Serial.println("Watchdog Test"); MAP_PRCMPeripheralClkEnable(PRCM_WDT, PRCM_RUN_MODE_CLK); MAP_WatchdogUnlock(WDT_BASE); MAP_IntPrioritySet(INT_WDT, INT_PRIORITY_LVL_1); MAP_WatchdogIntRegister(WDT_BASE, &WatchdogIntHandler); MAP_WatchdogReloadSet(WDT_BASE, MILLISECONDS_TO_TICKS(WD_PERIOD_MS)); MAP_WatchdogEnable(WDT_BASE); } void loop() { Serial.println("Watchdog Test"); delay(2000); } void WatchdogIntHandler(void) { if (Cycles >= 10) { Serial.println("Reseting.........."); return; } MAP_WatchdogIntClear(WDT_BASE); Cycles++; } Thanks Prabuselva 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.