cirque-corp / Cirque_Pinnacle_1CA027

Content related to Cirque solutions using the Pinnacle (1CA027) Touch controller. This includes sample code, reference designs and developer tools.
48 stars 15 forks source link

Problems with TM035035 trackpad start / init phase ? #12

Open ChrisVeigl opened 2 years ago

ChrisVeigl commented 2 years ago

hi,

i'm referring to the demo code for i2c operation of a single pad https://github.com/cirque-corp/Cirque_Pinnacle_1CA027/tree/master/Circular_Trackpad/Single_Pad_Sample_Code/I2C_CurvedOverlay

the example works (R1 was removed) - but i see a strange behaviour right after startup / initialisiation: DR is asserted constantly, and the trackpad coordinates are classified as valid, led is on, although the pad is not touched (!) even when the pad is touched, x/y coordinate data is wrong (mosty the x coordinates) - until the finger is lifted. sometimes several touches are necessary.

then, normal operation is possible (DR only asserted when actual touch happens, x/y/z coordinates correct)...

this seems like some kind of calibration phase which is nowhere documented and which sometime takes quite long - comporomising the application ...

strange enough, this does not happen when using the TM040040 (which sends correct data right from the start), but with all 3 TM035035 we have here (!)

is there anything i am missing ?

PatrickSherwood commented 2 years ago

Hi @ChrisVeigl, this sounds quite unusual and doesn’t fit the description of any features I am aware of. The fact that this behavior doesn’t repeat with the exact same timing makes me think there could be a loose wire, incorrect firmware on the Teensy, or something else unpredictable like that.

In order to get you up and running, we will need some additional information. Could you please describe your hardware setup? Are you using one of our development kits? Are your sensors flat or curved? Are the plastic overlays installed on your modules? Which version of the Arduino IDE and Teensyduino add-on are you using?

Thanks!

ChrisVeigl commented 2 years ago

thanks for the reply @PatrickSherwood!

makes me think there could be a loose wire,

i used 2 different flex connector cables, both intact and working well with the TM040040 (and after the "initialisation phase" of the TM035035). We tried 3 different TM035035 modules - same problem with all of them ...

incorrect firmware on the Teensy, or something else unpredictable

i am using the (unchanged) devkit example firmware for i2c single pad (see above link).

BTW: Is there a way to update the firmware on the trackpad(sensor) ?

please describe your hardware setup?

I am using the devkit https://www.cirque.com/circle-trackpad-dev-kit with curved sensors and plastic overlays installed

Arduino Version is Teensyduino 1.56, Arduino versions is 1.8.16 (also tried 1.8.19)

ChrisVeigl commented 2 years ago

PS: i found information about the power-on calibration procedure of the Pinnacle ASIC in this application note: https://www.dropbox.com/s/o8ej3v5zuc7q4bv/GT-AN-090624%20Pinnacle%20Sensor%20Compensation.pdf

this seemed to be the right track, but bit0 in the CalConfig1 register (0x07) is 0 (indicating that calibration is complete) when wrong position data is reported (and DR is always asserted) after startup ...

ChrisVeigl commented 2 years ago

to illustrate the problem see attached video, taken from original devkit + original i2c example; incorrect behaviour after first touch, correct behaviour starts at about second 9.

https://user-images.githubusercontent.com/328325/151222281-6f27c7a5-d966-4ba5-8b46-fda03bacc801.mp4

cirque-jonb commented 2 years ago

The cap touch system works like a low res camera except it sees charge movement caused by "transmit" electrodes and not light. Every so often, when the system thinks there is nothing on the sensor, it captures that image and stores it as a "compensation" image. Then, it subtracts that image off all incoming images. That makes it easier to track a finger. Sometimes at power up the initial image isn't a good image (like if the power rails come up slower than expected). In that case "forcing a re-comp" will fix it. I always just force a re-comp when my code starts up, just in case. I think that by the time the comm is running the power rails are stable.

// Forces Pinnacle to re-calibrate. If the touchpad is reporting touches when
// no fingers are on the pad then calibration (compensation) is wrong.
// Calling this function will fix the problem. Warning, re-enable the feed after calling this.
void Pinnacle_forceCalibration(void)
{
  uint8_t CalConfig1Value = 0x00;

  Pinnacle_EnableFeed(false);
  RAP_ReadBytes(0x07, &CalConfig1Value, 1);
  CalConfig1Value |= 0x01;
  RAP_Write(0x07, CalConfig1Value);

  do
  {
    RAP_ReadBytes(0x07, &CalConfig1Value, 1);
  }
  while(CalConfig1Value & 0x01);

  Pinnacle_ClearFlags();
}
ChrisVeigl commented 2 years ago

thank you very much, @cirque-jonb ! this is exactly what i was looking for :+1:

As the problem happens _everytime the TM035035 modules start up, I tried to find a good spot for triggering the re-calibration, and it seems that calling it right after the ADC attenuation setting (in the init phase) works well, e.g. here in the I2C single curved pad example:

https://github.com/cirque-corp/Cirque_Pinnacle_1CA027/blob/12d758e32f240e7d677fd1dd97567fd2d458424e/Circular_Trackpad/Single_Pad_Sample_Code/I2C_CurvedOverlay/I2C_CurvedOverlay.ino#L109

this seems to cure the problem! (calling the recalibration before setAdcAttenuation() does not work ...)

I am wondering if this affects other people as well ... (i have no specific setup regarding power supply, and we tested on different laptops). maybe it would make sense to apply this change in the example sources.