none
Enable Watchdog for iMX51 RRS feed

  • Question

  • Hi all,

    iMX51 + WinEC700.

    I'd like to enable the watchdog since I guess is not running.

    In the c:\WINCE700\platform\common\src\soc\COMMON_FSL_V3\OAL\COMMON\TIMER\EPIT\timer.c file i've found that the InitWatchDogtimer() function is conditioned by the ENABLE_WATCH_DOG symbol.

    How can i define it without touching the common files?


    SteMMo

    Friday, March 29, 2013 11:39 AM

Answers

  • Hi SteMMo,

    Add environment variable "ENABLE_WATCH_DOG".

    Now Goto:

    c:\WINCE700\platform\common\src\soc\COMMON_FSL_V3\OAL\COMMON\TIMER\EPIT\sources


    Add following lines:


    !IF "$(ENABLE_WATCH_DOG)"=="1"
    CDEFINES=$(CDEFINES) -DENABLE_WATCH_DOG
    !ENDIF

    With regards,

    Kavya D C

    • Proposed as answer by Keshava GN Friday, March 29, 2013 1:13 PM
    • Marked as answer by SteMMo Friday, March 29, 2013 1:21 PM
    Friday, March 29, 2013 12:14 PM

All replies

  • Did you try to run it ?

    Here's my code:

    #define WATCHDOG_NAME L"wd_critproc"

    #define WATCHDOG_REFRESH_TIME 20000 //60s
    #define WATCHDOG_WAIT_TIME 30000 //10s

    HANDLE hThread;

    HANDLE g_hWatchDogTimer = NULL; g_hWatchDogTimer = CreateWatchDogTimer(pszWatchDogName, WATCHDOG_REFRESH_TIME, WATCHDOG_WAIT_TIME, WATCHDOG_DEFAULT_ACTION, 0, 0); DEBUGMSG(ZONE_INIT,(L"WATCHDOG: Starting new watchdog\r\n")); if (! g_hWatchDogTimer) { DEBUGMSG(ZONE_ERROR,( L"WATCHDOG: Invalid NULL handle, Unable to create watchdog!\r\n")); return 0; } if (GetLastError() == ERROR_ALREADY_EXISTS) { DEBUGMSG(ZONE_ERROR,( L"WATCHDOG: WatchDog with this name already exists," L"create watchdog failed\r\n")); return 0; } if (!StartWatchDogTimer(g_hWatchDogTimer, 0)) { DEBUGMSG(ZONE_ERROR,( L"WATCHDOG: StartWatchDogTimer failed," L"GetLastError returned 0x%x\r\n", GetLastError())); CloseHandle(g_hWatchDogTimer); return 0; } hThread = CreateThread(NULL, 0, WatchDogTimeoutThread, NULL , 0, NULL); CloseHandle(hThread); DEBUGMSG(ZONE_INIT,(L"WATCHDOG: Watchdog timer started successfully\r\n"));


    When you close the handle g_hWatchDogTimer you should immediately timeout the watchdog, so iMX should be restarted. You can find more information in this link:

    http://msdn.microsoft.com/en-us/library/ee482966.aspx



    • Edited by Pawel W Z Friday, March 29, 2013 12:18 PM
    Friday, March 29, 2013 12:11 PM
  • Hi SteMMo,

    Add environment variable "ENABLE_WATCH_DOG".

    Now Goto:

    c:\WINCE700\platform\common\src\soc\COMMON_FSL_V3\OAL\COMMON\TIMER\EPIT\sources


    Add following lines:


    !IF "$(ENABLE_WATCH_DOG)"=="1"
    CDEFINES=$(CDEFINES) -DENABLE_WATCH_DOG
    !ENDIF

    With regards,

    Kavya D C

    • Proposed as answer by Keshava GN Friday, March 29, 2013 1:13 PM
    • Marked as answer by SteMMo Friday, March 29, 2013 1:21 PM
    Friday, March 29, 2013 12:14 PM
  • Of course you can enable it by defining ENABLE_WATCH_DOG in environment variables. Take a look into  oalilib\sources file in iMX51_EVK

    !IF "$(ENABLE_WATCH_DOG)"=="1"
    CDEFINES=$(CDEFINES) -DENABLE_WATCH_DOG
    !ENDIF

    • Marked as answer by SteMMo Friday, March 29, 2013 1:21 PM
    • Unmarked as answer by SteMMo Friday, March 29, 2013 1:21 PM
    Friday, March 29, 2013 12:22 PM
  • Yes!

    It was sufficient to define the environment variables .. the source files were ready to compile the files with this symbol --

    PS: under the oallib\sources is useless ..


    SteMMo


    • Edited by SteMMo Friday, March 29, 2013 1:22 PM
    Friday, March 29, 2013 1:21 PM