AnsweredHot!Two MTCH6102 touch surfaces. How to change address in one of them.

Page: 12 > Showing page 1 of 2
Author
ivlch
New Member
  • Total Posts : 16
  • Reward points : 0
  • Joined: 2018/01/30 10:22:43
  • Location: 0
  • Status: offline
2018/08/06 03:23:25 (permalink)
0

Two MTCH6102 touch surfaces. How to change address in one of them.

Hello,
 
currently, my setup is employing a MTCH6102 powered touch surface (5x5). SCK and SDA directly connected to SCK and SDA pins on ATMega32u4 chip.

I need to add a second touch surface, however, the I2C address cannot be changed before boot.
 
How to change the address of one touch surface in order to distinguish between them? This change has to persist over reboot. Documentation says to contact Microchip support. Trying forum as well.
 
Thanks a lot in advance

Attached Image(s)

#1
DeutcheN
Junior Member
  • Total Posts : 65
  • Reward points : 0
  • Joined: 2010/09/01 12:35:40
  • Location: DM43BH
  • Status: offline
Re: Two MTCH6102 touch surfaces. How to change address in one of them. 2018/08/07 10:49:11 (permalink)
+1 (1)
Hello,
 
  Please submit a Microchip support ticket for this.
 
Thanks
#2
ivlch
New Member
  • Total Posts : 16
  • Reward points : 0
  • Joined: 2018/01/30 10:22:43
  • Location: 0
  • Status: offline
Re: Two MTCH6102 touch surfaces. How to change address in one of them. 2018/08/08 23:59:11 (permalink)
0
Trying to. Currently waiting a second day for their "up to 30 minutes" confirmation of a registration. 
 
The support numbers, no one picks up.
 
Any ideas what to do?
#3
Denge
Senior Member
  • Total Posts : 72
  • Reward points : 0
  • Joined: 2016/03/03 07:23:12
  • Location: belgium
  • Status: offline
Re: Two MTCH6102 touch surfaces. How to change address in one of them. 2018/08/09 03:02:25 (permalink)
+2 (2)
Hello,
The default address (0x25) is in register 0x43.
This one you can change and make it permanent with the NV and CNF bits...
 
RTM
 
 
#4
ivlch
New Member
  • Total Posts : 16
  • Reward points : 0
  • Joined: 2018/01/30 10:22:43
  • Location: 0
  • Status: offline
Re: Two MTCH6102 touch surfaces. How to change address in one of them. 2018/08/09 03:16:34 (permalink)
+1 (1)
Tried to change the address by overwriting the 0x43 register, however, I cannot communicate with MTCH6102 using the new address. Wrote another forum post here: https://www.microchip.com/forums/m1063751.aspx

Can you have a look?
#5
ivlch
New Member
  • Total Posts : 16
  • Reward points : 0
  • Joined: 2018/01/30 10:22:43
  • Location: 0
  • Status: offline
Re: Two MTCH6102 touch surfaces. How to change address in one of them. 2018/08/09 03:21:49 (permalink)
0
//can't edit my post as I am getting access denied error

What are the NV and CNF bits?
#6
Denge
Senior Member
  • Total Posts : 72
  • Reward points : 0
  • Joined: 2016/03/03 07:23:12
  • Location: belgium
  • Status: offline
Re: Two MTCH6102 touch surfaces. How to change address in one of them. 2018/08/09 11:43:50 (permalink)
+1 (3)
I suggest you read the data sheet in detail from the beginning to the end.
What would you think about Non Volatile and CoNFiguration :-)
#7
ivlch
New Member
  • Total Posts : 16
  • Reward points : 0
  • Joined: 2018/01/30 10:22:43
  • Location: 0
  • Status: offline
Re: Two MTCH6102 touch surfaces. How to change address in one of them. 2018/08/10 05:05:29 (permalink)
0
Thanks for the heads up. Learning the ropes, this is my first experience with this type of setup. Thought rewriting the register was enough.
 
