This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC1310: cc1310watchdog如何配置才是最恒缺德,目前没有喂狗为什么没有复位?

Part Number: CC1310
Other Parts Discussed in Thread: CC2541

关于TI  CC1310遇到一个问题,就是会出现长时间掉线的情况,我这边初步判定是程序跑死看门狗没起作用,测试发现,看门狗没起作用,不知道是我这边配置有问题还是有什么限制

  • 您好,

    如果是低功耗的话使用PM3模式下,内外部的32k晶振不起作用是无法使用看门狗的。

    建议您这边先使用TI提供的例程去跑看门狗程序,没问题之后,再去进行您这边的项目移植。

  • /*!*****************************************************************************
     *  @file       Watchdog.h
     *
     *  @brief      Watchdog driver interface
     *
     *  @anchor ti_drivers_Watchdog_Overview
     *  # Overview #
     *
     *  A watchdog timer can be used to generate a reset signal if a system has
     *  become unresponsive. The Watchdog driver simplifies configuring and
     *  starting the watchdog peripherals. The watchdog peripheral can be
     *  configured with resets either on or off and a user-specified timeout
     *  period.
     *
     *  When the watchdog peripheral is configured not to generate a reset, it
     *  can be used to cause a hardware interrupt at a programmable interval.
     *  The driver provides the ability to specify a user-provided callback
     *  function that is called when the watchdog causes an interrupt.
     *
     *  The Watchdog driver simplifies configuring and starting the Watchdog
     *  peripherals. The Watchdog can be set up to produce a reset signal after a
     *  timeout, or simply cause a hardware interrupt at a programmable interval.
     *  The driver provides the ability to specify a callback function that is
     *  called when the Watchdog causes an interrupt.
     *
     *  When resets are turned on, it is the user application's responsibility to
     *  call Watchdog_clear() in order to clear the Watchdog and prevent a reset.
     *  Watchdog_clear() can be called at any time.
     *
     *  @anchor ti_drivers_Watchdog_Usage
     *  # Usage #
     *
     *  This section will cover driver usage.
     *  @anchor ti_drivers_Watchdog_Synopsis
     *  ## Synopsis #
     *
     *  Open the driver with default settings:
     *  @code
     *  Watchdog_Handle watchdogHandle;
     *
     *  Watchdog_init();
     *  watchdogHandle = Watchdog_open(WATCHDOG_INDEX, NULL);
     *  if (watchdogHandle == NULL) {
     *      // Spin forever
     *      while(1);
     *  }
     *  @endcode
     *
     *  The Watchdog driver must be initialized by calling Watchdog_init(),
     *  before any other Watchdog APIs can be called.
     *  Once the watchdog is initialized, a Watchdog object can be created
     *  through the following steps:
     *  -   Create and initialize the #Watchdog_Params structure.
     *  -   Assign desired values to parameters.
     *  -   Call Watchdog_open().
     *  -   Save the Watchdog_Handle returned by Watchdog_open(). This will be
     *  used to interact with the Watchdog object just created.
     *
     *  To have a user-defined function run at the hardware interrupt caused by
     *  a watchdog timer timeout, define a function of the following type:
     *  @code
     *    typedef void (*Watchdog_Callback)(uintptr_t);
     *  @endcode
     *  Then pass the function to Watchdog_open() through the #Watchdog_Params
     *  structure.
     *
     *  An example of the Watchdog creation process that uses a callback
     *  function:
     *  @anchor ti_drivers_Watchdog_example_callback
     *  @code
     *  void UserCallbackFxn(Watchdog_Handle handle)
     *  {
     *      printf("Watchdog timer triggered!\n");
     *      releaseResources();
     *  }
     *
     *  ...
     *
     *  Watchdog_Params params;
     *  Watchdog_Handle watchdogHandle;
     *
     *  Watchdog_init();
     *
     *  Watchdog_Params_init(&params);
     *  params.resetMode = Watchdog_RESET_ON;
     *  params.callbackFxn = (Watchdog_Callback) UserCallbackFxn;
     *
     *  watchdogHandle = Watchdog_open(Board_WATCHDOG0, &params);
     *  if (watchdogHandle == NULL) {
     *     // Error opening Watchdog
     *     while (1);
     *  }
     *
     *  @endcode
     *
     *  If no #Watchdog_Params structure is passed to Watchdog_open(), the
     *  default values are used. By default, the Watchdog driver has resets
     *  turned on, no callback function specified, and stalls the timer at
     *  breakpoints during debugging.
     *
     *  Options for the resetMode parameter are #Watchdog_RESET_ON and
     *  #Watchdog_RESET_OFF. The latter allows the watchdog to be used like
     *  another timer interrupt. When resetMode is #Watchdog_RESET_ON, it is up
     *  to the application to call Watchdog_clear() to clear the Watchdog
     *  interrupt flag to prevent a reset. Watchdog_clear() can be called at
     *  any time.
     *
     *  @anchor ti_drivers_Watchdog_Examples
     *  # Examples
     *  - @ref ti_drivers_Watchdog_Synopsis "Default Example"
     *  - @ref ti_drivers_Watchdog_example_callback "Callback Function before watchdog reset"
     *
     *  @anchor ti_drivers_Watchdog_Configuration
     *  # Configuration
     *
     *  Refer to the @ref driver_configuration "Driver's Configuration" section
     *  for more information.
     *
     *******************************************************************************
     */

    在TI提供的watchdog.h中也进行了看门狗的说明

  • 目前正在按照例程分析,例程无法直接运行,需要修改,但是目前核对配置基本没有差异,低功耗PM3模式下是看门狗无法使用看门的么?

  • 对的,低功耗PM3无法使用的,PM3没有使用32k晶振所以无法使用看门狗

  • 如果我正常配置看门狗,每个1秒醒来一次,那休眠状态下看门狗时间停滞么?还是一直在运行只是不会执行看门狗功能。

  • 文档内没找到相关低功耗下看门都的介绍,目前考虑外加32K晶振,供看门狗使用,但是如何改为使用外部晶振呢?

  • 您好,实在抱歉上面回复有误

    关于CC1310的功耗模式介绍在这边,跟PM3模式无关,那个PM3是cc2541的

  • 在1256页有说明的,关于文档您可以点上面我为您提供的链接,希望可以帮助到您