--- Quote Start ---
I'm using it as a cycle counter.
So I need to change the timeout period to 1sec instead of 1 msec if I want to measure a time round about 0.0008 sec.
--- Quote End ---
You definitely need a timeout period larger than the measured time.
As I said above, if your timer is dedicated to the measuring task and doesn't serve other functions or peripherals, you can operate it freely.
So, I suggest this:
- set timeout period larger than the maximum expected interval to be measured
- timer initialized in stopped status
- reset and start the timer when you start your measure,
- stop the timer at the end of measure
- read the duration
--- Quote Start ---
I also want to measure it exactly as possible.
--- Quote End ---
This greatly depends on your application, namely how you perform the measurement:
- poll a PIO or any other condition and start/stop/read the timer: poor precision, dependent from your polling rate, unless you can afford using the 100% of cpu time for the polling loop and don't execute any other task
- use a irq triggered by start/stop conditions: common solution for greater system effinciency and good precision in the us range
- use a hardware counter solution which automatically identifies start/end conditions and places the measurement in a register which you can read without effort: maximum precision at the expense of a slight increment in hw complexity (fpga resource usage)