For fellow learners out there, what he meant is:
In order to change the settings of MTCH6102, you need to (1) rewrite the registers with your custom settings and then (2) set CFG (not CNF as indicated by Denge) bit to 1 in order to coerce the changes. See Configuration RAM Memory Map if the settings you want to change need to be coerced by setting CFG to 1. See attached pictures for more info.

The only issue is, it does not work for me yet.


1. I added a line (after changing the I2CADDR register) that writes to CMD register (0x04) and sets CFG bit to 1. (byte written = 0x20)
2. I read the CMD register to check whether it was overwritten. Yes, returns 0x20.
3. Delay for 50ms to wait for the command to be executed.
4. Re-read CMD register to check whether command was executed - in documentation, it says, the CFG bit clears when the command is finished - Yes, returns 0x00, the CFG bit cleared.
5. Trying to read register I2CADDR (0x43) using the new address (0x23). Returns Error: 2 and 3
6. Trying to read GESTURESTATE register using the new address (0x23). Returns Error: 2 and 3
7. Trying to read register I2CADDR (0x43) using the default address (0x25). Returns 0x23.
 
Adding code as well as output from buspirate. When using the new address, in the buspirate output, only the error codes are seen.
//Read the I2C address register (0x43)
  Serial.print("I2C Address at 0x25: ");
  Serial.println(readRegister(MTCH6102_I2CADDR_DEFAULT, MTCH6102_I2CADDR), HEX); //[0x4A+0x43+[0x4B+0x23-]
  
  //Overwrite default address with 0x23
  writeRegister(MTCH6102_I2CADDR_DEFAULT, MTCH6102_I2CADDR, MTCH6102_I2CADDR_RIGHT); //[0x4A+0x43+0x23+]
  Serial.println("Register 0x43 overwritten with 0x23");
  Serial.println();

  //Coerce the configuration changes
  writeRegister(MTCH6102_I2CADDR_DEFAULT, MTCH6102_CMD, MTCH6102_CMD_CFG); //[0x4A+0x04+0x20+]
  Serial.println("Changes coerced.");
  Serial.print("CMD register: ");
  Serial.println(readRegister(MTCH6102_I2CADDR_DEFAULT, MTCH6102_CMD), HEX); //[0x4A+0x04+[0x4B+0x20-]
  Serial.println();

  delay(50); //takes between 45-40ms
  Serial.print("CMD register: ");
  Serial.println(readRegister(MTCH6102_I2CADDR_DEFAULT, MTCH6102_CMD), HEX); //[0x4A+0x04+[0x4B+0x00-]
  
  //Read I2CADDR register, using the NEW address (0x23)
  Serial.print("I2C Address at 0x23: ");
  Serial.println(readRegister(MTCH6102_I2CADDR_RIGHT, MTCH6102_I2CADDR), HEX); //[0x46-][0x47-]
  
  //Read I2CADDR register, using the DEFAULT address (0x25)
  Serial.print("I2C Address at 0x25: ");
  Serial.println(readRegister(MTCH6102_I2CADDR_DEFAULT, MTCH6102_I2CADDR), HEX); //[0x4A+0x43+[0x4B+0x23-]

  Serial.print("GESTURESTATE: ");
  gesture_id = readRegister(MTCH6102_I2CADDR_RIGHT, MTCH6102_GESTURESTATE); [0x46-][0x47-]
  Serial.println(gesture_id, HEX);

 
What am I missing?
post edited by ivlch - 2018/08/10 05:14:55

Attached Image(s)

#8
qɥb
Monolothic Member
  • Total Posts : 3329
  • Reward points : 0
  • Joined: 2017/09/09 05:07:30
  • Location: Jupiter
  • Status: offline
Re: Two MTCH6102 touch surfaces. How to change address in one of them. 2018/08/10 05:22:10 (permalink)
+1 (1)
I suspect the new address does not take effect until the chip has been power cycled.

This forum is mis-configured so it only works correctly if you access it via https protocol.
The Microchip website links to it using http protocol. Will they ever catch on?
PicForum "it just works"
#9
ivlch
New Member
  • Total Posts : 16
  • Reward points : 0
  • Joined: 2018/01/30 10:22:43
  • Location: 0
  • Status: offline
