MPR121, all registers read zero

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

MPR121, all registers read zero

跳至解决方案
1,914 次查看
tõnusamuel
Contributor I

Hi! Spent long time and no result with seemingly simple issue. I am talking to MPR121 and trying to get at least something to work I2C communication works, chips acknowledges any requests to address 0x5A. But whatever registers I read, result is zero. All I2C stack I use is known to work for writing data. I include oscillogram, maybe someone can spot something just obviously wrong. I am trying to read register 0x5D because it must be non-zero by default. I tried also read all registers from 0 to 255 and nothing returns any bits.

    HalTouchSelect();

    while(1) { 

       uint8 pBuf2;

              bool r2= HalSensorReadReg(0x5D, &pBuf2,1);

       ST_HAL_DELAY(3000);

//      char buf[20];

//      sprintf(buf," %3d %d %3d ",pBuf2,r2,i++);

//      OLED_text(buf,0,0) ;

    }

20130912_522847.bmp

Same thing enlarged:

20130912_522924.bmp

20130912_522937.bmp

Chip is alive and sends acknowledges but never returns any data. Ideas?

EDIT: Have tried to insert delays, change communication speed, re-read everything. No help. Then I attached Arduino with some sample code to same bus and MPR121 register 0x5D instantly read 0000 0100. So hardware problems possibly ruled out.

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
1,259 次查看
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Tõnu,

You are not able to read from the MPR021 because you send the stop condition (a LOW to HIGH transition of SDA while SCL is HIGH) instead of sending the repeated start condition. You will have to modify your I2C read routine so that SDA transitiones to HIGH before the SCL goes HIGH (in order to eliminate the stop condition) that is indicated in the waveform.

untitled1.jpg

I hope it helps.

Regards,

Tomas

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,259 次查看
tõnusamuel
Contributor I

Thanks! I have been spending hours here and at first sight you seem to have correct answer. Simple things can be complicated to solve sometime.

0 项奖励
回复
1,259 次查看
TomasVaverka
NXP TechSupport
NXP TechSupport

You are very welcome, Tõnu and thanks for using our community.

Regards,

Tomas

0 项奖励
回复
1,260 次查看
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Tõnu,

You are not able to read from the MPR021 because you send the stop condition (a LOW to HIGH transition of SDA while SCL is HIGH) instead of sending the repeated start condition. You will have to modify your I2C read routine so that SDA transitiones to HIGH before the SCL goes HIGH (in order to eliminate the stop condition) that is indicated in the waveform.

untitled1.jpg

I hope it helps.

Regards,

Tomas

0 项奖励
回复