CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

TOUCHPAD settings / same code & device, differnt behavio

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
frmerlo



Joined: 12 Nov 2012
Posts: 4

View user's profile Send private message

TOUCHPAD settings / same code & device, differnt behavio
PostPosted: Mon Nov 12, 2012 4:01 am     Reply with quote

Hello

I'm using the built-in touchpad function of the ccs compiler. My projects also runs as i want on my PIC16F1824.
Now I got a very strange issue. I programmed an other device (still 16F1824) with the same source code (even read hex file from one device and wrote it to the other device), but the touchpad doesn't work as proper as on the other PIC. The Layout is exactly the same on both prints.

Then I read the data sheet of my PIC, where i found much more configuration for the capacitive sensing module. (E.g. voltage reference modes).

Does anybody know why the same coce runs different on an other uC or how exactly the ccs compiler sets up the CS modul ?

If you want i can post my source code..

I'm using MPLAB X v1.30
CCS Compiler Version 4.135
ICD 3

Thanks !
Ttelmah



Joined: 11 Mar 2010
Posts: 19480

View user's profile Send private message

PostPosted: Mon Nov 12, 2012 4:14 am     Reply with quote

Obvious thing, have you looked at the two chip's revision ID's?.
There are a significant number of errata's on this chip, and a couple affect the ADC (which is used for touchpad operation).
What is happening on the unit that works, versus the one that doesn't?.
What is your clock rate?.
What clock source are you using for the ADC?.

If it is hanging, then you have an old chip for the one that fails. There is a bug in the ADC, which stops it actually completing a conversion.
Several of the errata, depend on the clock rate being used.

Best Wishes
frmerlo



Joined: 12 Nov 2012
Posts: 4

View user's profile Send private message

PostPosted: Mon Nov 12, 2012 5:03 am     Reply with quote

Thanks for your quick reply.

I checked the device id revision and its for both devices the same (3).

To explain whats happening to the unit which doesn't work I have to explain quickly my project: I have female connector with 6 pins and with ICSP wire connected. Then i have a print with the opposite male connector which i can mount on this female connector. This print has a jack for the ICD3 or i can use it as touchpad because i connected the RA0/ICSPDAT/CPS0 to a copper plain.

Now the touchpad (of the not working print) responds only in this moment when i connect this (additional) print to the main print. seems, that the sensitivity is not equal for the different devices.

I hope this was clear enough to understand.

My (intern) clock runs at 16MHz.

Doesn't the compiler set the clock source for the ADC ? (=intern clock).
I didn't set anything.


(I hope all this is clear enough to read as my native language is not english).

Thanks !
Ttelmah



Joined: 11 Mar 2010
Posts: 19480

View user's profile Send private message

PostPosted: Mon Nov 12, 2012 5:30 am     Reply with quote

The touchpad setup, has a 'threshold' setting that adjusts how critical the changes are.
Seriously, I'd not expect two chips/boards to be even close to the same, unless (for example), the boards have been professionally cleaned. Otherwise just simple differences in how much flux is on the lines, _will_ affect the levels seen. You probably need to try different settings for the threshold, and see what range of values work for each board, and then put your setting in the overlap of these ranges....

Best Wishes
frmerlo



Joined: 12 Nov 2012
Posts: 4

View user's profile Send private message

PostPosted: Mon Nov 12, 2012 6:24 am     Reply with quote

I set the threshold.. yes i also believe that the boards are not exactly the same but the difference are too big..

Anyway, the touchpad doesn't always work after a reset and I really don't understand why.. i can even not explain when it works and when not, it's so random.. Sad
Ttelmah



Joined: 11 Mar 2010
Posts: 19480

View user's profile Send private message

PostPosted: Mon Nov 12, 2012 8:51 am     Reply with quote

You need to remember what the touchpad measures. If measures the change in capacitance. The threshold sets how much it has to change to trigger the detection. Now seriously if you have a copper touchpad, attached with a connector, the change when you attach this is going to be many times the change you will see when you touch the pad. Probably a change of 30+pF. The finger on the touchpad only adds a very few pF of capacitance. Working via a connector is always going to reduce the sensitivity significantly....