Re: Two MTCH6102 touch surfaces. How to change address in one of them. 2018/08/10 05:27:32 (permalink)
+1 (1)
At this point, I do not write the changes to non-volatile memory, so I believe power-cycling the chip removes the changes.

Either way, tested it, did not fix it.

Will try to write to non-volatile memory using the NV bit as suggested by Denge. MTCH6102 documentation suggests two ways, how to configure the chip, see attached image.
 
Here is the debug output (this is returned to Serial, as per the code I posted above):
I2C Address at 0x25: 25
Register 0x43 overwritten with 0x23

Changes coerced.
CMD register: 20
Wait for 50ms.
CMD register: 0
I2C Address at 0x23: Error: 2
3
I2C Address at 0x25: 23
GESTURESTATE: Error: 2
3


Any other ideas?

Attached Image(s)

#10
qɥb
Monolothic Member
  • Total Posts : 3329
  • Reward points : 0
  • Joined: 2017/09/09 05:07:30
  • Location: Jupiter
  • Status: offline
Re: Two MTCH6102 touch surfaces. How to change address in one of them. 2018/08/10 05:31:11 (permalink)
0
If it was possible to do it without a power cycle, then you would not be able to read the CMD register after 50ms, because the new address would have taken effect.
Have you tried writing it to NV yet?
 

This forum is mis-configured so it only works correctly if you access it via https protocol.
The Microchip website links to it using http protocol. Will they ever catch on?
PicForum "it just works"
#11
ivlch
New Member
  • Total Posts : 16
  • Reward points : 0
  • Joined: 2018/01/30 10:22:43
  • Location: 0
  • Status: offline
Re: Two MTCH6102 touch surfaces. How to change address in one of them. 2018/08/10 05:51:31 (permalink)
0
Yes, you are right, already being able to read the CMD register using default address shows it did not change. Added to debug also reading using new address (0x23). However, the change of configuration upon startup should be possible. See attached picture from documentation page 26. Also adding here link to the documentation, if you want to have a look: http://ww1.microchip.com/...eviceDoc/40001750A.pdf

Tried to write to nonvolatile memory by setting NV bit to 1. Did not produce a difference. Tried (1) setting both bits (NV and CFG) at the same time, as well as (2) one after another.

See debug below for (2):

I2C Address at 0x25: 23
Register 0x43 overwritten with 0x23
CMD Register overwritten with 0x20. Coerce the changes
CMD register: 20
Wait for 50ms
CMD register: 0
CMD Register overwritten with 0x80. Save to nonvolatile memory.
CMD register: 80
Wait for 50ms
CMD register using 0x25: 0
CMD register using 0x23: Error: 2
3
I2C Address at 0x23: Error: 2
3
I2C Address at 0x25: 23
GESTURESTATE: Error: 2
3

 
Also the buspirate i2c sniffer output at 100kHz:

