For a generic motor drive the pulse frequency output from an encoder can vary in a very broad range as both the encoder LPR and the speed of the motor varies. But the 16 bit counter is too short that make the measurable range either too tight or too rough:
Motor speed range with different encoder LPR | |||||||||||
SYSCLKOUT | Prescale | Position pulse freq range | 256 | 512 | 1024 | 2048 | |||||
120000000 | Min | Max | Min Hz | Max Hz | Min Hz | Max Hz | Min Hz | Max Hz | Min Hz | Max Hz | |
QCAP Counter Max | 1 | 1831.082628 | 1200000 | 1.788166629 | 1171.88 | 0.894083 | 585.9375 | 0.447042 | 292.9688 | 0.223521 | 146.4844 |
65535 | 2 | 915.5413138 | 600000 | 0.894083314 | 585.938 | 0.447042 | 292.9688 | 0.223521 | 146.4844 | 0.11176 | 73.24219 |
QCAP Counter Min | 4 | 457.7706569 | 300000 | 0.447041657 | 292.969 | 0.223521 | 146.4844 | 0.11176 | 73.24219 | 0.05588 | 36.62109 |
100 | 8 | 228.8853285 | 150000 | 0.223520829 | 146.484 | 0.11176 | 73.24219 | 0.05588 | 36.62109 | 0.02794 | 18.31055 |
16 | 114.4426642 | 75000 | 0.111760414 | 73.2422 | 0.05588 | 36.62109 | 0.02794 | 18.31055 | 0.01397 | 9.155273 | |
32 | 57.22133211 | 37500 | 0.055880207 | 36.6211 | 0.02794 | 18.31055 | 0.01397 | 9.155273 | 0.006985 | 4.577637 |
Even the feature that QCAP timer is reset on every position unit is driven me crazy, which mean the interrupt must be enabled to save each position unit period or it will be overwritten. But how to handler a interrupt frequency up to 250KHz or even more?
I personally strongly suggest TI to extend the QCAP timer to 32 bit and add an option to not to reset the timer on position unit event, which will make the eQEP module much more flexible and powerful.