Configure WDOG within 128 Bus Clocks Clarification

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Configure WDOG within 128 Bus Clocks Clarification

Jump to solution
109 Views
sean_dvorscak
Contributor III

I am experiencing unexpected WDOG behavior according to my understanding of the reference manual in regard to the following:

"All watchdog control bits, timeout value, and window value are write-once after
reset within 128 bus clocks. This means that after a write has occurred they cannot
be changed unless a reset occurs."

My initial interpretation of this is that you must configure the WDOG within the first 128 bus clocks after reset, or it will use the default configuration with UPDATE=0. This will then prevent you from re-configuring the WDOG again.

I however am experiencing something different. Since the KE1 out of reset runs the Bus and Core clock at the same frequency, I decided to look at the CYCLECOUNTER in the IAR debugger when I reconfigure the WDOG, as I thought it would tell me how many bus clocks have also passed since reset. It showed 144 cycles had passed since release from reset. So I started adding longer and longer delay loops at the start of the function to see if it would still allow me to reconfigure well past 144 cycles.

No matter how long the delay, as long as it was below the default 8ms timeout of the WDOG, it would successfully reconfigure the WDOG. I observed this behavior with, and without the debugger, just to ensure the debugger did not play any role. I was also able to confirm timing via strobing the reset signal with Oscope.

So now my understanding of the reference manual is that you can reconfigure the WDOG once out of reset. And once you perform the first write to the WDOG, you get 128 bus clocks to reconfigure the remaining register fields.

For example, lets say I wait 1000 bus clocks out of reset and then configures the WDOG_CS register. I then get 128 bus clocks after configuring the WDOG_CS to configure the WDOG_TOVAL. Once TOVAL is configured, the new configuration takes effect.

Is this the correct interpretation of the reference manual? Or is my previous interpretation correct where you get 128 bus clocks out of reset, or the default configuration takes effect?

0 Kudos
Reply
1 Solution
60 Views
Celeste_Liu
NXP Employee
NXP Employee

Hello @sean_dvorscak ,

Thanks for you post.

You may refer to section "30.4.3.2.1 Unlocking the Watchdog" and section "30.5.2 Configure Watchdog" in KE1xFP100M168SF0RM.

Celeste_Liu_0-1780382496259.png

 

Celeste_Liu_1-1780382807861.png

The correct interpretation appears to be as follows:

  • After reset, the WDOG is enabled and operates with its reset-default settings.
  • The WDOG configuration registers are still available for an initial configuration sequence.
  • Once the watchdog is unlocked , the remaining configuration registers must be written within 128 bus clocks .
  • If UPDATE=0, then after that initial configuration is completed, the WDOG configuration cannot be changed again until the next reset.
  • If UPDATE=1, the WDOG can be unlocked and reconfigured again later, with the same 128 bus clock window applying after each unlock.

This interpretation is consistent with your measurements: even when more than 128 bus clocks had elapsed since reset, the WDOG could still be reconfigured successfully, provided this happened before the default watchdog timeout expired.

In other words, the 128 bus clock configuration window is associated with the unlock sequence, not simply with the elapsed time since reset release.

If no new configuration is completed, the WDOG continues operating with its reset default settings.

Hope it helps.

BR

Celeste

 

------------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the "ACCEPT AS SOLUTION" button. Thank you!
------------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
Reply
4 Replies
61 Views
Celeste_Liu
NXP Employee
NXP Employee

Hello @sean_dvorscak ,

Thanks for you post.

You may refer to section "30.4.3.2.1 Unlocking the Watchdog" and section "30.5.2 Configure Watchdog" in KE1xFP100M168SF0RM.

Celeste_Liu_0-1780382496259.png

 

Celeste_Liu_1-1780382807861.png

The correct interpretation appears to be as follows:

  • After reset, the WDOG is enabled and operates with its reset-default settings.
  • The WDOG configuration registers are still available for an initial configuration sequence.
  • Once the watchdog is unlocked , the remaining configuration registers must be written within 128 bus clocks .
  • If UPDATE=0, then after that initial configuration is completed, the WDOG configuration cannot be changed again until the next reset.
  • If UPDATE=1, the WDOG can be unlocked and reconfigured again later, with the same 128 bus clock window applying after each unlock.

This interpretation is consistent with your measurements: even when more than 128 bus clocks had elapsed since reset, the WDOG could still be reconfigured successfully, provided this happened before the default watchdog timeout expired.

In other words, the 128 bus clock configuration window is associated with the unlock sequence, not simply with the elapsed time since reset release.

If no new configuration is completed, the WDOG continues operating with its reset default settings.

Hope it helps.

BR

Celeste

 