[0x4A+0x43+[0x4B+0x23-][0x4A+0x43+0x23+][0x4A+0x04+0x20+][0x4A+0x04+[0x4B+0x20-][0x4A+0x04+[0x4B+0x00-][0x4A+0x04+0x80+][0x4A+0x04+[0x4B+0x80-][0x4A+0x04+[0x4B+0x00-][0x46-][0x47-][0x46-][0x47-][0x4A+0x43+[0x4B+0x23-][0x46-][0x47-]


Attached Image(s)

#12
ivlch
New Member
  • Total Posts : 16
  • Reward points : 0
  • Joined: 2018/01/30 10:22:43
  • Location: 0
  • Status: offline
Re: Two MTCH6102 touch surfaces. How to change address in one of them. 2018/08/10 05:55:12 (permalink)
0
Is that the right way to save to nonvolatile memory?
#13
qɥb
Monolothic Member
  • Total Posts : 3329
  • Reward points : 0
  • Joined: 2017/09/09 05:07:30
  • Location: Jupiter
  • Status: offline
Re: Two MTCH6102 touch surfaces. How to change address in one of them. 2018/08/10 06:49:10 (permalink)
+1 (1)
My guess would have been to set CFG, and then NV.


For permanent configuration: Either during
manufacturing test or on first start-up, the host
controller writes all configuration values to the
controller, sets the CFG bit and stores them to
NVRAM by using the NV bit.

Note, I've never used this chip, I'm just reading the same DS you are.

This forum is mis-configured so it only works correctly if you access it via https protocol.
The Microchip website links to it using http protocol. Will they ever catch on?
PicForum "it just works"
#14
ivlch
New Member
  • Total Posts : 16
  • Reward points : 0
  • Joined: 2018/01/30 10:22:43
  • Location: 0
  • Status: offline
Re: Two MTCH6102 touch surfaces. How to change address in one of them. 2018/08/10 07:44:52 (permalink)
0
Yes, I guess. Unfortunately, it did not work

Edit: Setting the NV bit worked. Subsequently, it is necessary to power off and on the chip.
 
However, anyone knows why changing the settings without writing to NV does not work?
post edited by ivlch - 2018/08/10 08:31:42
#15
Jim Nickerson
User 452 _
  • Total Posts : 5126
  • Reward points : 0
  • Joined: 2003/11/07 12:35:10
  • Location: San Diego, CA
  • Status: offline
Re: Two MTCH6102 touch surfaces. How to change address in one of them. 2018/08/10 08:30:20 (permalink)
+1 (1)
Maybe the NV is only read at power on.
#16
ivlch
New Member
  • Total Posts : 16
  • Reward points : 0
  • Joined: 2018/01/30 10:22:43
  • Location: 0
  • Status: offline
Re: Two MTCH6102 touch surfaces. How to change address in one of them. 2018/08/10 08:34:16 (permalink)
+1 (1)
Yes, that was the case. Thanks for the reply. Do you know why changing the configuration without saving it to nonvolatile memory does not work? 
 
Steps:
1. Change I2CADDR register.
2. Set CFG bit to 1.
#17
Jim Nickerson
User 452 _
  • Total Posts : 5126
  • Reward points : 0
  • Joined: 2003/11/07 12:35:10
  • Location: San Diego, CA
  • Status: offline
Re: Two MTCH6102 touch surfaces. How to change address in one of them. 2018/08/10 08:36:00 (permalink)
0
My best guess is the configuration values are read once from NV at power on.
#18
ivlch
New Member
  • Total Posts : 16
  • Reward points : 0
  • Joined: 2018/01/30 10:22:43
  • Location: 0
  • Status: offline
Re: Two MTCH6102 touch surfaces. How to change address in one of them. 2018/08/10 08:38:13 (permalink)
0
Any ideas how is it possible to achieve the configuration on each start-up as mentioned in documentation? See attached image,
(Point 2.). 
 

Attached Image(s)

#19
XiangGao
Senior Member
  • Total Posts : 35
  • Reward points : 0
  • Joined: 2016/07/07 15:54:59
  • Location: 0
  • Status: offline
Re: Two MTCH6102 touch surfaces. How to change address in one of them. 2018/08/10 10:54:58 (permalink)
+5 (5)
Hi Ivlch,
 
The correct sequence is to set the CFG first after changing any parameters, including the I2C address, and then set NV bit.
 
Correct sequence:
-Change parameters
-set CFG bit: store the new parameters into the RAM buffer, will lose after power cycle.
-set NV bit: store the new parameters from RAM buffer into non-volatile memory.
 
This sequence of storing the touch configuration is the same. However, the MTCH6102 has a bug that you will be only able to perform saving parameters to NVM once. If you have already changed the I2C address once, you won't be able to perform any other saving to NVM. 
 
My suggestion is that once you fine-tuned your parameters, then you set all the parameters and change the I2C address, after that set CFG bit and NV bit. Please note you will only be able to do this with the device that hasn't set NV bit after purchase. 
 
Microchip is working on an errata for this bug.
 
Regards,
 
-Xiang
 
#20
Page: 12 > Showing page 1 of 2
Jump to:
© 2018 APG vNext Commercial Version 4.5