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.

MSPM0G3507: MSPM0G3507

Part Number: MSPM0G3507
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

Dear,

I would like to count pulses on an external pin using a timer in counter mode.

How to configure and readout? I did not manage to find an example.

Preferrable example code and not the setting of the sysconfig tool...

Thank you soo much!

  • The relevant Example would be timx_timer_mode_compare_edge_count, here:

    https://dev.ti.com/tirex/explore/node?node=A__ALzqh4wA5MtgGbIqmSaTyw__MSPM0-SDK__a3PaaoK__LATEST

    As near as I can tell, all the TI Examples for the MSPM0 use sysconfig/driverlib. The .syscfg file for that project isn't very informative, since it evidently relies on sysconfig defaults, e.g. "EDGE_COUNT_DOWN" isn't explicitly mentioned.

    --------------

    The principle is laid out in TRM (SLAU846B) Sec 27.2.3.2.1. Briefly:

    (1) CTRCTL:CAC (counter advance trigger) is pointed at the CCTL_01[] entry that refers to the external pin.

    (2) That entry's CCTL_01[].ACOND (Advance condition) is set to rising/falling/both edge (rather than TIMCLK, as it would be for an ordinary timer).

    (3) To get the number of edges, just read the CTR register; to be notified after N edges, put N into the corresponding CC_01 register (and enable the corresponding CCUn or CCDn interrupt).

    There are a few other ancillary settings (EN=1, direction up/down, LOAD=0xFFFF if you want Continuous counting) but setting ACOND is the core.