Jump to content

Recommended Posts

Dear Friends,

Now i am working with CC3220SF evaluation kit, i wan't to add watch dog code to my base code,i was trying to create a code for CC3220SF in past 15 days but i get errors so  i am trying in multiple examples like
https://forum.43oh.com/topic/9346-cc3200-watchdog/
https://forum.43oh.com/topic/11170-watchdog-in-cc3200/

these examples does not work for my CC3220SF because these examples are support only CC3200 boards, i don't know how to create watchdog header's for CC3220SF, can you please help me to find the correct example for CC3220SF.

Share this post


Link to post
Share on other sites

SInce no other responses have come along, I will get the ball rolling by asking for a bit more detail.

What errors are you getting?

What are you trying to do with the watchdog?

As far as I know (not using the CC32XX series), Energia supports the 3220 launchpad board. See https://forum.43oh.com/topic/13311-connecting-cc3220sf-to-cayenne-mqtt-using-energia/ (Rei Vilo's msg: 6th in the thread)

 

Share this post


Link to post
Share on other sites

Dear friend,

thanks for your reply, i just use the watch dog for reset my CC3220SF when that is struck or not working well, this is code what i am trying to compile 

//#include <stdlib.h>
#include "inc/hw_types.h"
#include "inc/hw_wdt.h"
#include "driverlib/wdt.h"
#include "driverlib/utils.h"
#include "driverlib/prcm.h"
#include "driverlib/interrupt.h"
#include "inc/hw_ints.h"

#include <ti/drivers/watchdog/WatchdogCC32XX.h>

#include <ti/devices/cc32xx/inc/hw_types.h>
#include <ti/devices/cc32xx/driverlib/rom.h>
#include <ti/devices/cc32xx/driverlib/rom_map.h>
#include <ti/devices/cc32xx/driverlib/wdt.h>
 
volatile unsigned long g_ulWatchdogCycles = 0;
typedef void (*fAPPWDTDevCallbk)();
#define WD_PERIOD_MS 1000
#define SYS_CLK                             80000000
#define MILLISECONDS_TO_TICKS(ms)   ((SYS_CLK/1000) * (ms))
void WDT_IF_Init(fAPPWDTDevCallbk fpAppWDTCB, unsigned int uiReloadVal);
void setup() {
  boolean bRetcode;
  Serial.begin(115200);
  Serial.println("**************************************************");
  Serial.println("*             CC3200 Watchdog Test               *");
  Serial.println("**************************************************");

  //
  // Set up the watchdog interrupt handler.
  //
  WDT_IF_Init(WatchdogIntHandler, MILLISECONDS_TO_TICKS(WD_PERIOD_MS));

  bRetcode = MAP_WatchdogRunning(WDT_BASE);
  if (!bRetcode)
  {
    Serial.println("Watchdog failed to run. Shutting down");
    WDT_IF_DeInit();
    while (1);
  }
}

void loop() {
  Serial.print("Watchdog interrupt count: ");
  Serial.println(g_ulWatchdogCycles);
  delay(1000);
}

void WatchdogIntHandler(void)
{
  //
  // After 10 interrupts, switch On LED6 to indicate system reset
  // and don't clear watchdog interrupt which causes system reset
  //
  if (g_ulWatchdogCycles >= 10)
  {
    MAP_UtilsDelay(800000);
    return;
  }
  //
  // Clear the watchdog interrupt.
  //
  MAP_WatchdogIntClear(WDT_BASE);
  //
  // Increment our interrupt counter.
  //
  g_ulWatchdogCycles++;

}

void WDT_IF_Init(fAPPWDTDevCallbk fpAppWDTCB, unsigned int uiReloadVal)
{
  //
  // 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 (fpAppWDTCB != NULL)
  {
    MAP_IntPrioritySet(INT_WDT, INT_PRIORITY_LVL_1);
    MAP_WatchdogIntRegister(WDT_BASE, fpAppWDTCB);
  }
  //
  // Set the watchdog timer reload value
  //
  MAP_WatchdogReloadSet(WDT_BASE, uiReloadVal);
  //
  // Start the timer. Once the timer is started, it cannot be disable.
  //
  MAP_WatchdogEnable(WDT_BASE);
}

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);
}

 

if i choose board cc3200 this code compiled with out error but if i choose cc3220SF i get these errors,

 

C:\Users\user46\Documents\Energia\CC3220_Watch_Dog\CC3220_Watch_Dog.ino: In function 'void setup3()':

CC3220_Watch_Dog:36: error: 'WDT_BASE' was not declared in this scope

   bRetcode = MAP_WatchdogRunning(WDT_BASE);

                                  ^~~~~~~~

C:\Users\user46\Documents\Energia\CC3220_Watch_Dog\CC3220_Watch_Dog.ino: In function 'void WatchdogIntHandler()':

