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.

TMDSCNCD263: WDG : Preload value calculation

Part Number: TMDSCNCD263


Hii,

Currently, I'm using MCAL_AM263x_08.06.02 package in my project. I have a requirement to configure Wdg with 1sec timeout. 

In EB configuration , we have option to configure preload value .  In TRM , I found the formula to calculate expiration time. 

On what basis it shall be configured ?

Thanks.

  • Hi,

    On what basis it shall be configured ?

    Can you elaborate this please? Are you asking for a sample calculation? If yes please find it below

    Typically WDG is clocked with the SysClk i.e., 200MHz. However there is limitation in the formula as you proposed that the DWDPRLD (Digital Window Pre-load value) cannot be more than 4095. So we have to adjust the RTI_FCLK to match the preload value to be less than 4095. To match your 1 second expiry time I have use 20MHz clock frequency and performed the below calculation

    texp = 1 second, RTI_FCLK = 20MHz

    RTI_DWDPRLD = (20 *10^6 / 8192) - 1 = 2440.

    Now coming to how to configure the above values in the MCAL software please check the snaps below

    1. Configure the below McuClockDiv value from 0 to 9 (This will change the divider value to 10 (internally +1 is added)) which means 200MHz/(9+1) = 20Mhz is achieved.

    2. In the Wdg_PBCfg.c configure your preload value to be 2440 and launch the wdg_app example and you can see that the wdg is triggerred only every 1 second. Hope this helps.

    Thanks,

    G Kowshik

  • Hii Kowshik,

    Thanks for your explanation. 

    Regarding the clock configuration,  do we need to modify RTI_FCLK  or WDG_CLK ? 

  • Hi,

    You should change the WDG clock as far as I know. Please experiment with the WDG clock initially because looking at the clock tree I see that WDG has it's owm clock input.

    Thanks

  • Hii,

    WDG clock is configured to 20Mhz .  It works as expected.  

    Now I able to get 1sec timeout. 

    Whatever timeout value passed through Wdg_SetTriggerCondition doesn't create any impact.  Could you tell me the use case of this API?

    Thanks.

  • Hi Palani,

    Currently wdg_setTriggerCondition must be given with the expiry time that you need. It basically makes the first load of the DWDPRLD into the WDG and any subsequent triggers or WDG services must be done using the API Wdg_Trigger. However, it seems in the upcoming releases i.e., v 8.6.2.1 this been fixed adhering to the autosar standards where the SetTriggerCondition it self makes the Wdg Services.

    Thanks,

    G Kowshik

  • Hii,

    you mean to say , The Wdg expiry time that means timeout value shall be changed even after Wdg is enabled (Run time) ?

    Thanks.

  • Hi Palani,

    No, timeout value never changes once configured. Wdg_Trigger basically writes a particular key sequence into the WDG which basically resets the counter and makes the WDG to count down. 

    This operation is done using the Wdg_Trigger API, you can check this API in the sources.