herrmannc1899
Hello!

I am currently working on a project that involves using the ESP32 with the TM023023 trackpad. I am running into some issues though.

I am using the Arduino IDE and the TM040040 sample code provided in the Cirque github, and despite successful compilation and uploading, I am still not getting any response out of the trackpad. The serial terminal will simply print "X Y Z Buttons" and then hang up.

I have verified my SPI connections to the ESP32 and they are all correct. For some reason the AssertSenorLED always remains on, so I think that is and indication there is data present and ready to be read? 

I am not sure. No matter how much I touch the pad there is still no response and I am unsure what to do next. Has anyone used one of these things with and ESP32? Perhaps there is some lower level hardware/software incompatibility between the SPI driver in the ESP32, the arduino core, and the trackpad.

Any help would be very much appreciated!
Quote
Cirque-Ethan
Hello herrmannc1899, 

Thanks for reaching out to us. Unfortunately I am not sure how to resolve this issue and will need to check with engineering. They are out of the office for the weekend, but we will be in touch on Monday with some suggestions. 

Sorry for the delay, we will be in touch as soon as possible!

Ethan
Cirque Corporation
Quote
Jon_B
Is the wiring from the TM023023 to the ESP32 correct?  For figuring out pinouts it's best to use the schematic from the TM023023 at: 

https://www.dropbox.com/s/h2iy7t5zpyc8w1g/02-000619-00RevA00_TM023023-2024_UPDATED.pdf?dl=0

Here is a connector:
TM023023_pinout.jpg 
Quote
sean_m
Also as an FYI when verifying the connections to the Molex connector on the TM023023 be aware it is single sided contact so you'll want to verify that the cable is inserted into the connector correctly. 
Quote
herrmannc1899
As far as I know, the wiring is correct.  I have checked, rechecked, and rewired more times than I can count. I have also checked the continuity between the test points on the TM023023 and the gpio pins on the ESP32 dev board I am using and everything checks out. So at least I know that there isn't some fault in wiring.

Would there be any reason that the I2C pins couldn't be left floating despite my using SPI?


Any other ideas? Also, wow! Thank you for all the responses! It seemed a little barren on the forum but this is very reassuring!
Quote
sean_m
Hi herrmannc1899,

It is ok for the I2C pins to be left floating if unused. As and FYI, if used in I2C mode the host side would needs pullups on the SCL and SDA lines.

Cirque offers the TM023023 in I2C and SPI.  Does your TM023023 have R1 (top of the PCB) loaded with a 470K ohm resistor?  That resistor needs to be there to put the module into SPI mode.

If R1 is not there you could put a 470K ohm 0402 resistor on it if you had one available or contact Cirque about replacing your module for one configured for SPI.

If R1 is present you could put a scope on the DR line and see if when the module is touched the DR line goes high.

Also can you let me know which ESP32 you are using?  We may want to get one in house to play around with in the future.

Hopefully this helps.
Quote
herrmannc1899
R1 is definitely populated so it is definitely configured for SPI mode. 

I am not currently at home but if I recall correctly the DR pin was continuously pulled high for some reason. This was indicated by the arduino script in that there is a LED that is supposed to light up in correlation with the DR pin. That LED stays lit. Once I get home I will hook it up to the scope to see if those results corroborate the arduino script. 

I am  using the cheapest ESP32 dev board that I could find on Amazon, which just has a standard ESP-WROOM-32 module.

I will also try probing the other lines to see if any data is being transffered.

Would there be any reason that the code for the TM040040 would not be compatible with the TM023023? Could there be some sort of issue with a different range of measurements or something? Just brainstorming. 

Side Note: I have purchased two TM023023's at this point so I know that they were DOA.
Quote
sean_m
I just ran the same TM040040 code with a TM023023 here on our DK-000013 Development kit and it appears to work fine for me so the code is compatible with the module.

I captured the SPI data on a Saleae analyzer and have attached a screenshot for reference.

Another thought is that the code has pin defines for DR as pin 9, CS as pin 10, etc.  Were you able to use the same pins on your ESP32?  If you had to change them to different pins could one of those maybe be assigned to a pin that may not work as that assignment?

TM023023 SPI Capture.jpg 
Quote
Jon_B
So the sample code was expecting the IO pins to be:

#define SCK_PIN 13
#define DIN_PIN 12
#define DOUT_PIN 11
#define CS_PIN 8
#define DR_PIN 7

