MT_StartWDT

■Description

Monitoring by the watchdog timer is started.
Before calling this function, it is necessary to initialize and set it by MT_SetWDT function.
After executing this function,
if you do not call MT_StopWDT or MT_TickWDT before the timeout value specified in the WDTVAL structure elapses,
the system will be reset.

■Synopsis

MT_StartWDT(fd, pwdt)

■Argument

fd
[C/C++] int
[Python] ctypes.c_int
Please specify handle acquired by MT_Open function.
pwdt
[C/C++] PWDTVAL
[Python] ctypes.POINTER(WDTVAL)
Specify Pointer to the structure storing WDT setting information.
For the pwdt structure, see MT_SetWDT.

■RETURN VALUE

[C/C++] int
[Python] ctypes.c_int
If the function succeeds, NO_ERROR is returned.
If the function fails, DRIVER_FAIL is returned.
The other errors : Error code details

■Note

There is about +/- 2 timeout tolerance by WDT.
When setting for 30 seconds, set the WDT retrigger before 28 seconds elapse.
If there is no retrigger, the system will be reset by WDT timeout.
System reset due to WDT time-up does not guarantee the data being written to Disk.

■Sample Program Code

[C/C++]
  int fd;
  int ret;
  WDTVAL wdt;

  wdt.ucTimeOut = 120;
  wdt.lTickCount = 10;

  if ( (fd = MT_Open(NULL) ) < 0) {
    printf("Faild to open i2c port\n");
    return 1;
  }

  ret = MT_SetWDT(fd, &wdt);
  if (ret != 0) {
      printf("MT_SetWDT error");
  }
  else {
      ret = MT_StartWDT(fd, &wdt);
      if (ret != 0) {
          printf("MT_StartWDT error");
      }
  }

  MT_Close(fd);
  
[Python]
  import mtdll_arm

  wdt = WDTVAL();

  wdt.ucTimeOut = int(sys.argv[2], 0);
  wdt.lTickCount = 10;

  fd = mtdll_arm.MT_Open(None);

  ret = mtdll_arm.MT_SetWDT(fd, wdt);
  if ret != 0:
      print("MT_SetWDT error");
  else:
      ret = MT_StartWDT(fd, wdt);
      if ret != 0:
          printf("MT_StartWDT error");

  mtdll_arm.MT_Close(fd);
  



Function List