J784S4XEVM: How to utilize watchdog in U-Boot and Linux?

Part Number: J784S4XEVM

Tool/software:

Hi,

I am trying to utilize the watchdog in U-Boot.

Start the watchdog in U-Boot and stop it in Linux. If there is a boot-up issue in Linux, the watchdog will help to reset the system.

After reading, I know that MCU R5 ROM starts a watchdog timer, and SYSFW or TIFS services it, but I can't find a good doc to explain how to do it in U-Boot and Linux.

So I come to the main domain watchdog, as explained in the related question (https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1261103/faq-j784s4xevm-how-to-enable-main-domain-watchdog).

I am working based on SDK 10.0.0, I checked that, the patches that are attached to the related question already exist in SDK 10.0.0. (I use "patch" later to mention the patches attached in the related question.)

There is only one difference, in the patch it is:

+ wkup_i2c0_pins_default: wkup-i2c0-pins-default {
+ u-boot,dm-spl;
+ pinctrl-single,pins = <
+ J784S4_WKUP_IOPAD(0x104, PIN_INPUT, 0) /* (N33) WKUP_I2C0_SCL */
+ J784S4_WKUP_IOPAD(0x104, PIN_INPUT, 0) /* (N35) WKUP_I2C0_SDA */
+ >;
+ };

but in the SDK 10.0.0 codes, it is

wkup_i2c0_pins_default: wkup-i2c0-default-pins {
bootph-all;
pinctrl-single,pins = <
J721S2_WKUP_IOPAD(0x98, PIN_INPUT, 0) /* (N33) WKUP_I2C0_SCL */
J721S2_WKUP_IOPAD(0x9c, PIN_INPUT, 0) /* (N35) WKUP_I2C0_SDA */
>;
};

But it doesn't matter, I tried both, none of them works!

I added a watchdog in j784s4_evm_a72_defconfig.

CONFIG_WDT=y
CONFIG_CMD_WDT=y
CONFIG_WDT_K3_RTI=y
CONFIG_WATCHDOG_AUTOSTART=n
After all this, I tried it in U-Boot, but it never worked, I can start it, but it never expires, nor reboots the board.
=> wdt list
watchdog@2200000 (rti_wdt)
watchdog@2210000 (rti_wdt)
watchdog@2220000 (rti_wdt)
watchdog@2230000 (rti_wdt)
watchdog@2240000 (rti_wdt)
watchdog@2250000 (rti_wdt)
watchdog@2260000 (rti_wdt)
watchdog@2270000 (rti_wdt)
=> wdt dev watchdog@2200000
=> wdt start 10000
WDT: Started watchdog@2200000 with servicing every 1000ms (10s timeout)
=>
=> wdt reset
Resetting watchdog timer failed (-1)
Could you please give me some guidance here? Thank you!
BR,
Peng

  • HI Peng,

    We do not validate watchdog reset from U-Boot. Linux works well. Could you first check if that is working at your end?
    Which SDK are you using? What is the use case for U-boot triggering watchdog as this is a transient phase before HLOS boots.

    - Keerthy

  • Hi Keerthy,

    Thank you for your quick response!

    I am using SDK v10.0.0.

    In the product, we have an AB swap mechanism, we may update u-boot.img, so we want to start the watchdog in tispl.bin, if anything (including u-boot.img or HLOS) fails boot up, tispl.bin can roll back to the older version.

    I just found out that watchdog actually works!

    But as the frequency is wrong, it actually waits for a really really long time!

    The driver got frequency is 19200000HZ, but after counting the counters, I think it is close to 32768HZ.

    I use "wdt start 10000" command to start the watchdog, the unit is ms, so my idea is to wait for 10 seconds, but because of the wrong frequency, it actually waits for 5859 seconds.

    I checked the codes, it gets the freq through the TI SCI module, which is a message-based communication.

    Do you have a gut feeling about why the freq is wrong here?

    And another interesting but very strange issue is that, when I enable  CONFIG_WDT_K3_RTI, the 7 other CPU cores (not the main CPU core) can't boot up.

    It seems to have something to do with the watchdog, but the CPU still can't boot up even after, I comment out most of the watchdog codes, just leaving the empty functions there. It only works, after I disable it by setting CONFIG_WDT_K3_RTI=n.

    Any ideas about this?

    Thank you for your support! Have a nice day!

    BR,

    Peng

  • Hi Peng,

    I checked the codes, it gets the freq through the TI SCI module, which is a message-based communication.

    Do you have a gut feeling about why the freq is wrong here?

    If you are enabling tiboot3.bin at R5 SPL stage then driver cannot request TISCI services as DM is not yet loaded.
    Where are you trying to enable watchdog?

    It seems to have something to do with the watchdog, but the CPU still can't boot up even after, I comment out most of the watchdog codes, just leaving the empty functions there. It only works, after I disable it by setting CONFIG_WDT_K3_RTI=n.

    Any ideas about this?

    As told earlier we have not validated WDT in U-Boot. This behavior is not validated. 

    - Keerthy

  • Hi Keerthy,

    1. I am now testing the watchdog in cmd of u-boot.img, and will add it in tispl.bin, it is after the R5 SPL stage, so it should work.

    2. Correct me if I am wrong, but I don't see a big issue with using a watchdog in UBoot, as it is similar in the Linux environment.

    If watchdog can't be used during boot up, is there any way to make sure newly downloaded UBoot and HLOS boot up without any issue? so the board can roll back to the older version.

    Any help will be much appreciated! Thank you!

    BR,

    Peng

  • Hi Peng,

    It should be possible to enable watchdog in U-Boot. Current SDK doesn't support. Try to make sure that dts are same in both Linux and U-Boot. Seems like somehow clock is not working as expected as per your findings in U-Boot.

    Best Regards,

    Keerthy 

  • Hi Keerthy,

    Thank you! I will have a look at the clock.

    BR,

    Peng