2019-10-06 01:44 AM
I have designed an STM32F04 based board with a shield, 4 touchkey sensor (round electrodes with a 10mm diameter) as well as 2 linear sensors. These are using the 3 half-ended electrodes interlaced sensor sensors as described in AN4312. Some things remained unclear to me, notably whether the underside of an electrode should be left clear or flooded with a hatched shield plane and whether to route the electrode/signal traces on the same side as the electrodes ( 2-layer PCB). However, touchkeys worked pretty much out-of-the-box after setting up the config in CubeMX and calling the auto-generated state machine. While I don't get touch states per se, I do get reliable enough readings for proximity, detect, release states , so it should be workable when tweaking the thresholds / sensitivities a little.
The linear sensors however are still giving me trouble. When trying to debug the issue and reading from the auto-generated MyLinRots_Data[] , I noticed RawPos values jumping in a rather crazy fashion when moving along the slider from one end to the other (for example, it might go 130->.. ->140->120->..->130->140..->150 , something like that , so values increasing steadily, then jumping up or down to some other value and increasing steadily again). This may be due to the interlaced sensors, and judging by its name, one should probably not be accessing this parameter from the application layer anyway, but could be useful information.
Now, MyLinRots_Data[] ->Position is looking a bit better, but the readings are just too unreliable and low-res to be usable right now. Basically I get position readings between 7 and 9 (most of the time it's either 8 or 9 , but I have also seen a more-or-less continuous downwards movement give readouts of 9->8->7->8 before). From what I have noticed, the direction bit seems to be accurate enough, however I can't confirm this for sure yet.
While sifting through the code for some possible config solutions, I stumbled upon the delta coefficient, as well as the position offset
(TSL_tsignPosition_T *)TSL_POSOFF_3CH_LIN_H )
and the position correcture TSL_POSCORR_3CH_LIN_H. However, I could not make much sense of it yet, especially as the latter 2 don't seem to be documented anywhere - after looking through several apllication notes / design recommendation documents, I could only find these used in examples, but never documented.
How do I get more reliable and higher resolution readouts for these linear sensors? What are the odds this can be tweaked without a board re-design?
Some additional info that might be helpful or not:
-The MCU is using the USB PHY and a timer output to control some addressable RGB LEDs (WS2813 - same protocol as the more popular WS2812)
-The sliders should be using the same acquisition bank as far as I can tell (the first slider uses G1_IO2, G2_IO2, G5_IO2 while the second uses ... _IO3 )
-ESD resistors and capacitors (NP0/C0G) are placed reasonably close to the MCU, quite possibly however their values need to be tweaked (the capacitance / resistance for the shield vs for the sensors should be proportional to the ration between electrode/shield areas and I don't think this is the case yet.
-The area around the MCU / Rs / Cs is flooded with ground planes on both sides, with rather excessive via stitching to connect them.
Thanks for reading and if more information or detail is needed, I'll happily provide it.