You'll have to edit those lines to reflect the pins ESP32 uses for SPI.  (DIN=MISO, DOUT=MOSI, and SCK is the clock)

What pins work for that module?
Quote
herrmannc1899
sean_m wrote:
I just ran the same TM040040 code with a TM023023 here on our DK-000013 Development kit and it appears to work fine for me so the code is compatible with the module.



Well that is good to know. At least that is one more variable isolated.

sean_m wrote:


Another thought is that the code has pin defines for DR as pin 9, CS as pin 10, etc.  Were you able to use the same pins on your ESP32?  If you had to change them to different pins could one of those maybe be assigned to a pin that may not work as that assignment?



Jon_B wrote:
So the sample code was expecting the IO pins to be:


You'll have to edit those lines to reflect the pins ESP32 uses for SPI.  (DIN=MISO, DOUT=MOSI, and SCK is the clock)

What pins work for that module?


The ESP32 has an internal multiplexor, so in therory it should not matter what pins I select as long as they are not input only or are being used for some other reason.

The esp32 also has 4 different SPI ports. SPI0 is normally used by the SPI flash on the board so in this case I used SPI2. I chose this one because the pins where all in close proximity on the dev board. Below you can see the default pin mapping.

Screenshot from 2018-09-13 16-30-24.png 

I am wondering if perhaps the Arduino core does not support the internal multiplexing or if for some reason the Arduino core isn't working with the multiple spi interfaces despite my correct pin definitions. 

Thank you for the screenshot and I am going to try to get a scope on everything and compare.

I will try poking around with a scope and see what I can see. Ill try some different pin assignments as well. Maybe there is something faulty on the dev board.
Quote
Jon_B
Are you using the Arduinio IDE?  What plug-in or package did you install for the ESP32 support? (I don't see it in my list but I mostly use Teensy 3.2).

My guess is the underlying code is hard-coded to use one specific SPI device and it won't select a SPI device based on pin assignments. Looking at the ESP32's source will tell for sure.

I'd guess it only works with SPI1 but I can't say for sure.
Quote
herrmannc1899
I am using the Arduino IDE, yes. I used the esp32 arduino core found here.

Its seems like you are correct in your assumption that one spi interface is hardcoded. I am getting somewhat conflicting reports as to whether that default interface is VSPI or HSPI. Nonetheless I tried both of them

Pin Functions


You can see the pin assignments here.

Interestingly, I took my very basic mini 'sillyscope to the DR pin and for some reason it doesn't appear as though it is ever being pulled high, which of course indicates that there is data ready to be read. That would make sense because the clock and the data lines dont appear to have anything going on with them....

Why could that be?
Quote
NolanM
Are you sure you have the right PinOut for your board? The picture ..

Pin Functions


You can see the pin assignments here.


... doesn't match your board ...
...
I am  using the cheapest ESP32 dev board that I could find on Amazon, which just has a standard ESP-WROOM-32 module. ...


NOTE: The printout picture has 8 more pins than the you linked to from Amazon. 

I was able to get the overlay code working on my Adafruit Feather with Bluetooth. I did have to reassign the pins to match the hardware's SPI lines, but when I tried to do the same for your board I noticed the discrepancy. Did they give you a pinout for the board you purchased? I'll do some more digging and see if I can find anything more ...
Quote
NolanM
Your board's schematic here. Try using this to define the pins and connect it respectively. 


#define SCK_PIN 18
#define DIN_PIN 19
#define DOUT_PIN 23
#define CS_PIN 5
#define DR_PIN 4
#define SDA_PIN 21
#define SCL_PIN 22


So I deduced the correct pinout which I have displayed below. Luckily the ports they chopped from the ESP32 were not the SPI ones, but they had no documentation for using the Arduino IDE to push firmware to the development board. Here is a link for how they recommend pushing firmware to their device. 

Contrarily, after some more digging I found that their 'company name' was listed in the supported boards from Espressif's board list after installing their package. If it works that way, great!

Capture.jpg

If you are still stuck after this, it's honestly got to be the board. I would recommend going with something that isn't the cheapest available option on Amazon. I would recommend Adafruit's HUZZAH32. They have been the most reliable tinker supplier for me and everything they have is well documented and supported. 

Hope this helps!
Quote
Jon_B
NolanM's pinout looks right to me.  Did you have a chance to try it?
Quote