we are using a MKL16Z processor and want to use the TSI without any Freescale library. We found the description of the TSI module in the Reference Manual a bit confusing especially regarding the noise mode.
The normal touch mode works well, but now we have problems with EMC (IEC61000-4-6 immunity). I tried to implement the algorithm which is described in the reference manual:
1. Initialize Rs = maxrs; Dvolt = minDv (set other configurations also)
2. Perform a noise cycle.
3. If TSIcounter < 3, go to step 8
4. If Rs = minrs, go to step 6.
5. Reduce value of Rs. go to step 2
6. If Dvolt = maxDv, go to END
7. Increase value of Dvolt. Set Rs = maxrs. go to step 2
8. If Rs > minrs, (Reduce value of Rs, go to END)
9. Rs = maxrs, reduce value of Dvolt.
10. END Get value of Rs and Dvolt.
My problem is, that I am not able to put this algorithm to code because I don't know exactly which values came in which registers.
Has anyone a working code snippet for this algorithm?
I understand that I get a noise value (0..15) out of this algorithm. I think to use it, I have to read this noise level on a cyclic manner parallel to the normal capacitance measurement to detect the noise. If it gets bigger than a threshold the touch will not be longer detected by the cap measurement, but by looking at the changes of the noise level. Is this right?
Thank you very much for your help.