MPR121 datasheet and app note give wrong i2c slave address (rev 0, 9/2009)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MPR121 datasheet and app note give wrong i2c slave address (rev 0, 9/2009)

6,669 Views
joncas
Contributor II

Hello,

if anyone else tries out the MPR121 touch sensor controler, I wanted to save them some frustrating hours by pointing out the both the MPR121 datasheet and the i2c communication application note AN3895  (both currently at Rev 0, 9/2009) give the wrong i2c slave address for this part.

When the address select line is tied to ground, the correct slave address is 0x5a (and not 0x4D). I imagine the other three options (address select tied to Vcc or SDA or SCL are similarly wrong and should all be shifted to 0x59, 0x5b, 0x5c).

Otherwise the controller works fine and is simpler to configure than the AD7147.

Best regards,

Robert

Tags (1)
0 Kudos
Reply
9 Replies

2,953 Views
Master_col
Contributor III

excuse me, do you have the information for configurate some registers on MPR121. I cant find the app notes 3893 3894. thank you.

 

Best regards.

0 Kudos
Reply

2,953 Views
joncas
Contributor II

Hello,

 

i enquired to tech support about those two app notes, and they said that they haven't yet been written, so we don't know the details of some registers. Missing is in particular any information about using the GPIO functionality e.g. for feedback LEDS, and the ELEPROX mode of using all 12 electrodes combined as a proximity sensor

Here is the initialization code I used for 12 simple keys, based on the documentation that is available and the KITMPR121 code :

 

  MPR121_WriteRegister(0x2B,1); // MAX HALF DELTA Rising
  MPR121_WriteRegister(0x2C,1); // NOISE HALF DELTA Rising
  MPR121_WriteRegister(0x2D,0); // NOISE COUNT LIMIT Rising
  MPR121_WriteRegister(0x2E,0); // DELAY LIMIT Rising
  MPR121_WriteRegister(0x2F,1); // MAX HALF DELTA Falling
  MPR121_WriteRegister(0x30,1); // NOISE HALF DELTA Falling
  MPR121_WriteRegister(0x31,0xFF); // NOISE COUNT LIMIT Falling
  MPR121_WriteRegister(0x32,2); // DELAY LIMIT Falling
 
  MPR121_WriteRegister(0x41,15); // ELE0 TOUCH THRESHOLD
  MPR121_WriteRegister(0x42,10); // ELE0 RELEASE THRESHOLD
  MPR121_WriteRegister(0x43,15); // ELE1 TOUCH THRESHOLD
  MPR121_WriteRegister(0x44,10); // ELE1 RELEASE THRESHOLD
  MPR121_WriteRegister(0x45,15); // ELE2 TOUCH THRESHOLD
  MPR121_WriteRegister(0x46,10); // ELE2 RELEASE THRESHOLD
  MPR121_WriteRegister(0x47,15); // ELE3 TOUCH THRESHOLD
  MPR121_WriteRegister(0x48,10); // ELE3 RELEASE THRESHOLD
  MPR121_WriteRegister(0x49,15); // ELE4 TOUCH THRESHOLD
  MPR121_WriteRegister(0x4A,10); // ELE4 RELEASE THRESHOLD
  MPR121_WriteRegister(0x4B,15); // ELE5 TOUCH THRESHOLD
  MPR121_WriteRegister(0x4C,10); // ELE5 RELEASE THRESHOLD
  MPR121_WriteRegister(0x4D,15); // ELE6 TOUCH THRESHOLD
  MPR121_WriteRegister(0x4E,10); // ELE6 RELEASE THRESHOLD
  MPR121_WriteRegister(0x4F,15); // ELE7 TOUCH THRESHOLD
  MPR121_WriteRegister(0x50,10); // ELE7 RELEASE THRESHOLD
  MPR121_WriteRegister(0x51,15); // ELE8 TOUCH THRESHOLD
  MPR121_WriteRegister(0x52,10); // ELE8 RELEASE THRESHOLD
  MPR121_WriteRegister(0x53,15); // ELE9 TOUCH THRESHOLD
  MPR121_WriteRegister(0x54,10); // ELE9 RELEASE THRESHOLD
  MPR121_WriteRegister(0x55,15); // ELE10 TOUCH THRESHOLD
  MPR121_WriteRegister(0x56,10); // ELE10 RELEASE THRESHOLD
  MPR121_WriteRegister(0x57,15); // ELE11 TOUCH THRESHOLD
  MPR121_WriteRegister(0x58,10); // ELE11 RELEASE THRESHOLD
  MPR121_WriteRegister(0x59,15); // eleprox TOUCH THRESHOLD
  MPR121_WriteRegister(0x5a,10); // eleprox RELEASE THRESHOLD
 
  MPR121_WriteRegister(0x5C,0x0B); // AFE CONFIG  FFI   CDC %1011  AN3889
  MPR121_WriteRegister(0x5D,0x04); // TOUCH DETECTION CONFIG last 3 bits = sample interval ; 4 == 5ms ( slows down samples to achieve 29uA consumption)
  MPR121_WriteRegister(0x7B,0x0B); // %1011 AUTOCONFIG enable
  MPR121_WriteRegister(0x7D,156); //196 was 156   AUTOCONFIG upper limit USL 156 for 1,8V   196 for 3V
  MPR121_WriteRegister(0x7E,101); //127 was 101  AUTOCONFIG lower limit LSL  65% of USL
  MPR121_WriteRegister(0x7F,140); //176 was 140  AUTOCONFIG target level  90% of USL
  MPR121_WriteRegister(0x5E,0x0c); // START PESCE (number of electrodes )

 

