Wall touch light switch, EEPROM, I2C - Page 1
Forum section: electronics / beginners

author: Manx
author_rank: Contributor
timestamp: May 01, 2019, 10:00:33 am
content: I'm trying to adjust sensitivity of my friend's wall touch light switch.And I'm dumbfounded.There is HD6001 touch IChttp://www.hab.com.tw/upload/2013879261133084.pdf.There is our usual Atmel EEPROM.http://ww1.microchip.com/downloads/en/devicedoc/doc0180.pdf.Also, there is something which has to be a RF receiver, which doesn't interest me.I thought the EEPROM would keep settings for the device. I dumped it's content (whatever is the meaning of it).Code:FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FFFF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FFFF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FFFF FF FF FF FF FF FF FF FF FF FF FF 00 FF FF FF22 0D F9 93 FF FF FF FF FF FF FF FF FF FF FF FFFF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FFFF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FFFF FF FF FF FF FF FF FF FF FF FF FF 40 FF FF FF14 FC A9 E2 14 AF 43 90 FF FF FF FF FF FF FF FFFF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FFFF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FFFF FF FF FF FF FF FF FF FF FF FF FF 84 FF FF FFFF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FFFF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FFFF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FFFF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FFBut when I read the touch IC datasheet (a Chinese flavor of a datasheet style, but not too bad), it seems that it can communicate over I2C only as a slave. And there is the eeprom. So we have two gearboxes and no engine. And indeed, there is no communication over I2C bus when the switch is powered up or buttons are pressed (I don't have a compatible remote to check if anything changes when I'd program one).The touch IC supposedly has some registers to control its settings, but I cannot find the IC on the I2C bus to communicate with it. It doesn't help that the I2C address is kept in one of the registers. But anyway, a scanner doesn't find it.Could anyone help me make heads or tails of it? Why the eeprom? How to talk to the touch IC?

author: Kjelt
author_rank: Super Contributor
timestamp: May 01, 2019, 10:08:28 am
content: Check the RF board if there is some processor on it ?I have seen BT remote switches where the BT transceiver micro is the only micro on the board, but if you do not see any I2C communication at startup or use it is a puzzle.EDIT: the HD6001 is a microcontroller, check if the SDA and SCL lines are connected to the eprom, probably not.As you said those are for remote host control. So the programmer can use any of the I/O ports to bitbang I2C to the eprom ?Just see what the SDA and SCL of the eprom are connected to what pins on the micro.

author: Manx
author_rank: Contributor
timestamp: May 01, 2019, 10:32:43 am
content: RF board has some tiny 6 lead IC marked H01 (followed by 6 lying on its back). I couldn't find anywhere any corresponding IC which would make sense. Remote control is supposed to be over 433.92 MHz. I don't know how smart these are. Anyways, the I2C lines don't go to the RF board.But the I2C lines ARE properly connected between eeprom and HD6001. This was the first thing I checked and so I expected the touch IC to talk to the eeprom, before I read the rest of the datasheet.EDIT: Also, I2C doesn't seem to go anywhere outside the board. Neither to the HV board connector nor to the unpopulated group of pads I used for connecting power. So it's not like it's supposed to be used by an external programmer or some missing additional chip.I have no idea what this is about.EDIT:Ok, so I was right suspecting the eeprom may have something to do with remote control. It turns out the switch works with my remote. And when I press a button on the remote, whether one paired with the switch or not, raw data goes from the receiver to pin 9 of the touch IC, and some chat ensues over I2C.So this would mean that: (1) it's not true that HD6001 cannot work as I2C master, (2) the eeprom is used for remote control and (3) I still have no idea how to communicate with HD6001 and modify its registers.

author: Kjelt
author_rank: Super Contributor
timestamp: May 01, 2019, 12:25:26 pm
content: Did you read my Edit ?Probably the microcontroller uses two different GIOports to bitbang I2C with the eprom.You can program the microcontroller through the original I2C pins as per datasheet specified, they are also probably connected to that header or some other pads where the micro is programmed.

author: Manx
author_rank: Contributor
timestamp: May 01, 2019, 12:46:13 pm
content: Ah, ok, bitbang. I'm starting to get what you mean. But anyways, these are the same I2C pins. Eeprom connects to pins 5 and 4 (marked SDA and SCL) of the touch IC. This was elegant on the part of the designer, but this is what confused me. Sice, I guess, it turns out the pins are used as normal GPIOs and their I2C functionality is bit banged.In such case there would be no (apparent) way to modify touch IC parameters, like sensitivity, which doesn't make me happy :/ I played with programming more buttons, and the eeprom stores only a list of remote keys assigned to each switch button (plus address of last item on the list for each button). So no calibration data in the eeprom :/

author: Kjelt
author_rank: Super Contributor
timestamp: May 01, 2019, 01:59:08 pm
content: I have no time to read the datasheet but perhaps there is a special (startup) condition where the uC can be programmed through I2C ?Since both ic's have a different I2C address this could be the case ?

author: Manx
author_rank: Contributor
timestamp: May 01, 2019, 02:22:57 pm
content: Nothing about this in the datasheet. Nothing about programming at all.So a typical problem with Chinese (and Taiwanese, in this case) ICs and their datasheets. There is only one, preliminary, version of the datasheet on the whole internet, and no discussion about the chip anywhere.

author: Kjelt
author_rank: Super Contributor
timestamp: May 01, 2019, 03:51:03 pm
content: Did you try a I2C busscan with a buspirate or the likes ?It should find the uC on the HD6001 default Slave address: 0110 000.

author: Manx
author_rank: Contributor
timestamp: May 01, 2019, 04:18:57 pm
content: I used Arduino loaded with MultiSpeedI2CScanner (https://github.com/RobTillaart/Arduino/tree/master/sketches/MultiSpeedI2CScanner). It found only the eeprom (8 times even, which was funny to me, btw.. From 0x50 to 0x57). But nothing from HD6001. I also tried to manually talk to 0x30, but no one responded.I'd guess that when the designer reprogrammed the chip, the content of the datasheet ceased to be valid. The datasheet is probably for some general purpose version of the chip, and mine has a custom firmware which allows it to work in this specific setup, with remote control and eeprom -- and not only as a simple switch or a peripheral to another MCU.

author: Kjelt
author_rank: Super Contributor
timestamp: May 01, 2019, 05:19:37 pm
content: The datasheet is confusing.On page15 they state you can program rhe I2C slave address in 9 bits while the protocol only supports 7 bitsBTW it also states:QuoteYou could try that one and check your pulses, stay below 75kHz and the required setup times of 5us.

author: Manx
author_rank: Contributor
timestamp: May 01, 2019, 06:51:14 pm
content: 50 kHz, 10 us between SDA going low and first SCL going low. Nothing on the scanner. Nothing while trying to read from 0x30 or 0x60 manually.I'm hereby ready to give upThanks Kjelt for your interest and your help. I learned some new things today, but I don't think it's worth spending more time on this. At least not this way.The problem with the switch was that one button sometimes was getting tripped by itself. Sometimes every couple of days, sometimes every couple of minutes.So maybe there are some hardware methods to adjust this. There are 1k resistors between chip pins and sensing electrodes. I guess changing them should affect sensitivity.I'll decrease the resistance a bit and I'll hope it will fix the problem.