MPR121 slow response after configuration change

cancel
Showing results for 
Search instead for 
Did you mean: 

MPR121 slow response after configuration change

637 Views
yosigreenbeerg
Contributor I

Hi all,

We are using the MPR121 in two configurations, Regular (12 keys) and Low energy (2 keys).

To switch between configuration we use the MPR121_init(config)  function with argument 0 or 1 respectively.

After switching from 2 keys config into 12 keys, we have a delay of about 4 seconds before we can see response of the Interrupt signal on the scope.

This slow response is not acceptable in our system.

The configuration of the registers are taken from application note.

Are we doing something wrong?

Can we improve the configuration to a chive a faster response of MPR121 after config change?

Regards,

Yosi.

void MPR121_init(uint8_t config)

{

  //Reset MPR121 if not reset correctly

  MPR_ByteWrite(Slave_Addr,0x80,0x63); //Soft reset

  MPR_ByteWrite(Slave_Addr,0x5E,0x00); //Stop mode

  //touch pad baseline filter

  //rising

  MPR_ByteWrite(Slave_Addr,0x2B,0x01); //0xFF// MAX HALF DELTA Rising

  MPR_ByteWrite(Slave_Addr,0x2C,0x01); //0xFF// NOISE HALF DELTA Rising

  MPR_ByteWrite(Slave_Addr,0x2D,0x00); // //0 NOISE COUNT LIMIT Rising

  MPR_ByteWrite(Slave_Addr,0x2E,0x00); // DELAY LIMIT Rising

  //falling

  MPR_ByteWrite(Slave_Addr,0x2F,0x01); // MAX HALF DELTA Falling

  MPR_ByteWrite(Slave_Addr,0x30,0x01); // NOISE HALF DELTA Falling

  MPR_ByteWrite(Slave_Addr,0x31,0xFF); // NOISE COUNT LIMIT Falling

  MPR_ByteWrite(Slave_Addr,0x32,0x02); // //2//DELAY LIMIT Falling

  //touched

  MPR_ByteWrite(Slave_Addr,0x33,0x00); // Noise half delta touched

  MPR_ByteWrite(Slave_Addr,0x34,0x00); // Noise counts touched

  MPR_ByteWrite(Slave_Addr,0x35,0x00); //Filter delay touched

  //Touch pad threshold

  MPR_ByteWrite(Slave_Addr,0x41,TOUCH_THRESHOLD);   // ELE0 TOUCH THRESHOLD

  MPR_ByteWrite(Slave_Addr,0x42,RELEASE_THRESHOLD); // ELE0 RELEASE THRESHOLD

  MPR_ByteWrite(Slave_Addr,0x43,TOUCH_THRESHOLD);   // ELE1 TOUCH THRESHOLD

  MPR_ByteWrite(Slave_Addr,0x44,RELEASE_THRESHOLD); // ELE1 RELEASE THRESHOLD

  MPR_ByteWrite(Slave_Addr,0x45,TOUCH_THRESHOLD);   // ELE2 TOUCH THRESHOLD

  MPR_ByteWrite(Slave_Addr,0x46,RELEASE_THRESHOLD); // ELE2 RELEASE THRESHOLD

  MPR_ByteWrite(Slave_Addr,0x47,TOUCH_THRESHOLD);   // ELE3 TOUCH THRESHOLD

  MPR_ByteWrite(Slave_Addr,0x48,RELEASE_THRESHOLD); // ELE3 RELEASE THRESHOLD

  MPR_ByteWrite(Slave_Addr,0x49,TOUCH_THRESHOLD);   // ELE4 TOUCH THRESHOLD

  MPR_ByteWrite(Slave_Addr,0x4A,RELEASE_THRESHOLD); // ELE4 RELEASE THRESHOLD

  MPR_ByteWrite(Slave_Addr,0x4B,TOUCH_THRESHOLD);   // ELE5 TOUCH THRESHOLD

  MPR_ByteWrite(Slave_Addr,0x4C,RELEASE_THRESHOLD); // ELE5 RELEASE THRESHOLD

  MPR_ByteWrite(Slave_Addr,0x4D,TOUCH_THRESHOLD);   // ELE6 TOUCH THRESHOLD

  MPR_ByteWrite(Slave_Addr,0x4E,RELEASE_THRESHOLD); // ELE6 RELEASE THRESHOLD

  MPR_ByteWrite(Slave_Addr,0x4F,TOUCH_THRESHOLD);   // ELE7 TOUCH THRESHOLD

  MPR_ByteWrite(Slave_Addr,0x50,RELEASE_THRESHOLD); // ELE7 RELEASE THRESHOLD

  MPR_ByteWrite(Slave_Addr,0x51,TOUCH_THRESHOLD);   // ELE8 TOUCH THRESHOLD

  MPR_ByteWrite(Slave_Addr,0x52,RELEASE_THRESHOLD); // ELE8 RELEASE THRESHOLD

  MPR_ByteWrite(Slave_Addr,0x53,TOUCH_THRESHOLD);   // ELE9 TOUCH THRESHOLD

  MPR_ByteWrite(Slave_Addr,0x54,RELEASE_THRESHOLD); // ELE9 RELEASE THRESHOLD

  MPR_ByteWrite(Slave_Addr,0x55,TOUCH_THRESHOLD);   // ELE10 TOUCH THRESHOLD

  MPR_ByteWrite(Slave_Addr,0x56,RELEASE_THRESHOLD); // ELE10 RELEASE THRESHOLD

  MPR_ByteWrite(Slave_Addr,0x57,TOUCH_THRESHOLD);   // ELE11 TOUCH THRESHOLD

  MPR_ByteWrite(Slave_Addr,0x58,RELEASE_THRESHOLD); // ELE11 RELEASE THRESHOLD

  //AFE configuration

  MPR_ByteWrite(Slave_Addr,0x5D,0x00); //0x00 (SFI = 4, ESI = 1 ms, so the response time is 4 ms)

  MPR_ByteWrite(Slave_Addr,0x5C,0xC0); //0xC0 (take 34 samples, which is good for interference immunity)

  //Auto configuration

  MPR_ByteWrite(Slave_Addr,0x7B,0xCB);

  MPR_ByteWrite(Slave_Addr,0x7D,0xE4);

  MPR_ByteWrite(Slave_Addr,0x7E,0x94);

  MPR_ByteWrite(Slave_Addr,0x7F,0xCD);

  if( config == 0 ){

    MPR_ByteWrite(Slave_Addr,0x5E,0x0C); //Start mode; (0x5E) = 0x0C (for 12 electrodes)

  }else{

    MPR_ByteWrite(Slave_Addr,0x5E,0x02); // low energy mode; (0x5E) = 0x02 (for 2 electrodes)

  }

0 Kudos
3 Replies

168 Views
david_diaz
NXP Employee
NXP Employee

Hello Yosi,

You might refer to the code bellow, this code is used to tracking big baseline change when just after power on.

#define TouchThre 10 //15//30//10

#define ReleaThre 6 //8//25//8

void MPR121_init(void)

{

  //Reset MPR121 if not reset correctly

IIC_ByteWrite(0x80,0x63);  //Soft reset

IIC_ByteWrite(0x5E,0x00);  //Stop mode 

  //touch pad baseline filter

  //rising                                   

IIC_ByteWrite(0x2B,0x01); // MAX HALF DELTA Rising

IIC_ByteWrite(0x2C,0x01); // NOISE HALF DELTA Rising

IIC_ByteWrite(0x2D,0x0E); // NOISE COUNT LIMIT Rising

IIC_ByteWrite(0x2E,0x00); // DELAY LIMIT Rising

  //falling

IIC_ByteWrite(0x2F,0x01); // MAX HALF DELTA Falling

IIC_ByteWrite(0x30,0x05); // NOISE HALF DELTA Falling

IIC_ByteWrite(0x31,0x01); // NOISE COUNT LIMIT Falling

IIC_ByteWrite(0x32,0x00); // DELAY LIMIT Falling

  //touched

IIC_ByteWrite(0x33,0x00); // Noise half delta touched

IIC_ByteWrite(0x34,0x00); // Noise counts touched

IIC_ByteWrite(0x35,0x00); // Filter delay touched

  

 

  //Touch pad threshold

IIC_ByteWrite(0x41,TouchThre); // ELE0 TOUCH THRESHOLD

IIC_ByteWrite(0x42,ReleaThre); // ELE0 RELEASE THRESHOLD

IIC_ByteWrite(0x43,TouchThre); // ELE1 TOUCH THRESHOLD

IIC_ByteWrite(0x44,ReleaThre); // ELE1 RELEASE THRESHOLD

IIC_ByteWrite(0x45,TouchThre); // ELE2 TOUCH THRESHOLD

IIC_ByteWrite(0x46,ReleaThre); // ELE2 RELEASE THRESHOLD

IIC_ByteWrite(0x47,TouchThre); // ELE3 TOUCH THRESHOLD

IIC_ByteWrite(0x48,ReleaThre); // ELE3 RELEASE THRESHOLD

IIC_ByteWrite(0x49,TouchThre); // ELE4 TOUCH THRESHOLD

IIC_ByteWrite(0x4A,ReleaThre); // ELE4 RELEASE THRESHOLD

IIC_ByteWrite(0x4B,TouchThre); // ELE5 TOUCH THRESHOLD

IIC_ByteWrite(0x4C,ReleaThre); // ELE5 RELEASE THRESHOLD

IIC_ByteWrite(0x4D,TouchThre); // ELE6 TOUCH THRESHOLD

IIC_ByteWrite(0x4E,ReleaThre); // ELE6 RELEASE THRESHOLD

IIC_ByteWrite(0x4F,TouchThre); // ELE7 TOUCH THRESHOLD

IIC_ByteWrite(0x50,ReleaThre); // ELE7 RELEASE THRESHOLD

IIC_ByteWrite(0x51,TouchThre); // ELE8 TOUCH THRESHOLD

IIC_ByteWrite(0x52,ReleaThre); // ELE8 RELEASE THRESHOLD

IIC_ByteWrite(0x53,TouchThre); // ELE9 TOUCH THRESHOLD

IIC_ByteWrite(0x54,ReleaThre); // ELE9 RELEASE THRESHOLD

IIC_ByteWrite(0x55,TouchThre); // ELE10 TOUCH THRESHOLD

IIC_ByteWrite(0x56,ReleaThre); // ELE10 RELEASE THRESHOLD

IIC_ByteWrite(0x57,TouchThre); // ELE11 TOUCH THRESHOLD

IIC_ByteWrite(0x58,ReleaThre); // ELE11 RELEASE THRESHOLD

  //touch /release debounce

IIC_ByteWrite(0x5B,0x00);

  // response time = SFI(10) X ESI(8ms) = 80ms

IIC_ByteWrite(0x5D,0x13);   

  //FFI=18

IIC_ByteWrite(0x5C,0x80); 

  //Auto configuration

IIC_ByteWrite(0x7B,0x8F);

  // charge to 70% of Vdd , high sensitivity

IIC_ByteWrite(0x7D,0xE4);

IIC_ByteWrite(0x7E,0x94);

IIC_ByteWrite(0x7F,0xCD);

  // 12 electrodes enabled   

IIC_ByteWrite(0x5E,0xCC); 

}

I hope this information will be useful for you.

If I misunderstood your question, feel free to let me know.  I will be glad to help.

Have a great day.

David Diaz.

0 Kudos

168 Views
yosigreenbeerg
Contributor I

Hello David,

Thank you for the fast response to my question.

Your information was very helpful. For the after "wake up" with the NORMAL configuration (12 keys) I have a much faster response now with the new registers value (taken from your code).

Yet, I have a new phenomena now, sometimes after several key presses I loos the sensing of one of the keys. After pressing other keys it may return to response.

Does it make any sense to you?

Have a great day.

Yosi Greenberg.

0 Kudos

168 Views
david_diaz
NXP Employee
NXP Employee

Hello Yosi,

I am glad to help.

Definitely, I had never heard anything like this before. I assume the phenomena mentioned is because of the noise.

In this case, the baseline value is compared with the current immediate electrode data to determine if a touch or release has occurred. A designer has the ability to set the touch/release thresholds, as well as a touch/release debounce time. This is to eliminate jitter and false touches due to noise.

Additional information on baseline capacitance system is covered in application notes AN3891 and AN3892 .

I hope this information will be useful for you.

If I misunderstood your question, feel free to let me know.  I will be glad to help.

Have a great day.

David Diaz.

0 Kudos