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: Pulse measure

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

Tool/software:

Hi TI team.

While I have a similar question, please tell me the following method.

I want to obtain the low pulse width (about 16 microseconds) output from another IC using the LGPTimer feature.

Can it be obtained through the following process?Please let me know.

 /* LGPTimer Settings */
 LGPTimerLPF3_Params_init(&lgpt_params);
 lgpt_params.hwiCallbackFxn = pulse_measure;
 lgpt_params.channelProperty[0].action = LGPTimerLPF3_CH_PULSE_WIDTH_MEASURE ;
 lgpt_params.channelProperty[0].inputEdge = LGPTimerLPF3_CH_EDGE_BOTH ;
 lgpt_handle = LGPTimerLPF3_open(CONFIG_LGPTIMER_0, &lgpt_params);
 LGPTimerLPF3_enableInterrupt(lgpt_handle, LGPTimerLPF3_INT_TGT);
 LGPTimerLPF3_start(lgpt_handle, LGPTimerLPF3_CTL_MODE_UP_PER);
 ...
 
 void pulse_measure(LGPTimerLPF3_Handle lgptHandle, LGPTimerLPF3_IntMask interruptMask)
 {
    /* Get pulse period */
    uint32_t pulse_period = LGPTimerLPF3_getChCaptureVal(gh_lgpt1_handle, LGPTimerLPF3_CH_NO_0);
 }

Regards.

  • Hello, 

    Yes, this implementation would work.  Additionally, look into the LGPTimerLPF3_getNextChCaptureVal(), this function will measure the pulse width of the input. Make sure to set the Ch0 pin for whichever GPIO pin you want to take the input. Let me know if you have any issues with this implementation. 

    Thanks, 
    Isaac

  • Hello, Issac

    Thanks for the reply.

    We have confirmed that it works with the implementation shown at the time of the question.

    However, there are two problems with the operation and one question.(see figure below)

     CH1:CC2340R5 wakeup and UART(CC2340R5 receive),  CH2:UART(CC2340R5 send), CH3:Dammy Data(LGPT CH1), CH4:For motion analysis

    Q1.The area indicated by the red arrow is Low for a short time. Why is this? (Under the condition that CC2340R5 is not connected, there is no output from the other IC.)

    Q2.The area indicated by the blue arrow takes 1.36 msec from the end of the dummy signal until the interrupt occurs. Why does it take so long? Is there any way to shorten the time? (I want to shorten the time for battery operation.)
    Tip: Waiting for dummy signal input is standby mode.

    Q3.Currently, I am getting the pulse length value with LGPTimerLPF3_getChCaptureVal() in the interrupt function, but the difference between LGPTimerLPF3_getNextChCaptureVal() and LGPTimerLPF3_getCounterWidth() ( respectively, which part of the time is measured value for each of the three functions?) Please let me know.

    Please let us know if there is any information missing when answering the questions.
    We appreciate your cooperation.

  • Hello, Issac

    Regarding Q2, I was able to resolve this by reviewing the code as follows(line 7).
    Please answer only the other questions.

    /* LGPTimer Settings */
     LGPTimerLPF3_Params_init(&lgpt_params);
     lgpt_params.hwiCallbackFxn = pulse_measure;
     lgpt_params.channelProperty[0].action = LGPTimerLPF3_CH_PULSE_WIDTH_MEASURE ;
     lgpt_params.channelProperty[0].inputEdge = LGPTimerLPF3_CH_EDGE_BOTH ;
     lgpt_handle = LGPTimerLPF3_open(CONFIG_LGPTIMER_0, &lgpt_params);
     LGPTimerLPF3_enableInterrupt(lgpt_handle, LGPTimerLPF3_INT_CH0_CC); /* Change intMask */
     LGPTimerLPF3_start(lgpt_handle, LGPTimerLPF3_CTL_MODE_UP_PER);
     ...
     
     void pulse_measure(LGPTimerLPF3_Handle lgptHandle, LGPTimerLPF3_IntMask interruptMask)
     {
        /* Get pulse period */
        uint32_t pulse_period = LGPTimerLPF3_getChCaptureVal(gh_lgpt1_handle, LGPTimerLPF3_CH_NO_0);
     }

    Regards.

  • Hello, 

    Q1: Since that channel is data in from the external IC, I suppose its noise, or some sort of transient from the external IC.  You mention that the external IC is not outputting anything, are you taking this trace from the CC2340R5 or the external IC? From my understanding you are just monitoring the input pin for the external IC on the CC2340R5 without the IC connected? 

    Q3: Are you trying to understand the output unit (time, ticks, etc.), or how each function measures the waveform? I am going to follow up with another team member to see if I can get some more information on these functions. Apologies for the delay. 

    Thanks, 
    Isaac

  • Hi.

    In response to the previous email:
    Q1. The oscilloscope image shows the state when the output port of another IC is connected.

    This is because the CC2340R5 will not proceed to the next operation unless it receives a legitimate dummy signal after an irregular Low pulse.

    However, as I mentioned before, the individual IC does not output an irregular Low pulse like in the image, so I suspect that the level might be changing on the CC2340R5 side when switching the port to the LGPT channel.


    Q2. It is the latter that you mentioned. I would like you to tell me which part of the image each function measures the time and outputs the values from.

    Thank you.

  • Hello, 

    Q1: I believe you are correct. When the CC2340R5 switches to the LGPT channel, there will be a bit of a current drop. I will do some digging myself and see if I can see something similar. 

    Q3: The functions measure the period and pulse width in terms of counter ticks. You can read more about this under LGPTimerLPF3_CH_PULSE_WIDTH_MEASURE, in the LGPTimerLPF3_ChannelAction section of the API guide. I know there is a function to convert from counter ticks to milliseconds but cannot find it at the moment. I will provide more information Thursday (10/24). 

    Thanks, 
    Isaac