0

MPR121 Touch Sensor Breakout Demo Error
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

MPR121 Touch Sensor Breakout Demo Error

by yishi on Tue Feb 10, 2015 8:11 pm

Hi,

I'm trying to use this sensor with Arduino Due but got stuck at the first step.

I got an error when compiling:

MPR121test.ino: In function 'void loop()':
MPR121test.ino:52:29: error: '_BV' was not declared in this scope
MPR121test.ino:56:30: error: '_BV' was not declared in this scope
Error compiling.

Please help!

yishi
 
Posts: 16
Joined: Fri Jan 31, 2014 12:10 am

Re: MPR121 Touch Sensor Breakout Demo Error

by adafruit_support_mike on Wed Feb 11, 2015 3:09 am

That looks like a platform error.

The Due uses a different microcontroller than the rest of the Arduino family, so it takes some massaging to get code written for the Uno to compile for a Due.

IIRC, that error has something to do with the Wire library, which handles I2C. Let me check with our Due expert to see if he knows more about that library.

adafruit_support_mike
 
Posts: 51350
Joined: Thu Feb 11, 2010 2:51 pm

Re: MPR121 Touch Sensor Breakout Demo Error

by adafruit_support_rick on Wed Feb 11, 2015 10:08 am

_BV is a macro in the AVR library. It doesn't exist in the ARM library, so you have to provide it. Add the following to your sketch, right after the #includes:
Code: Select all | TOGGLE FULL SIZE
#ifndef _BV
  #define _BV(bit) (1<<(bit))
#endif

adafruit_support_rick
 
Posts: 35070
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: MPR121 Touch Sensor Breakout Demo Error

by yishi on Wed Feb 11, 2015 5:42 pm

Thanks guys!

Now I'm able to run the sketch.

However, the Serial shows another error:

Adafruit MPR121 Capacitive Touch sensor test
MPR121 not found, check wiring?

I think my wiring is correct.

SCL to 21(SCL) on Due
SDA to 20(SDA) on Due
Vin to 5V on Due
GND to GND on Due

yishi
 
Posts: 16
Joined: Fri Jan 31, 2014 12:10 am

Re: MPR121 Touch Sensor Breakout Demo Error

by yishi on Wed Feb 11, 2015 6:30 pm

I need to use this chip with Arduino Due.

But I just tried it with Leonardo got some other issues.

The program seems to be stuck at !cap.begin(0x5A)

The Serial only says "Adafruit MPR121 Capacitive Touch sensor test" and not even "MPR121 not found, check wiring?"

I have no idea what's going on...

yishi
 
Posts: 16
Joined: Fri Jan 31, 2014 12:10 am

Re: MPR121 Touch Sensor Breakout Demo Error

by yishi on Wed Feb 11, 2015 7:21 pm

Now the chip works with Leonardo finally. I think it was caused by bad soldering.

But it still doens't work with Due, it keeping saying can't find the chip.

yishi
 
Posts: 16
Joined: Fri Jan 31, 2014 12:10 am

Re: MPR121 Touch Sensor Breakout Demo Error

by adafruit_support_rick on Wed Feb 11, 2015 8:05 pm

I don't know what to tell you. There's nothing about the Due that would make it not work. If it works with a Leonardo, it should work with a Due.

adafruit_support_rick
 
Posts: 35070
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: MPR121 Touch Sensor Breakout Demo Error

by yishi on Wed Feb 11, 2015 10:35 pm

Hi Rick,

I tried with two different Due and it still can't find MPR121.

Is there any issues with Due's I2C communication you know of?

I found this post http://forum.arduino.cc/index.php?topic=146802.0 saying there are something wrong with Due's I2C. But understanding the post is beyond me. Some of them saying replace Wire.cpp would fix the I2C bug, but I tried and only got compile errors.

yishi
 
Posts: 16
Joined: Fri Jan 31, 2014 12:10 am

Re: MPR121 Touch Sensor Breakout Demo Error

by adafruit_support_rick on Thu Feb 12, 2015 8:06 am

Try this version of the library. Delete the old version.
Connect your MPR to SDA1 and SCL1 (in the upper left, near digital 13)
Attachments
Adafruit_MPR121.zip
(38.7 KiB) Downloaded 144 times

adafruit_support_rick
 
Posts: 35070
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: MPR121 Touch Sensor Breakout Demo Error

by erikbrandl on Mon Jun 20, 2016 2:36 pm

Hi Rick,
Is there any news about the Problem?
I have the same Problem as yishi and your library didn`t solve it...

I have the shield as well as the breakout Mpr121, I tried on an uno and both worked. Just the due makes problems.
It gives me :

Adafruit MPR121 Capacitive Touch sensor test
MPR121 not found, check wiring?

Any suggestions?
Thanks alot!
erik

erikbrandl
 
Posts: 1
Joined: Mon Jun 20, 2016 2:31 pm

Re: MPR121 Touch Sensor Breakout Demo Error

by adafruit_support_rick on Tue Jun 21, 2016 10:50 am

Have you updated to the latest board support package for the Due?
You're using SCL1 and SDA1 for the I2C connection?

adafruit_support_rick
 
Posts: 35070
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: MPR121 Touch Sensor Breakout Demo Error

by baynesstua on Wed May 02, 2018 10:51 pm

adafruit_support_rick wrote:Try this version of the library. Delete the old version.
Connect your MPR to SDA1 and SCL1 (in the upper left, near digital 13)


Hi, I have the exact same issue and have used this solution, but is still not fixed. Is there any update to this problem? Any solution would be much appreciated!. Thanks

baynesstua
 
Posts: 3
Joined: Thu Mar 22, 2018 7:01 pm

Re: MPR121 Touch Sensor Breakout Demo Error

by adafruit_support_rick on Mon May 07, 2018 11:47 am

Did you download and install the zipped version of the library, posted above?

As far as I know, the MPR121 works with the Due

I don't have one to test with here. I can get one and try it out.

adafruit_support_rick
 
Posts: 35070
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Please be positive and constructive with your questions and comments.