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.

CC2340R5: GPIO interrupt delay to much when enable J-link RTT

Part Number: CC2340R5

Tool/software:

Hi,

We encounter an problem about IO interrupt delay, please help to check it.

Fristly, We use J-link RTT!

  1. It takes more than 150μs from IO falling edge to IO interrupt handle callback function when we didn't connect to the board with j-link RTT viewer on PC, which is too long.
  2. It takes only 45μs from IO falling edge to IO interrupt handle callback function when we had connected to the board with j-link RTT viewer on PC, which is normal(wakeup from standby to Active)

  • Hi Zhang,

     CC2340R5: GPIO interrupt delay  

    Please refer to PowerCC23X0.c where PowerCC23X0_startHFXT is called after PowerCC23X0_enterStandby.

    static void PowerCC23X0_startHFXT(void)
    {
        /* Only start HFXT if it is not already enabled. Trying to start the HFXT
         * if it is already enabled will cause TRACKREFLOSS when starting the LDO.
         * This situation can arise when:
         * - Waking up from fake standby. Fake standby does not shut down the HFXT,
         *   unlike real standby.
         * - Waking up without actually entering real standby. If a wakeup source is
         *   pending when we reach WFI in the ROM function, the hardware will just
         *   turn that into a NOP instead and not run through the regular state
         *   machine.
         */
        if ((HWREG(CKMD_BASE + CKMD_O_HFXTCTL) & CKMD_HFXTCTL_EN_M) != CKMD_HFXTCTL_EN)
        {
            /* Start LDO */
            HWREG(CKMD_BASE + CKMD_O_LDOCTL) = (CKMD_LDOCTL_SWOVR | CKMD_LDOCTL_STARTCTL | CKMD_LDOCTL_START |
                                                CKMD_LDOCTL_EN);
    
            /* Bypass a lowpass filter that is connected to the reference voltage
             * for 66us to ensure that reference has settled.
             */
            HapiWaitUs(66);
    
            /* Clear START bits */
            HWREG(CKMD_BASE + CKMD_O_LDOCTL) = (CKMD_LDOCTL_SWOVR | CKMD_LDOCTL_HFXTLVLEN | CKMD_LDOCTL_EN);
    
            /* Force bias measurement before enabling HFXT - Set SRCSEL = BIAS.
             * Enable the peak detector in the HFXT amplitude control loop to
             * control RF phase jumps.
             */
            HWREG(CKMD_BASE + CKMD_O_AMPADCCTL) = (CKMD_AMPADCCTL_SWOVR | CKMD_AMPADCCTL_PEAKDETEN_ENABLE |
                                                   CKMD_AMPADCCTL_ADCEN_ENABLE);
    
            /* Delay to settle PEAKDET + ADC */
            HapiWaitUs(6);
    
            /* Clear raw interrupt for ADCBIASUPD */
            HWREG(CKMD_BASE + CKMD_O_ICLR) = CKMD_ICLR_ADCBIASUPD;
    
            /* Start an SAR conversion */
            HWREG(CKMD_BASE + CKMD_O_AMPADCCTL) |= CKMD_AMPADCCTL_SARSTRT;
    
            /* Immediately prevent any SAR new conversions from starting. The one
             * started above will complete though.
             */
            HWREG(CKMD_BASE + CKMD_O_AMPADCCTL) &= ~CKMD_AMPADCCTL_SARSTRT;
    
            /* Wait until HFXT-ADC BIAS measurement is done */
            while (!((HWREG(CKMD_BASE + CKMD_O_RIS) & CKMD_RIS_ADCBIASUPD_M) == CKMD_RIS_ADCBIASUPD)) {}
    
            /* Clear SW override of amplitude ADC */
    
            /* Keep PEAKDET on */
            HWREG(CKMD_BASE + CKMD_O_AMPADCCTL) &= ~(CKMD_AMPADCCTL_SWOVR_M | CKMD_AMPADCCTL_ADCEN_M);
    
            /* Start HFXT */
            HWREG(CKMD_BASE + CKMD_O_HFXTCTL) |= CKMD_HFXTCTL_EN;
        }
    
        /* Disallow standby until AMPSETTLED is true */
        Power_setConstraint(PowerLPF3_DISALLOW_STANDBY);
    
        /* Enable the AMPSETTLED interrupt.
         * Since it is a level status signal, it remains asserted when we are
         * running on HFXT and cannot be cleared.
         * The oscillator interrupt removes it from the interrupt mask to prevent
         * repeated vectoring.
         */
        HWREG(CKMD_BASE + CKMD_O_ICLR)  = CKMD_ICLR_AMPSETTLED;
        HWREG(CKMD_BASE + CKMD_O_IMSET) = CKMD_IMSET_AMPSETTLED;
    }

    When the J-link RTT debugger is connected, the device likely keeps the HFXT enabled in what is referred to as a "fake standby".  Thus there is no extra overhead after exiting standby in this case, so the overall delay is very similar to the Wakeup Timing parameter in the datasheet. With a free-running device, there are additional delays implemented in the Power TI Driver to safely start the HFXT, which will result in a longer time before ISRs are executed. 

    As the UART hardware peripheral itself disables standby mode during UART RX functionality, you could stay in active mode always or use a dummy first byte to wake the device, disable standby, read the following UART bytes, and re-enable standby after a timeout or completed reading all bytes.

    Regards,
    Ryan

  • Hi Ryan,

    Thanks for your response.

    More questions:

    1. For "fake standby", do you mean that PowerCC23X0_startHFXT() would be called after PowerCC23X0_enterStandby() when J-link RTT debugger is connected?  I don't think so, below is my test code, I test it base on J-link RTT was connected.

    /*****************************************************************************************************************************************/

    static int pwr_awake_notify_cb (unsigned int event_type,
    uintptr_t event_arg,
    uintptr_t client_arg)
    {
        if (PowerLPF3_AWAKE_STANDBY == event_type) {
             GPIO_write(6, 1);
        }
    }

    static void PowerCC23X0_startHFXT(void)
    {
        GPIO_write(6, 1);
        .....
    }

    int app_pwr_manage_enter_sleep (uint32_t sleep_s)
    {
        Power_registerNotify(&pwr_notify, PowerLPF3_AWAKE_STANDBY, pwr_awake_notify_cb, (uintptr_t)NULL);
        GPIO_write(6, 0);
        sleep(15);
    }

    /*****************************************************************************************************************************************/

    As you can see at the belowe picture, only after sleep time 15s later DIO6 will be pull up. So i don't think PowerCC23X0_startHFXT() would be called after PowerCC23X0_enterStandby(). Please let me know if i make any misunderstanding.




    2. In the Data Sheet, the  Wakeup Timing of "MCU, Standby to Active" 33~50μs, I don't think it was test on "fake standby" mode, which similar to J-link RTT debugger is connected. That's no sense. It think it should be tested With a free-running.


    Looking forward to your reply.



    Best Regards

    Zhang

  • 1. Sorry for not making this clear, however PowerCC23X0_startHFXT is called after the MCU has awoken from when PowerCC23X0_enterStandby put the device into standby, i.e. PowerCC23X0_startHFXT is used for when safely waking out of standby.  Thus it would occur after the 15 seconds sleep much the same as pwr_awake_notify_cb.

    2. The Datasheet was not tested with any fake standby mode, nor does it account for the additional delay overhead incurred by the Power TI Driver.

    Regards,
    Ryan

  • Hi Ryan,

    Yeah, I agree that PowerCC23X0_startHFXT is called after the MCU has awoken from standby mode.

    But, when i try to remove RTT in our code, let the divice free-running, the delays to ISR is about 45μs which is very similar to the Wakeup Timing parameter in the datasheet. In this case, the device free-running and included the additional delay overhead incurred by the Power TI Driver, right?
    The time elapsed from the falling edge of the IO signal to the ISR, summary as follows:


    In my opnion, if "enable RTT and connected to PC" will make it work in fake standby mode, the time elapsed of this case should be more less than 45μs,it should be maybe as idle to Active about 3 or 14μs. But it not, it seem standby normally even we enable RTT. So that why i want to know in case "enable RTT but not connect to PC" it would be more than 150μs.

    Looking forward to your reply.



    Best Regards

    Zhang

  • Hi Zhang,

    I don't have enough knowledge of the J-Link RTT to comment further.  Have you spoken with Segger about these observations?  Is the PC connected during the "no RTT" test, and can you verify both instances of "no RTT" (PC connected and not connected)?  What version of the SimpleLink F3 SDK are you using?

    Regards,
    Ryan

  • Hi Ryan,

    1, No, we have't spoken with Segger about this issue yet.

    2. If "no RTT", the no need connect to PC(J-Link RTT Viewer)

    3. We using simplelink_lowpower_f3_sdk_8_40_02_01

    Best Regards

    Zhang

  • It would be worthwhile to contact Segger so that you may align their tool expectations with your reports.  If only used for debugging then you could consider disabling RTT for production.

    Regards,
    Ryan

  • Hi Ryan

    Thanks for your response.
    I will try to contact SEGGER. If no any others suggestion then i will close this issue.
    Thanks again!

    Best Regards

    Zhang