Really strange problem with STM32 and CTPs

External hardware connected to the STM32 board
Post Reply
bdbell
Posts: 20
Joined: Tue Apr 28, 2015 7:35 am

Really strange problem with STM32 and CTPs

Post by bdbell » Fri Nov 11, 2016 5:16 am

I am working on a project for a client that wants to connect multiple Capacitive Touch Panels to a PC as an interactive controller. We have selected this 7" touch panel - http://www.buydisplay.com/default/7-inc ... or-800x480 to build the prototypes with for now. Since the touch panel has a fixed i2c address I initially built some prototypes using 3 arduino's each receiving the data from a single CTP and relaying that data via serial to an Arduino Mega (also built some using STM32 instead of Mega) - this worked very well but now the client wants to connect 5 CTP's.

In order to slim down things and create a proper board for this I decided to use a single STM32 with a TCA9548A i2c multiplexer. I have built several prototype boards using STM32 and some CJMCU-9548 multiplexer breakout boards that I got off Taobao, and also built one using a Nano instead of STM32. The Nano board prototype works OK, I can receive data from 5 connected touch panels, but only one at a time - not the issue though, because I would really rather use STM32.

The really strange thing is that in all cases with the STM32 prototypes - they only work if I (or someone else) touches the top of the STM32 IC while the touch panels are in use :o - I have built prototypes using an STM32 on a breakout PCB, with Baite like clones, with a real LeafLabs Maple Mini r5, and some other STM32 clones. I also made a PCB - which like all the others, works wonderfully - but only when someone touches the top of the STM32 IC (I can receive data from up to 5 touches from each of the 5 CTPs all at once with the STM32). There really is no difference between how the Nano and the STM32 prototypes are wired. I have tried all sorts of things with no luck in solving this - short of finding little people to sit in each of the systems....I know I am probably going to get a lot of flack on this one, but hope I can figure out what's happening here....

User avatar
RogerClark
Posts: 7546
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Really strange problem with STM32 and CTPs

Post by RogerClark » Fri Nov 11, 2016 9:00 am

Firstly you don't need the multiplexer, because the default Wire I2C library is bit-banged Software I2C, so you can just create several instances and put them on different pins.

Re: Needing to touch the STM32

I presume you mean it doesn't detect the touch unless you use your body as a resistor / capacitor between the STM32 and the display

Or do you mean I2C doesn't communicate with the displays at all unless you touch the STM32?

If its the former, I presume that you are increasing the charge you impart to the display when you touch it, if you are charging yourself from the STM32
(I presume you are powering this from USB etc ?? and not a battery)

bdbell
Posts: 20
Joined: Tue Apr 28, 2015 7:35 am

Re: Really strange problem with STM32 and CTPs

Post by bdbell » Mon Nov 21, 2016 1:31 pm

Hi @RogerClark - thanks for your reply, I got busy with the day job and just getting back to this.
RogerClark wrote:Firstly you don't need the multiplexer, because the default Wire I2C library is bit-banged Software I2C, so you can just create several instances and put them on different pins.
I know I could do this, but felt the multiplexer would make it easier to also make an Arduino version if I was unable to get the STM32 version working, or the client decided they wanted Arduino - I am trying to convince them the STM32 is better :)
I presume you mean it doesn't detect the touch unless you use your body as a resistor / capacitor between the STM32 and the display

Or do you mean I2C doesn't communicate with the displays at all unless you touch the STM32?

(I presume you are powering this from USB etc ?? and not a battery)
Yes they are powered from USB, the touch panel operates at 3.3v. What I have been doing is testing the prototypes with the touch panels laying flat on my desk, and the PCB mounted in a 3D printed tray. This setup works fine when testing with Arduino. But since I posted this I have done a lot more testing and I found that with the touch panel laying flat on the desk I had to either have my arm or hand also touching the desk itself (wooden desk), or someone had to touch the STM32 IC - by someone I mean it did not have to be the same person that was touching the panel. I found that if I pick the touch panel up off of the desk it works just fine - so I have mounted it and this is no longer an issue. Strange how this only happened with STM32 and the Arduino's are not affected by this. Feeling a little silly of course that it turned out to be something so simple as having the touch panel laying on the desk instead of mounted :oops:

So now on to get this working, I have tested using different pins for I2C and confirmed it works fine. But I am unsure of how to create 5 instances of I2C in the same sketch - do you have or know of any examples of creating multiple I2C instances? I am using Arduino IDE 1.6.12 and have the latest Arduino STM32 files from github.

Post Reply