CC3220_Watch_Dog:66: error: 'WDT_BASE' was not declared in this scope

   MAP_WatchdogIntClear(WDT_BASE);

                        ^~~~~~~~

C:\Users\user46\Documents\Energia\CC3220_Watch_Dog\CC3220_Watch_Dog.ino: In function 'void WDT_IF_Init(fAPPWDTDevCallbk, unsigned int)':

CC3220_Watch_Dog:85: error: 'WDT_BASE' was not declared in this scope

   MAP_WatchdogUnlock(WDT_BASE);

                      ^~~~~~~~

C:\Users\user46\Documents\Energia\CC3220_Watch_Dog\CC3220_Watch_Dog.ino: In function 'void WDT_IF_DeInit()':

CC3220_Watch_Dog:110: error: 'WDT_BASE' was not declared in this scope

   MAP_WatchdogUnlock(WDT_BASE);

                      ^~~~~~~~

exit status 1
'WDT_BASE' was not declared in this scope

 

 

 

Share this post


Link to post
Share on other sites

Dear friends,

this is my new code and also i get some error, anybody can help me to find the solution for this ,

#include <stdlib.h>
#include "inc/hw_types.h"
#include "inc/hw_wdt.h"
#include "driverlib/wdt.h"
#include "driverlib/utils.h"
#include "driverlib/prcm.h"
#include "driverlib/interrupt.h"
#include "inc/hw_ints.h"
#include <ti/devices/cc32xx/driverlib/wdt.h>
#include <ti/drivers/watchdog/WatchdogCC32XX.h>
#include <ti/drivers/Watchdog.h>

unsigned long count;
//uint_least8_t WDT_BASE;
void setup()
{

  Serial.begin(115200);
  Serial.println("*             CC3220 Watchdog Test               *");
  
  Watchdog_Handle handle;
  Watchdog_Params params;
  uint32_t tickValue;

  Watchdog_init();

  Watchdog_Params_init(&params);
  params.resetMode = Watchdog_RESET_ON;
  params.callbackFxn = watchdogCallback;
  //handle = Watchdog_open(Watchdog_configIndex, &params);
  
  handle = Watchdog_open(Board_WATCHDOG, &params);
  if (handle == NULL) 
  {
    Serial.println("*             Error opening watchdog               *");
  }
  // Set timeout period to 100 ms
  tickValue = Watchdog_convertMsToTicks(handle, 100);
  Watchdog_setReload(handle, tickValue);
}

void loop()
{
  Serial.print("Watchdog interrupt count: ");
  Serial.println(count);
  delay(1000);

}
void watchdogCallback(UArg handle)
{
  //Watchdog_clear(handle);
  Serial.print("Watchdog: ");
  Serial.println(count);
}

 

Errorsss

C:\Users\CAS80\AppData\Local\Energia15\packages\energia\hardware\cc3220emt\5.6.2\system/source\ti/drivers/lib/drivers_cc32xx.am4g(Watchdog.om4g): In function `Watchdog_init':

/db/vtree/library/trees/mcpi/mcpi-3.30.00.13/exports/coresdk_cc32xx_3_30_00_13/source/ti/drivers/Watchdog.c:100: undefined reference to `Watchdog_count'

/db/vtree/library/trees/mcpi/mcpi-3.30.00.13/exports/coresdk_cc32xx_3_30_00_13/source/ti/drivers/Watchdog.c:100: undefined reference to `Watchdog_config'

C:\Users\CAS80\AppData\Local\Energia15\packages\energia\hardware\cc3220emt\5.6.2\system/source\ti/drivers/lib/drivers_cc32xx.am4g(Watchdog.om4g): In function `Watchdog_open':

/db/vtree/library/trees/mcpi/mcpi-3.30.00.13/exports/coresdk_cc32xx_3_30_00_13/source/ti/drivers/Watchdog.c:122: undefined reference to `Watchdog_count'

/db/vtree/library/trees/mcpi/mcpi-3.30.00.13/exports/coresdk_cc32xx_3_30_00_13/source/ti/drivers/Watchdog.c:122: undefined reference to `Watchdog_config'

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board CC3220SF-LAUNCHXL (80MHz).
 

thanks in advance

Share this post


Link to post
Share on other sites

Dear kannan,

try this code it's working fine with cc3220sf, this code reset your device when Cycles increase greater than 10, 

#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>
 

volatile unsigned long 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 Reset test");

 delay(2000);
}


void WatchdogIntHandler(void)
{
    Serial.println("Watch rest");
    Serial.println(Cycles);
    if(Cycles>=10)
    {
      Serial.println("Reseting..........");
      return;
    }
    MAP_WatchdogIntClear(WDT_BASE);
    Cycles++;

}

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...