6 Replies Latest reply on Dec 12, 2019 12:34 PM by JeHu_3414236

    PSoC62 MCWDT cannot start

    JeHu_3414236

      Under certain conditions I cannot start MCWDT by calling Cy_MCWDT_Enable() on my custom board.  Cy_MCWDT_GetEnabledStatus() always returns 0.  This only happens when I connect a J-Link and power off the PSoC.  When I power it back on I see this condition.  Peripherals like SPI, UART and USB are working.  Even after resetting the PSoC with J-Link it will have this problem.  The only way to recover is to disconnect J-Link and power off the PSoC.  This does not happen if I connect a Miniprog 3 instead of J-Link.  It also happens if I connect a noisy USB charger to my board instead of a J-Link.  How do I fix this problem?  I prefer some software fix so I don't have to redesign the hardware.

       

      I measured the voltage on SWD reset line when PSoC is powered off.  When J-Link is connected it is 0.7V.  When Miniprog 3 is connected it is 0.16V.  If I don't connect the reset line on J-Link I don't see any problem.  Is there any problem with my board design on the reset line?

       

      swd-reset.png

        • 1. Re: PSoC62 MCWDT cannot start
          EktaN_26

          Hello Jefferson,

           

          Can you please attach you project so that I can try recreating the issue at my end. This will help me to get a better insight of the issue.

           

          Best Regards

          Ekta

          • 2. Re: PSoC62 MCWDT cannot start
            JeHu_3414236

            This is a problem involving my custom board.  You should not be able to recreate it on your hardware.  All I am doing is starting MCWDT in main() function and it won't start.

             

            int main(void)

            {

                __enable_irq(); /* Enable global interrupts. */

                 if (!MCWDT_2_GetEnabledStatus(CY_MCWDT_COUNTER2))

                      MCWDT_2_Enable(CY_MCWDT_CTR2, MCWDT_2_TWO_LF_CLK_CYCLES_DELAY);

                 if (!MCWDT_2_GetEnabledStatus(CY_MCWDT_COUNTER2))

                      Cy_GPIO_Write(LED_1_PORT, LED_1_NUM, 0); //fail

                 while (1);

            }

            • 3. Re: PSoC62 MCWDT cannot start
              RodolfoG_11

              Are you not calling Cy_MCWDT_Init()?

              • 4. Re: PSoC62 MCWDT cannot start
                JeHu_3414236

                In my real app I call MCWDT_2_Start() and do many other initialization before using the MCWDT value.  The code I posted is only test code.  I don't need to call MCWDT_2_Start() and it fails in the same way.  I changed to add MCWDT_2_Start() and I get the same result:

                 

                int main(void)

                {

                    __enable_irq(); /* Enable global interrupts. */

                     MCWDT_2_Start();

                     Cy_SysLib_Delay(10);

                     if (!MCWDT_2_GetEnabledStatus(CY_MCWDT_COUNTER2))

                          Cy_GPIO_Write(LED_1_PORT, LED_1_NUM, 0); //fail

                     while (1);

                }

                • 5. Re: PSoC62 MCWDT cannot start
                  JeHu_3414236

                  The problem seems to be solved by calling Cy_SysLib_ResetBackupDomain() in CM0 main().  The example code above is for CM4.  This is the CM0 code with solution:

                   

                  int main(void)

                  {

                      __enable_irq(); /* Enable global interrupts. */

                       Cy_SysLib_ResetBackupDomain();

                      Cy_SysEnableCM4(CY_APP1_CORE1_FLASH_ADDR);

                      for(;;)

                      {

                       Cy_SysPm_DeepSleep(CY_SYSPM_WAIT_FOR_INTERRUPT);

                      }

                  }

                   

                  Cy_SysLib_ResetBackupDomain() is already being called in CySystemInit().  I don't know why I have to call it again.  When I see the problem Cy_SysLib_GetResetReason() returns 0.

                  void Cy_SystemInit(void)

                  {

                  /* Set worst case memory wait states (150 MHz), ClockInit() will update */

                  Cy_SysLib_SetWaitStates(false, 150);

                   

                  if(0u == Cy_SysLib_GetResetReason()) /* POR, XRES, or BOD */

                  {

                  Cy_SysLib_ResetBackupDomain();

                  }

                   

                   

                  Is this the correct solution to the problem?  Is it safe to call Cy_SysLib_ResetBackupDomain() every time at startup?  The hardware problem seems to be a brownout condition where the PSoC is not completely powered off due to leakage on pins like XRES.  I am wondering why a hardware reset using XRES cannot reset the chip completely and it requires a software function call to do it?  What else is not being reset by a hardware reset?

                  • 6. Re: PSoC62 MCWDT cannot start
                    JeHu_3414236

                    I believe my issue is the same as this:

                    https://community.cypress.com/docs/DOC-18631

                     

                    I will use PILO instead of ILO to avoid this problem.