In Free Run Mode pulses are counted continuously. When maximum number (16,777,215) of pulses is reached, the counting starts again from 0.
The pulse counter registers the number of detected pulses and the elapsed time. Any time you can suspend time and pulse counting, resume or reset it. Besides, you can retrieve the number of detected pulses and elapsed time. You can also configure the pulse counter module to send events to your application periodically or when the counter overflows (maximum number of pulses is reached).
To configure pulse counter settings, send GPIO_SET_PLS_CNT_CFG command. The Free Run Mode can be selected in Bits 7..4: PLS_CNT_MODE of Byte 3.
If you want to receive GPIO_EV_PLS_CNT event, when the pulse counter overflows, specify 1 in Bit 0: EV_OVERFLOW of Byte 3. The event will return the elapsed time.
You may configure the pulse counter to send events periodically. The repeat interval is specified in Byte 4: REPEAT in units of 10 ms. The event will return the number of detected pulses.
For more detailed information about the event see Section 11.2, “Pulse Counter Event”.
You can suspend pulse counting by GPIO_SUSPEND_PLS_CNT command. This command suspends both time counting and pulse counting. If a pulse counter is suspended, it will not run until you send the GPIO_RESUME_PLS_CNT command.
Any time you can retrieve current number of detected pulses and timer readings with GPIO_GET_PLS_CNT_VAL command. You can reset the time count or pulse count with GPIO_RESET_PLS_CNT command.
To retrieve the pulse counter configuration settings, send GPIO_GET_PLS_CNT_CFG command.