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.

LP-MSPM0L1306: Count external clock in the MCU

Part Number: LP-MSPM0L1306
Other Parts Discussed in Thread: SYSCONFIG

Hi team,

My customer is using the following sample code for counting external clock in the MCU.

Sample code: timx_timer_mode_compare_edge_count

①Does it not work if they do not input something such as clock signal to PA19 and 20 of the evaluation board? Or is a crystal oscillator for an external clock should be implemented?

(I don't think it was written in the manual)
②If they want to use an external clock of 40kHz, the timer Clock Source is LFCLK (32kHz) in the initial setting of Sysconfig, so 40kHz external clock cannot be used with this content.
Is it correct to assume that a 40kHz external clock can be used by changing from LFCLK (32kHz) to MFCLK (4MHz)?

Thank you in advance.

Best regards,

Kenley

  • Hi Kenley,

    Q1:

    PA19 and PA20 is used for debuuger and should not used as other functions. It can work normal  without them but can not debug.

    You can check the readme for details instructions in the code example:

    Q2:

    It also can work, but not recommended. You will find that your count result will incorrect sometimes if the clock is set as 40kHz.

    Is it correct to assume that a 40kHz external clock can be used by changing from LFCLK (32kHz) to MFCLK (4MHz)?

    Yes.

    B.R.

    Sal

  • Hi Sal,

    Thank you for the support.

    for Q2, do you have any recommendation for the setting on how to measure 40kHz correctly ?

    Thanks and best regards,

    Kenley

  • Hi Sal,

    By the way for Q2, could you please explain why the count result will be incorrect sometimes if the clock is set as 40kHz?

    Best regards,

    Kenley

  • Hi Kenley

    for Q2, do you have any recommendation for the setting on how to measure 40kHz correctly ?

    Use higher than 40kHz for the counting, it's better twice as high. (The higher the source clock is, the more accuracy the result is)

    By the way for Q2, could you please explain why the count result will be incorrect sometimes if the clock is set as 40kHz?

    For explanation, let set the clock as 80kHz. Then you will find that counted clock changed twice, but the counter only increase one.

    When CCP Input edge deteced, but counter need at least one clock to increase.

    B.R.

    Sal

  • Hi Sal,

    Thank you so much !!

    Best regards,

    Kenley