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.

any workaround for IAR debug with PM1

Other Parts Discussed in Thread: CC2540, CC2530

I discovered by trial and error and lots of searches of the forums that there is a bug in the cc2540 and cc2530 where the cc debugger loses connection to the mcu when it enters PM1.  Is there any workaround for this problem? How can I use debug my application if it uses PM1?

  • A suggestion would be to prevent the P1_0 from going low in suspend mode.  I haven't confirmed this yet but it would be the reason for the USB disconnecting.

    Thanks,

  • Please see this forum post by your colleague TIABO:

    http://e2e.ti.com/support/low_power_rf/f/155/p/247452/872444.aspx#872444

    Essentially PM1 and debugging are incompatible.

  • For anyone else facing this problem.    I managed to workaround the issue by modifying hal_sleep.c.  During debugging I do not allow the processor to enter sleep when going to PM1.  I use code like this:

    #define PM1_DEBUG_WORKAROUND

    #ifdef PM1_DEBUG_WORKAROUND
          //activate this code if debugging something that enters into PM1
          if (CC2540_PM1 == halPwrMgtMode) {
        EA=0;
            while (!((IRCON&0x80)||(P2IFG&P2IEN)||(P1IFG&P1IEN)||(P0IFG&P0IEN)));
        HAL_DISABLE_INTERRUPTS();
          }
          else {
        HAL_SLEEP_SET_POWER_MODE();
          }
    #else
          HAL_SLEEP_SET_POWER_MODE();
    #endif

    I remove the deffine of PM1_DEBUG_WORKAROUND after I am confident the code works and I'm finished debugging.

    Luckily in my application this PM1 mode is only used during USB suspend so it does not normally cause problems.