Writing 0c3D to register 0x5E seems to enable ELEPROX...

0 Kudos
Reply

2,953 Views
Master_col
Contributor III

thank you a lot for your answer i will prove this. i have worked with the MPR031 and i tried to configure the mpr121 as the 031 i can get it work but the problem i have is that it works after come time like 30 sec or something i dont know why.  i can read the electrode status registers after this time and after this time works ok for me but i dont know if it is something with some register. Thank you for your answer again. and by the way how did you get it work... how many time testing ?? .

 

best regards, Christian

0 Kudos
Reply

2,953 Views
mylim
Contributor IV

Hi guys, i have posted at https://community.freescale.com/message/68934#68934 regarding bit banging a MPR121. 

I tried with bigmac's sample of bit banging on my MPR121 using MC9S08QE32 but i kept getting $FF for both KEYREGLO and KEYREGHI when i read them. Anyone could advise?

Thanks.

 

Regards,

MY 

0 Kudos
Reply

2,953 Views
joncas
Contributor II

I have noticed the delay -- it is due to the autocalibration taking some time to ramp up the baseline values. They start at 0 and have to ramp up to the level set in the configuration. You can see this if you repeatedly read in the baseline registers 0x1E - 0x2A after power-up. The touch interrupt only starts working when they have reached the preprogrammed value set in the AUTO-CONFIG Target Level.

 

Probably one could speed up the ready state by once reading back the electrode currents and charge times in registers 0x5f - 0x72 when the device is running correctly, and then write these values into those registers during initialization. That way the baseline values would more rapidly get to their target values.

 

(I lost a lot of time because of using the wrong i2c slave address! silly me, I should have just written a test routine to try all 128 possible values, instead I thought there was something wrong with my pcb assembly, since these small parts are tricky to solder even in a reflow oven -- if you put too much paste, it makes a short, if there is too little, some pads may not have contact ...)

0 Kudos
Reply

2,953 Views
RichTestardi
Senior Contributor II

Unfortunately, a forum search for mpr121 doesn't seem to find this thread, but a google search does...

 

I just thought I'd mention that for the problem of a 30 second delay on startup of the mpr121, the solution seems to be to write 0x8c to the electrode configuration register (0x5e), rather than 0x0c like in the Quick Start Guide...

 

From the Rev 3 Data Sheet:

 

Since the baseline tracking filtering system has a very large time constant and the initial baseline value starts from zero, it will require a very long time for the baseline to ramp up. This results in a short period of no response to touch after the MPR121 is first set to Run Mode. Setting the CL = 2b10 will command the MPR121 to load the initial baseline value at the beginning of the Run Mode. This shortens the initial baseline ramp-up time so that user will not notice any delay on touch detection. The MPR121 uses the five high bits of the first measured 10 bit electrode data.

 

 

-- Rich

0 Kudos
Reply

2,953 Views
rfslf
Contributor I

Please help me!
I use MPR031, and I can not start-up.

When I send 0x4A address, line is tied to ground and I cannot send command address.
When I send address from all range of possible, MPR031 does not respond.
MPR031 soldered well, contact is good. There is no answer from MPR031.

Please help me examples of an initial configuration of registers for MPR031.

 


Best regards,
Alex

0 Kudos
Reply

2,953 Views
joncas
Contributor II

Hello Alex,

 

I've only used the MPR121, but apparently the procedure is very similar.

 

I think there may be an error in the datasheet and the i2c address should be 0x4D -- shifted left for the read-write bit that makes 0x5a

 

Otherwise, maybe there is some error in your i2c communications code? Did you test it on some other i2c device.

 

I posted sample code for the mpr131 here:  www.flashgenie.net/TouchAD7147.html 

I believe the MPR031 is very similar. (It doesn't include the i2c communications code -- I used the Processor Expert bean.)

 

Good luck!

Robert

0 Kudos
Reply

2,953 Views
rfslf
Contributor I

Hello Robert,

 

thank you for help me. I will try, and then will tell about reason.

 

 Best regards,

Alex

0 Kudos
Reply