MPR121 very slow startup

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

MPR121 very slow startup

1,755 次查看
yo3hcv
Contributor I

After initialization process, the MPR121 is operational only after 1 minute or so. Reading touch registers will output zero and no interrupts are generated.

Our initialization procedure is as follows (pseudo):

1) set filters, from MHD Rising -> FDL Touched

Btw, the NHD Amount Touched, NCL Touched and FDL Touched we send = 0 since are completely undoccumented in your pdfs.

2) set thresholds as desired for all 12 elements

3) optionally set the AUTO-CONFIG registers (no difference, slow startup in either case)

4) set CDC, CDT and ECR

The following questions appears:

- why is this happening?

- how can we detect initialization is complete, we have a keypad designed which is not operational in first minute

Best regards,

标签 (1)
0 项奖励
回复
3 回复数

1,078 次查看
yo3hcv
Contributor I

Reading this thread solved the problem :smileyhappy:  CL bits were 00 and now we made them 11.

The starting time now reduced to 1 Sec or so, insignificant.

MPR121 Touch detection start-up time

The question remains: How does affect the performances?

11 means - Baseline tracking enabled, initial baseline value is loaded with all 10 bits of the first electrode data value.

Best regards,

0 项奖励
回复

1,078 次查看
johnsonsun
NXP Employee
NXP Employee

A few points need to check in your init procedure:

1)the filters has setting for rising, falling, touch, you should set rising, falling, while touched is optional, refer to AN3891 and attached.

2)recommend to use auto configure, otherwise you need to do trial test to set every electrode CDC/CDT manually.

3)use b01 for CL bits.

Below is the sample code for your reference

MPR121 initialization and configuration.

#define TouchThre 10 // Touch threshold

#define ReleaThre 8 // Release threshold

#define Prox_TouchThre 6 // Proximity threshold

#define Prox_ReleaThre 4 // Proximity release threshold

void MPR121_init_to_run(void)

{

IIC_ByteWrite(0x80,0x63); // Soft reset MPR121 if not reset correctly

IIC_ByteWrite(0x73,0xFF); // LED Configuration, if not used, this part can be omitted

IIC_ByteWrite(0x74,0xFF);

IIC_ByteWrite(0x76,0xFF);

IIC_ByteWrite(0x77,0xFF);

IIC_ByteWrite(0x75,0xFF);

IIC_ByteWrite(0x81,0x00);

IIC_ByteWrite(0x82,0x00);

IIC_ByteWrite(0x83,0x00);

IIC_ByteWrite(0x84,0x00);

//touch pad baseline filter

//rising: baseline quick rising

IIC_ByteWrite(0x2B,0x01); // Max half delta Rising

IIC_ByteWrite(0x2C,0x01); // Noise half delta Rising

IIC_ByteWrite(0x2D,0x00); // Noise count limit Rising

IIC_ByteWrite(0x2E,0x00); // Delay limit Rising

//falling:

baseline slow falling

IIC_ByteWrite(0x2F,0x01); // Max half delta Falling

IIC_ByteWrite(0x30,0x01); // Noise half delta Falling

IIC_ByteWrite(0x31,0xFF); // Noise count limit Falling

IIC_ByteWrite(0x32,0x0); // Delay limit Falling

//touched: baseline keep

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

IIC_ByteWrite(0x34,0x00); // Noise count Touched

IIC_ByteWrite(0x35,0x00); // Delay limit Touched

//Proximity baseline filter

//rising: very quick rising

IIC_ByteWrite(0x36,0x0f); // Max half delta Rising

IIC_ByteWrite(0x37,0x0f); // Noise half delta Rising

IIC_ByteWrite(0x38,0x00); // Noise count Rising

IIC_ByteWrite(0x39,0x00); // Delay limit Rising

//falling: very slow rising

IIC_ByteWrite(0x3A,0x01); // Max half delta Falling

IIC_ByteWrite(0x3B,0x01); // Noise half delta Falling

IIC_ByteWrite(0x3C,0xff); // Noise count Falling

IIC_ByteWrite(0x3D,0xff); // Delay limit Falling

//touched

IIC_ByteWrite(0x3E,0x00);

IIC_ByteWrite(0x3F,0x00);

IIC_ByteWrite(0x40,0x00);

//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

//Proximity threshold

IIC_ByteWrite(0x59,Prox_TouchThre); // ELE12 TOUCH THRESHOLD

IIC_ByteWrite(0x5A,Prox_ReleaThre); // ELE12 RELEASE THRESHOLD

//touch and release interrupt debounce

IIC_ByteWrite(0x5B,0x00); // Not used for polling method, effective for INT mode.

//AFE and filter configuration

IIC_ByteWrite(0x5C,0x10); // AFES=6 samples, same as AFES in 0x7B, Global CDC=16uA

IIC_ByteWrite(0x5D,0x24); // CT=0.5us, TDS=4samples, TDI=16ms

IIC_ByteWrite(0x5E,0x80); // Set baseline calibration enabled, baseline loading 5MSB

//Auto Configuration

IIC_ByteWrite(0x7B,0x0B); // AFES=6 samples, same as AFES in 0x5C

// retry=2b00, no retry,

// BVA=2b10, load 5MSB after AC,

// ARE/ACE=2b11, auto configuration enabled

//IIC_ByteWrite(0x7C,0x80); // Skip charge time search, use setting in 0x5D,

// OOR, AR, AC IE disabled

// Not used. Possible Proximity CDC shall over 63uA

// if only use 0.5uS CDT, the TGL for proximity cannot meet

// Possible if manually set Register0x72=0x03

// (Auto configure result) alone.

IIC_ByteWrite(0x7D,0xc8); // AC up limit /C8/BD/C0/9C

IIC_ByteWrite(0x7E,0x82); // AC low limit /82/7A/7C/65

IIC_ByteWrite(0x7F,0xb4); // AC target /B4/AA/AC/8C target for /3.0V/2.8V/1.8V

IIC_ByteWrite(0x5E,0xBC); // Run 12 touch + proximity, CL=2b10, load 5MSB to baseline

}

For the detailed explanation on each registers please refer to the datasheet and relevant

application note. All the registers can be read at anytime, but it’s suggested to use multiple

consecutive byte read to save the operation time and avoid data integrity issue. For example,

we can use one line code to read out registers from 0x00 to 0x2A to get all the sensing channels

output data and status information. All the registers except 0x5E and LED configuration registers

cannot be written in run mode but only when set into stop mode.

After initialization and set into run mode, the MPR121 will work automatically and

continuously until you set it into stop mode. MPR121 provides both touch status and touch

sensing data and provides interrupt output when touch/release status changed. The host

processor can read back output data and status upon interrupt, or poll the MPR121 periodically

on timer overflow.

0 项奖励
回复

1,078 次查看
johnsonsun
NXP Employee
NXP Employee

Sorry for typo, correct the CL bits, shall be b10. if the baseline is too close to actual data, touch may not be detected if actual data is over than the baseline setting. 

0 项奖励
回复