3 Replies Latest reply on Feb 9, 2017 10:21 AM by user_1377889

    Code example: Where did WDT_Start(void) come from?


      I'm looking through the example code for BLE_Proximity01 and in main.c noticed the code to start the watchdog timer (WDT). I opened the WDT's datasheet and didn't see any reference about a Start() function. So, I searched the generated source for "CySysWdtUnlock" using GREP and found that it is defined in CyLFClk.c. Where did that come from? So, I looked at the Clocks resources and found a number of references to "LFCLK". I assume that setting them there added the code to the generated source: CyLFClk.h and CyLFClk.c, but am not sure. Then I search CyLFClk.h and find a large number of WDT functions in the WDT API section. Why wouldn't they be listed in the WDT datasheet?


      My question is, if I was going to create this from scratch, I wouldn't have a clue as to how I would do this. Is there anything that explains what is going on here? The PDF with the example code doesn't explain much about the nuts and bolts and the BLE datasheet says:


      "Note The LFCLK is used in the BLE Component only during Deep Sleep Mode and hence the ILO inaccuracy does not affect the BLE communication."


      Or, are we supposed to just use the code as supplied and not worry about being able to write this from scratch after we gain a much better understanding?

        • 1. Re: Code example: Where did WDT_Start(void) come from?

          There is a "System Reference Guide" which you find from Creator's help menu. This explains some of the functions.


          Additionally right clicking on the Start() function (rather: any function call) brings up a menu that will lead you to the declaration or definition of that function.





          • 2. Re: Code example: Where did WDT_Start(void) come from?

            Thanks Bob, that right-click thing is faster than GREP. But at a higher conceptual level, what would lead me to understand that a WDT_Start() function is needed when the Global Signal Reference datasheet doesn't mention that it's needed? And what would lead me to understand that the WDT_Start() function needs any of the function that it calls?


            The PSoC Creator System Reference Guide (SRG) provides information about watchdog timers but doesn't tie them to the Global Signal component. So maybe a cross reference to the appropriate watchdog timer sections in the SRG can be added to the Global Signal Reference. Also, I don't see anything that explains what is needed to use the other interrupts properly, so maybe cross references can be added for the others, Combined CTBm, System Performance Controller Interface, etc.


            Maybe I'm just extra dense.

            • 3. Re: Code example: Where did WDT_Start(void) come from?

              "Maybe I'm just extra dense."   Probably ;-))