------------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the "ACCEPT AS SOLUTION" button. Thank you!
------------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply
40 Views
sean_dvorscak
Contributor III

Thank you for the clarification.
Glad to know I have more than 128 bus clocks out of reset to configure WDOG.
If they ever make a new revision of KE1xFP100M168SF0RM, I'd like to suggest removing the "... within 128 bus clocks." from the first sentence of section 30.4.3.1.
Appreciate the suggestion might be silly, but I only suggest it because I found some misinformation online citing that wording to suggest you only get 128 bus clocks to configure WDOG out of reset. It also unfortunately makes the Google AI overview regurgitate the same misinformation (... gotta love the future ). Which is why I had to ask the question here myself.

0 Kudos
Reply
24 Views
Celeste_Liu
NXP Employee
NXP Employee

Understood. Unfortunately, to the best of my knowledge, there is no new roadmap for the Kinetis family. We have recently introduced the MCX family, which you may consider exploring if you’re interested. MCX Arm Cortex-M Industrial and IoT MCUs | NXP Semiconductors

0 Kudos
Reply
75 Views
db16122
Contributor III

 

There are certain command sequence need to follow in order to update WATCHDOG setting.I dont know where the 128 bus clocks come from but take the K80 Sub-Family Reference Manual, Rev. 4, 09/2015 for example:

As long as ALLOW_UPDATE in the watchdog control register is set, you can unlock and modify the write-once-only control and configuration registers:
1. Write 0xC520 followed by 0xD928 within 20 bus clock cycles to a specific unlock register (WDOG_UNLOCK).
2. Wait one bus clock cycle. You cannot update registers on the bus clock cycle immediately following the write of the unlock sequence.
3. An update window equal in length to the watchdog configuration time (WCT) opens. Within this window, you can update the configuration and control register bits.

These register bits can be modified only once after unlocking.If none of the configuration and control registers is updated within the update window,the watchdog issues a reset, that is, interrupt-then-reset, to the system. Trying to unlock the watchdog within the WCT after an initial unlock has no effect.

