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-Q1: The operation after LGPTimer interrupt

Part Number: CC2340R5-Q1
Other Parts Discussed in Thread: CC2340R5,

Hello TI Team.

 

Added the following code to the end of Func :"App_StackInitDoneHandler" in the app_main.c file as shown below. Also, a callback function has been added.
When I check the operation, after the 10th callback function is executed, the loop is broken and the port "CONFIG_GPIO_1"=Low is not executed.
(In the debugger, PC is missing)

What is the cause and what is the solution?


CH1:CONFIG_GPIO_0, CH2:CONFIG_GPIO_1, CH3:Current Consumption

・Add code

==============================================

LGPTimerLPF3_Params_init(&params);
params.hwiCallbackFxn = LGPT0_Callback;
params.prescalerDiv = 48-1;
lgptHandle = LGPTimerLPF3_open(CONFIG_LGPTIMER_0, &params);
lu32_cnt = 10000 - 1;
LGPTimerLPF3_setInitialCounterTarget(lgptHandle, lu32_cnt, true);
LGPTimerLPF3_enableInterrupt(lgptHandle, LGPTimerLPF3_INT_TGT);
LGPTimerLPF3_start(lgptHandle, LGPTimerLPF3_CTL_MODE_UP_PER);
GPIO_toggle(CONFIG_GPIO_1);
while(1) {
if (gu32_hfosc_counter >= 10) {
break;
}
}
GPIO_toggle(CONFIG_GPIO_1);

==============================================

・callback function

==============================================

void LGPT0_Callback(LGPTimerLPF3_Handle lgptHandle, LGPTimerLPF3_IntMask interruptMask)
{
GPIO_toggle(CONFIG_GPIO_0);
++gu32_hfosc_counter;
if (gu32_hfosc_counter >= 10) {
LGPTimerLPF3_disableInterrupt (lgptHandle, LGPTimerLPF3_INT_TGT);
LGPTimerLPF3_stop(lgptHandle);
LGPTimerLPF3_close(lgptHandle);
}
}

==============================================

SDK:simplelink_lowpower_f3_sdk_7_20_01_10

BaseSW:basic_ble_LP_EM_CC2340R5_freertos_ticlang

Regards.

  • Hi there,

    Can you first maybe help me understand the purpose of adding this code within the stack initialization function? Once this function is executed, it shouldn't be executed again unless you reset, and I'm having a tough time understand the purpose of why you're adding LGPTimer code within that function. 

    I know in another thread we aligned to move to the latest SDK as well, can you please make that transition and retest? Many issues have been fixed between those releases. Additionally, 7.40 SDK is the first SDK that support the production CC2340R5-Q1 production material. 

  • Thanks for the feedback. 

    The purpose of this is to check the accuracy of the 48MHz HFOSC (= substitute LGPTimer pulse width measurement) and to measure the current consumption in RUN mode immediately after reset.

    I am sure there are better ways to do this, but I am implementing this method as an easy way to do it.
    Nevertheless, I am curious as to why this event is occurring, so please let me know the cause.

    Also, SDK 7.40 had the same result.

    Best regards.

  • Hello,

    Is there a fault generated?

    Does the code continue executing and the stack is initialized?

    Best,

    Nima Behmanesh

  • Hello,

    Looking into this a bit further, I think there may be an issue with optimizing out some of the code.

    Go to the properties of the project:

    Go to Arm Compiler --> Optimization and change it from z to 0:

    Rebuild the project and test.

    Best,

    Nima Behmanesh

  • Hi Nima

    Thanks for the feedback.

    You are correct, changing the compile option to "0" has improved the situation. @SDK 7.20 and 7.40

    However, I have a concern.
    Is there a specific recommended compile option when using API Drivers?

    Or is this an exceptional treatment only for this event?

    We are assuming coin cell battery operation, and the compile option "0" is difficult to achieve low consumption in terms of processing time.

     

    Regards.

  • Hi,

    No the drivers should work regardless of the optimization level. This seems to be a bug, and I'll have too look into it a bit further. 

    Best,

    Nima Behmanesh