Hi Alessandro, let me tray to answer your comments:
- The AUTO mode in TSS maps directly to the automatic trigger in TSS. The way it works is: the AMCLKS (clock selected by AMCLKS) is divided down by the AMPSC (the preescaler) and then it counts up to SMOD. So if the selected clock is 1kHz and the preescaler is 1, then every count of SMOD is 1 ms. This is what processor expert is calculating. Important thing: the scan period configured out of this setting must be bigger than however long it takes to scan all the electrodes. If the timing is less, the TSI module will return an overrun error, or "small trigger period" as the TSS library calls it. Electrode scanning usually happens very fast, depending on the number of scans (determined by NSCN and PS) it can go down to uS range, and usually is within 1 or 2 ms. On the other hand, user reaction time is very slow, people don't usually detect what happens faster than 100 ms, so even if you were using the 16 electrodes (taking up about 16 ms to scan), you still would use a scan period of 50 to 100 ms, even more, without problems. This is why it works this way. Use SMOD/AMPSC to get around those values. Why so slow? Mainly to save power, you could scan more frequently, but in most cases it won't enhance the user experience, but it will increment power and CPU usage, better to keep those down.
- The setting of the bus clock and getting the LPOCLK is definitely an error that the SW team has been alerted about. It's inheritance from the very first TSI version that used to have the bus clock with that value. Later on it was found that the LPOCLK was much better suited, particularly due to the explanation provided above.
- The number of scans is actually like this: Number of scans = (NSCN + 1)*(PS^2). Notice that PS is different than AMPSC. PS preescales the number of scans. So setting NSCN to 8 with a PS of 0 would actually give 9 scans in normal conditions, but there is and errata that covers this situation, basically, if the time it takes for that number of scans is less than a preescaled clock source period, as you have correctly mentioned, the module will continue scanning for that period. This issue shall be fixed in a future mask release, but notice that the number of counts reported by the module is not affected. The errata is here: http://cache.freescale.com/files/microcontrollers/doc/errata/KINETIS72MHZ_1N36B.pdf It is e3926.
- The ALWAYS trigger mode will continually scan without any timing in between. The time between scans will depend on how many electrodes and how many scans you have configured. In this mode, the small trigger period is ignored, that is why you're having no problems.
My recommendation is to use the AUTO mode, make sure you set a slower period, as I mentioned before, 50 ms should be good.