%3CLINGO-SUB%20id%3D%22lingo-sub-2374540%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EConfigure%20WDOG%20within%20128%20Bus%20Clocks%20Clarification%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2374540%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20am%20experiencing%20unexpected%20WDOG%20behavior%20according%20to%20my%20understanding%20of%20the%20reference%20manual%20in%20regard%20to%20the%20following%3A%3C%2FP%3E%3CP%3E%22All%20watchdog%20control%20bits%2C%20timeout%20value%2C%20and%20window%20value%20are%20write-once%20after%3CBR%20%2F%3Ereset%20within%20128%20bus%20clocks.%20This%20means%20that%20after%20a%20write%20has%20occurred%20they%20cannot%3CBR%20%2F%3Ebe%20changed%20unless%20a%20reset%20occurs.%22%3C%2FP%3E%3CP%3EMy%20initial%20interpretation%20of%20this%20is%20that%20you%20must%20configure%20the%20WDOG%20within%20the%20first%20128%20bus%20clocks%20after%20reset%2C%20or%20it%20will%20use%20the%20default%20configuration%20with%20UPDATE%3D0.%20This%20will%20then%20prevent%20you%20from%20re-configuring%20the%20WDOG%20again.%3C%2FP%3E%3CP%3EI%20however%20am%20experiencing%20something%20different.%20Since%20the%20KE1%20out%20of%20reset%20runs%20the%20Bus%20and%20Core%20clock%20at%20the%20same%20frequency%2C%20I%20decided%20to%20look%20at%20the%20CYCLECOUNTER%20in%20the%20IAR%20debugger%20when%20I%20reconfigure%20the%20WDOG%2C%20as%20I%20thought%20it%20would%20tell%20me%20how%20many%20bus%20clocks%20have%20also%20passed%20since%20reset.%20It%20showed%20144%20cycles%20had%20passed%20since%20release%20from%20reset.%20So%20I%20started%20adding%20longer%20and%20longer%20delay%20loops%20at%20the%20start%20of%20the%20function%20to%20see%20if%20it%20would%20still%20allow%20me%20to%20reconfigure%20well%20past%20144%20cycles.%3C%2FP%3E%3CP%3ENo%20matter%20how%20long%20the%20delay%2C%20as%20long%20as%20it%20was%20below%20the%20default%208ms%20timeout%20of%20the%20WDOG%2C%20it%20would%20successfully%20reconfigure%20the%20WDOG.%20I%20observed%20this%20behavior%20with%2C%20and%20without%20the%20debugger%2C%20just%20to%20ensure%20the%20debugger%20did%20not%20play%20any%20role.%20I%20was%20also%20able%20to%20confirm%20timing%20via%20strobing%20the%20reset%20signal%20with%20Oscope.%3C%2FP%3E%3CP%3ESo%20now%20my%20understanding%20of%20the%20reference%20manual%20is%20that%20you%20can%20reconfigure%20the%20WDOG%20once%20out%20of%20reset.%20And%20once%20you%20perform%20the%20first%20write%20to%20the%20WDOG%2C%20you%20get%20128%20bus%20clocks%20to%20reconfigure%20the%20remaining%20register%20fields.%3C%2FP%3E%3CP%3EFor%20example%2C%20lets%20say%20I%20wait%201000%20bus%20clocks%20out%20of%20reset%20and%20then%20configures%20the%20WDOG_CS%20register.%20I%20then%20get%20128%20bus%20clocks%20after%20configuring%20the%20WDOG_CS%20to%20configure%20the%20WDOG_TOVAL.%20Once%20TOVAL%20is%20configured%2C%20the%20new%20configuration%20takes%20effect.%3C%2FP%3E%3CP%3EIs%20this%20the%20correct%20interpretation%20of%20the%20reference%20manual%3F%20Or%20is%20my%20previous%20interpretation%20correct%20where%20you%20get%20128%20bus%20clocks%20out%20of%20reset%2C%20or%20the%20default%20configuration%20takes%20effect%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2374832%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Configure%20WDOG%20within%20128%20Bus%20Clocks%20Clarification%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2374832%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F90401%22%20target%3D%22_blank%22%3E%40sean_dvorscak%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%0A%3CP%3EThanks%20for%20you%20post.%3C%2FP%3E%0A%3CP%3EYou%20may%20refer%20to%20section%20%22%3CSTRONG%3E30.4.3.2.1%20Unlocking%20the%20Watchdog%22%20%3C%2FSTRONG%3Eand%20section%3CSTRONG%3E%20%22%3C%2FSTRONG%3E%3CSTRONG%3E30.5.2%20Configure%20Watchdog%22%26nbsp%3B%3C%2FSTRONG%3Ein%20KE1xFP100M168SF0RM.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Celeste_Liu_0-1780382496259.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Celeste_Liu_0-1780382496259.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Celeste_Liu_0-1780382496259.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F387503i26320BB1F631E0DB%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Celeste_Liu_0-1780382496259.png%22%20alt%3D%22Celeste_Liu_0-1780382496259.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Celeste_Liu_1-1780382807861.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Celeste_Liu_1-1780382807861.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Celeste_Liu_1-1780382807861.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F387504i88A082AE30B69BAB%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Celeste_Liu_1-1780382807861.png%22%20alt%3D%22Celeste_Liu_1-1780382807861.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EThe%20correct%20interpretation%20appears%20to%20be%20as%20follows%3A%3C%2FP%3E%0A%3CUL%20class%3D%22%22%3E%0A%3CLI%20class%3D%22%22%3EAfter%20reset%2C%26nbsp%3Bthe%20WDOG%20is%20enabled%20and%20operates%20with%20its%20reset-default%20settings.%3C%2FLI%3E%0A%3CLI%20class%3D%22%22%3EThe%20WDOG%20configuration%20registers%20are%20still%20available%20for%20an%26nbsp%3Binitial%20configuration%20sequence.%3C%2FLI%3E%0A%3CLI%20class%3D%22%22%3EOnce%20the%20watchdog%20is%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%20class%3D%22%22%3Eunlocked%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%2C%20the%20remaining%20configuration%20registers%20must%20be%20written%20within%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%20class%3D%22%22%3E128%20bus%20clocks%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E.%3C%2FLI%3E%0A%3CLI%20class%3D%22%22%3E%3CFONT%3EIf%3CSPAN%3E%26nbsp%3BUPDATE%3D0%3C%2FSPAN%3E%2C%20then%20after%20that%20initial%20configuration%20is%20completed%2C%20the%20WDOG%20configuration%20cannot%20be%20changed%20again%20until%20the%20next%20reset.%3C%2FFONT%3E%3C%2FLI%3E%0A%3CLI%20class%3D%22%22%3E%3CFONT%3EIf%3CSPAN%3E%26nbsp%3BUPDATE%3D1%3C%2FSPAN%3E%2C%20the%20WDOG%20can%20be%20unlocked%20and%20reconfigured%20again%20later%2C%20with%20the%20same%20128%20bus%20clock%20window%20applying%20after%20each%20unlock.%3C%2FFONT%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CFONT%3EThis%20interpretation%20is%20consistent%20with%20your%20measurements%3A%20even%20when%20more%20than%20128%20bus%20clocks%20had%20elapsed%20since%20reset%2C%20the%20WDOG%20could%20still%20be%20reconfigured%20successfully%2C%20provided%20this%20happened%20before%20the%20default%20watchdog%20timeout%20expired.%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EIn%20other%20words%2C%20the%20128%20bus%20clock%20configuration%20window%20is%20associated%20with%20the%20unlock%20sequence%2C%20not%20simply%20with%20the%20elapsed%20time%20since%20reset%20release.%3C%2FP%3E%0A%3CP%3EIf%20no%20new%20configuration%20is%20completed%2C%20the%20WDOG%20continues%20operating%20with%20its%20reset%20default%20settings.%3C%2FP%3E%0A%3CP%3EHope%20it%20helps.%3C%2FP%3E%0A%3CP%3EBR%3C%2FP%3E%0A%3CP%3ECeleste%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E------------------------------------------------------------------------------------------------------------------------%3CBR%20%2F%3ENote%3A%20If%20this%20post%20answers%20your%20question%2C%20please%20click%20the%20%22ACCEPT%20AS%20SOLUTION%22%20button.%20Thank%20you!%3CBR%20%2F%3E------------------------------------------------------------------------------------------------------------------------%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2374660%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Configure%20WDOG%20within%20128%20Bus%20Clocks%20Clarification%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2374660%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CBR%20%2F%3E%3CP%3EThere%20are%20certain%20command%20sequence%20need%20to%20follow%20in%20order%20to%20update%20WATCHDOG%20setting.I%20dont%20know%20where%20the%20128%20bus%20clocks%20come%20from%20but%20take%20the%20K80%20Sub-Family%20Reference%20Manual%2C%20Rev.%204%2C%2009%2F2015%20for%20example%EF%BC%9A%3C%2FP%3E%3CP%3EAs%20long%20as%20ALLOW_UPDATE%20in%20the%20watchdog%20control%20register%20is%20set%2C%20you%20can%20unlock%20and%20modify%20the%20write-once-only%20control%20and%20configuration%20registers%3A%3CBR%20%2F%3E1.%20Write%200xC520%20followed%20by%200xD928%20within%2020%20bus%20clock%20cycles%20to%20a%20specific%20unlock%20register%20(WDOG_UNLOCK).%3CBR%20%2F%3E2.%20Wait%20one%20bus%20clock%20cycle.%20You%20cannot%20update%20registers%20on%20the%20bus%20clock%20cycle%20immediately%20following%20the%20write%20of%20the%20unlock%20sequence.%3CBR%20%2F%3E3.%20An%20update%20window%20equal%20in%20length%20to%20the%20watchdog%20configuration%20time%20(WCT)%20opens.%20Within%20this%20window%2C%20you%20can%20update%20the%20configuration%20and%20control%20register%20bits.%3C%2FP%3E%3CP%3EThese%20register%20bits%20can%20be%20modified%20only%20once%20after%20unlocking.If%20none%20of%20the%20configuration%20and%20control%20registers%20is%20updated%20within%20the%20update%20window%2Cthe%20watchdog%20issues%20a%20reset%2C%20that%20is%2C%20interrupt-then-reset%2C%20to%20the%20system.%20Trying%20to%20unlock%20the%20watchdog%20within%20the%20WCT%20after%20an%20initial%20unlock%20has%20no%20effect.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2375150%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Configure%20WDOG%20within%20128%20Bus%20Clocks%20Clarification%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2375150%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EThank%20you%20for%20the%20clarification.%3CBR%20%2F%3EGlad%20to%20know%20I%20have%20more%20than%20128%20bus%20clocks%20out%20of%20reset%20to%20configure%20WDOG.%3CBR%20%2F%3EIf%20they%20ever%20make%20a%20new%20revision%20of%20KE1xFP100M168SF0RM%2C%20I'd%20like%20to%20suggest%20removing%20the%20%22...%20within%20128%20bus%20clocks.%22%20from%20the%20first%20sentence%20of%20section%2030.4.3.1.%3CBR%20%2F%3EAppreciate%20the%20suggestion%20might%20be%20silly%2C%20but%20I%20only%20suggest%20it%20because%20I%20found%20some%20misinformation%20online%20citing%20that%20wording%20to%20suggest%20you%20only%20get%20128%20bus%20clocks%20to%20configure%20WDOG%20out%20of%20reset.%20It%20also%20unfortunately%20makes%20the%20Google%20AI%20overview%20regurgitate%20the%20same%20misinformation%20(...%20gotta%20love%20the%20future%20%3CLI-EMOJI%20id%3D%22lia_slightly-smiling-face%22%20title%3D%22%3Aslightly_smiling_face%3A%22%3E%3C%2FLI-EMOJI%3E%20).%20Which%20is%20why%20I%20had%20to%20ask%20the%20question%20here%20myself.%3C%2FP%3E%3C%2FLINGO-BODY%3E