MPR121, all registers read zero

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

MPR121, all registers read zero

Jump to solution
1,912 Views
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.

Labels (1)
Tags (1)
0 Kudos
Reply
1 Solution
1,257 Views
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

View solution in original post

0 Kudos
Reply
3 Replies
1,257 Views
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 Kudos
Reply
1,257 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

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

Regards,

Tomas

0 Kudos
Reply
1,258 Views
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 Kudos
Reply