2bndy5
I have a few questions about using the Pinnacle's AnyMeas mode. Preemptively, I'm sorry if this is a bit much for my first post in these forums.

  1. Does the calibration matrix in Pinnacle memory (using ERA) affect AnyMeas measurements? I also wonder how to determine which calibration matrix values do what, but that's not a high priority & rather off-topic.
  2. Assuming the toggle & polarity polynomials passed to the Pinnacle have something to do with manipulating the electrode matrix, how do they work? (Please excuse my lack of linear algebra knowledge)
  3. ADC_TakeMeasurement(Toggle=0x0FFF0000, Polarity=0x00000000) # for only X-axis?
    ADC_TakeMeasurement(Toggle=0x0000FFFF, Polarity=0x00000000) # for only Y-axis?
  4. Given the returned value is a `signed short`, does that mean that a value of 0 is relative to the center of the sensor?
  5. How does changing the frequency (referred to as 'toggle frequency' and 'electric frequency' in comments of official example), gain, aperture width, and bit length affect AnyMeas measurements?

I ask because I'm writing an open-source python library (and subsequent Arduino library - though that's still under construction) that exposes Relative, Absolute, & AnyMeas modes. But the lack of documentation on AnyMeas mode leaves my library's documentation rather vague about AnyMeas mode.
Quote
bdm
Good questions.  Let me try to answer them, let me know if this isn't enough info.

1-No, calibration matrix is not used when using AnyMeas. 
2-Sorry that this is so cryptic  What you're looking at is a bit mask, each bit in Toggle that is set to 1 enables that electrode to be used in the measurement.  Each bit in Polarity that is set to 1 makes that electrode do a positive toggle.  There are 28 electrodes and the mapping of Toggle to electrodes is a bit cryptic.  Line 48 of the main code has a comment that explains it, the mapping is like this:
//bit order for toggle and polarity
// bit 31 bit27 bit23 bit19 bit15 bit11 bit7 bit3 bit0
// NotUsedNotUsedRef1Ref0 Y11Y10Y9Y8 Y7Y6Y5Y4 Y3Y2Y1Y0 X15X14X13X12 X11X10X9X8 X7X6X5X4 X3X2X1X0
{Toggle : 0x00010000, Positive : 0x00010000}, //This toggles Y0 only and toggles it positively
{Toggle : 0x00010000, Positive : 0x00000000}, //This toggles Y0 only and toggles it negatively
{Toggle : 0x00000001, Positive : 0x00000000}, //This toggles X0 only and toggles it positively
{Toggle : 0x00008000, Positive : 0x00000000}, //This toggles X16 only and toggles it positively
{Toggle : 0x00FF00FF, Positive : 0x000000FF} //This toggles Y0-Y7 negative and X0-X7 positive

};

So you can see that setting toggle equal to 0x00010000 will toggle Y0 only.  Setting Toggle equal to 0x08000000 would toggle Y11 only.  You can toggle multiples as well for example, Toggle = 0x000F0000 will toggle Y0, Y1, Y2 and Y3.

Polarity is the same.  Polarity=0x00010000 will set Y0 to a positive toggle.  Toggle = 0x00030000 Polarity = 0x00010000 will set Y0 and Y1 to toggle, and Y0 will toggle positive and Y1 will toggle negative.  

Pinnacle has limited amount of ADC range so it typically has a balanced toggle, meaning the same number of positive and negative polarities (assuming the electrodes that toggle are all basically the same capacitance).  If a measurement is railed (+32k or -32k rail) you can try add more of the opposite polarity toggle to get it to come in range.  

4. That's exactly right, the closer to 0 you can get the value of the measurement with NO finger, the more range you will have to measure the change caused by the finger. 
5.  Let me explain each and then try to connect a few dots
Frequency is just the speed of the toggle.  The faster the frequency, the faster the measurement will complete. 

Aperture is how long during the toggle that signal is acquired.  Open aperture means that it is acquired through the full toggle event.  The other apertures are a specific amount of time the window of measurement is held open after the toggle has occurred.  Any sensor will have an RC which will mean that it takes a certain amount of time to get to full charge.  Aperture is intended to allow you to tune the settings to match that RC.  So what we recommend is that you set the aperture to full length and then move it in one setting at a time and see if the measurement changes.  If the measurement doesn't decrease then you are not cutting the aperture too short.  As soon as you start decreasing the signal, you are cutting some signal off and should use a longer aperture.  Shorter apertures can work, they just mean you're throwing away signal which typically means lower SNR. 

Gain is the internal gain of the amplifiers in the system.  You can turn it up or down as much as you like, it just zooms in or out on the signal.  Depending on your sensor and setup, sometimes you can zoom in, sometimes you need to zoom out. 

Bit length is the amount of oversampling which is done for each measurement value.  The longer the bit length, the more over sampling and the higher the SNR.  But bit length comes at the cost of measurement time.  The longer the bit length the longer it will take for the measurement to complete.  So if you need ultra fast measurements, shorter bit lengths are typically required. 

I recommend starting at full or open aperture, lowest gain, slowest frequency, and longest bit length.  Then make things faster, higher gain, and shorter aperture one setting at a time until you know the system's limits.  Limits will be set by your sensor, the more capacitance your sensor has the slower things will need to be. 

Quote
2bndy5
Thank you for the timely response. I did read and understand the comments about the toggle and polarity; I referred to them as polynomials because they seem similar to the numbers used for CRC calculations.

Just to clarify that toggle and polarity is a way of compensating the varying capacitances amongst electrodes: say I hypothetically wanted to measure the magnitude of a vector that is 45 degrees from origin (or -245 degrees for a negative resulting magnitude); I cannot specify this vector using the toggle and polarity args? I should just get the x & y magnitudes then calculate it from there?

As for the very helpful answer and advice for #5, I will augment my library's documentation with that info while stressing that the advice is specific to individual applications per prototyped housing of the trackpad. Testing on my behalf is slowed by my rookie ability to draw 3d ergonomic designs.
Quote