Now when I mentioned the ADC, I assumed your chip had the CTMU module (which can also be used to give a touchpad), but in fact your's has the CSM module. This only uses a couple of timers. Have you tried a higher range?. With the amount of stray capacitance your circuit description is likely to have, this may well be essential, together with lowering the threshold (since the delta change you are going to see with such a circuit, will be quite small). Have you calibrated the touchpad?.
After you start the system:

TOUCHPAD_STATE(1);

This forces an automatic calibration that the future 'change' detection will be based on.

Best Wishes
Langton



Joined: 29 Nov 2009
Posts: 25

View user's profile Send private message

PostPosted: Mon Nov 12, 2012 3:06 pm     Reply with quote

Hey,
I have had a bit of experience in touch sensing and with our own products we were getting significant difference as well. It is to some extent unavoidable insofar that it's the nature of the beast so to speak. What did make for much tighter tolerances was ensuring that all our Cs capacitors were at least 5% ideally 1% if budget allows
Ttelmah



Joined: 11 Mar 2010
Posts: 19480

View user's profile Send private message

PostPosted: Mon Nov 12, 2012 3:44 pm     Reply with quote

Yes. The CSM though, uses an internal capacitor in the chip only. This though it an important reason for using the higher current options on the setup, since this reduces the effect that stray capacitance inside the chip and on the board have. It also raises the operating frequency, and has a slightly tighter tolerance than the low current settings. I actually suspect with the described external capacitance, higher current settings will be essential. There is a 3:1 tolerance range on the charge current used by the circuit, let alone the capacitor value....
It is _completely_ dependant on being calibrated for the specific hardware, using the automatic calibration, and since it then only looks for changes, the tolerancing doesn't matter too much.

Best Wishes
frmerlo



Joined: 12 Nov 2012
Posts: 4

View user's profile Send private message

PostPosted: Tue Nov 13, 2012 1:51 am     Reply with quote

Ttelmah:
Quote:
Now when I mentioned the ADC, I assumed your chip had the CTMU module (which can also be used to give a touchpad), but in fact your's has the CSM module. This only uses a couple of timers. Have you tried a higher range?. With the amount of stray capacitance your circuit description is likely to have, this may well be essential, together with lowering the threshold (since the delta change you are going to see with such a circuit, will be quite small). Have you calibrated the touchpad?.
After you start the system:

TOUCHPAD_STATE(1);

This forces an automatic calibration that the future 'change' detection will be based on.

I always set the range to H. I saw in the datasheet of the PIC that there are actually 6 charge current values (up to 100uA). Unfortunately the ccs function goes only up to 18uA.

I'm also calibrating the touchpad. I realized now, that you shouldn't calibrate it directly after the start. When I wait 500ms after a reset to start up the system it works better. Maybe it has something to to with some load that has to charge first.

By the way, does anybody know what the maximum scantime is ? (Or where I can find the source code of the built-in function?)

Thank you
Ttelmah



Joined: 11 Mar 2010
Posts: 19480

View user's profile Send private message

PostPosted: Tue Nov 13, 2012 2:29 am     Reply with quote

Are you calibrating with the external connector attached?.
For what you describe, this is what is needed, since it carries a significant amount of the basic circuit capacitance. Then the 'touch' will be when the frequency changes beyond this.
Remember you can use TOUCHPAD_STATE(2) to actually read the timer values being generated. So you can test the 'bare' setup (nothing attached), the setup with the external circuitry plugged in, and the setup with the pad touched. The counter values are returned in the array 'TOUCHDATA', which has an entry for each pin you are using. The values are INT16's.
You can see (for instance) if the values are running out of range (going beyond 65536), in which case you need to drop the sampling time, or the current, and how much they do change. Gives some significant 'diagnostics' on what is happening. Also the 'change', will give you a real handle on what threshold is wanted.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group