i2c MPR121, Need help trouble shooting whats wrong...

Post here all questions related to LibMaple core if you can't find a relevant section!
User avatar
Mangy_Dog
Posts: 90
Joined: Sat May 02, 2020 11:45 pm
Answers: 1

i2c MPR121, Need help trouble shooting whats wrong...

Post by Mangy_Dog »

So on my project i have a MPR121 cap touch sensor for buttons, ive quadripple checked the circuit design and it matches the reference design for the MPR121.
I have SCL on PB6 and SDA on PB7. The address is pulled up on the chip so it should be 0x5B.

I have tried using the i2c scanner examples both with wire and softwire.

In softwire if i have the correct pins set the program hangs at the wire.begin process...
if i select or swap the pins, it starts but cant find any devices.

I have three boards and each of them have the exact same problem. Looking under my jewelry eye glass the solder joins are connected to the pins of the chip.

If i use Wire, i would either get no device found or the program will pause for a long time in the begin process...

I cant fully rule out interference but the traces are roughly 15mm from the mcu to the chip.

Am i setting up wire wrong? Can i slow i2c down in case its interference.

What can i do to keep trouble shooting and fixing it?

Any help please this is the last big hardware debug i need to fix in my project.
Last edited by Mangy_Dog on Sat Oct 24, 2020 10:19 pm, edited 1 time in total.
Just a dogs body developer, mostly making props and stuff...
stevestrong
Posts: 502
Joined: Fri Dec 27, 2019 4:53 pm
Answers: 8
Location: Munich, Germany
Contact:

Re: i2c MPR121, Need help trouble shooting whats wrong...

Post by stevestrong »

There seems to be a problem with I2C scanner, see here: https://github.com/rogerclarkmelbourne/ ... issues/799
But the normal I2C finctions should work, it is only the scanner affected.
Have you tried to communicate with the IC?
Can you record and post here some scope plots?
User avatar
Mangy_Dog
Posts: 90
Joined: Sat May 02, 2020 11:45 pm
Answers: 1

Re: i2c MPR121, Need help trouble shooting whats wrong...

Post by Mangy_Dog »

Sadly normal functions dont appear to be working as when i try to run my project the project hangs for up to 30 seconds during the wire begin stage... it ether hangs for good or or might start the rest of the program.

I have limited debug capability, Without writing a passthrough sketch I cant try to connect directly... However i cant see how it would work if it hangs at begin anyway...

I dont have a logic scope just a hantek oscilloscope

Ill read that thread to see if theres any more i can do. But any further help would be appreciated.
Just a dogs body developer, mostly making props and stuff...
mrburnette
Posts: 633
Joined: Thu Dec 19, 2019 1:23 am
Answers: 7

Re: i2c MPR121, Need help trouble shooting whats wrong...

Post by mrburnette »

Mangy_Dog wrote: Sat Oct 24, 2020 11:58 pm Sadly normal functions dont appear to be working as when i try to run my project the project hangs for up to 30 seconds during the wire begin stage... it ether hangs for good or or might start the rest of the program.
...
... Adafruit
The MPR121 has support for only I2C, which can be implemented with nearly any microcontroller. You can select one of 4 addresses with the ADDR pin, for a total of 48 capacitive touch pads on one I2C 2-wire bus. Using this chip is a lot easier than doing the capacitive sensing with analog inputs: it handles all the filtering for you and can be configured for more/less sensitivity.

This sensor comes as a tiny hard-to-solder chip so we put it onto a breakout board for you. Since it's a 3V-only chip, we added a 3V regulator and I2C level shifting so its safe to use with any 3V or 5V microcontroller/processor like Arduino. We even added an LED onto the IRQ line so it will blink when touches are detected, making debugging by sight a bit easier on you. Comes with a fully assembled board, and a stick of 0.1" header so you can plug it into a breadboard. For contacts, we suggest using copper foil or pyralux, then solder a wire that connects from the foil pad to the breakout.

Getting started is a breeze with our Arduino library and tutorial. You'll be up and running in a few minutes, and if you are using another microcontroller, its easy to port our code.
There are 4 possible addresses... not 2. Bypass the 3.3V regulator and use same 3.3V as STM32F103 and double-check grounding (only if providing uC with 3.3V directly.)

Try Adafruit's test sketch.

Opinion:
When porting an Arduino project to STM, gather your peripheral libraries and example code; test every driver with a test-sketch. Resolve all issues with libraries and peripherals before aggerating into a larger sketch. IF you must port or edit a library .h/.cpp/.c/.a absolutely rename the edited files (STM32Fxxx + original lib name) OR incorporate the edited lib files into ArduinoIDE tabs: separate tab for .h and for .cpp. The source here shows encapsulated library files: https://www.hackster.io/rayburne/joysti ... dio-452602
User avatar
Mangy_Dog
Posts: 90
Joined: Sat May 02, 2020 11:45 pm
Answers: 1

Re: i2c MPR121, Need help trouble shooting whats wrong...

Post by Mangy_Dog »

Indeed ive been using small sketches to target the specific hardware im getting to run... Then incorporating the fixes into the larger sketch...

Ive check the grounding and its all connected...

This is the board, and yes ive already had to do 2 hotwires on the mcu because of the PWM pin mistake i mentioned in the previous posts... As im only currently doing 3 boards i really didnt want to have to do yet another PCB respin. (tehres been about 5 or so all ready correcting mostly stupid mistakes... )
The f103 you can see the mpr121 is the small chip at the bottom right of the board.

I dunno because i resoldered this chip a few times from transferring off the other boards maybe I cooked it :/
Image
Just a dogs body developer, mostly making props and stuff...
mrburnette
Posts: 633
Joined: Thu Dec 19, 2019 1:23 am
Answers: 7

Re: i2c MPR121, Need help trouble shooting whats wrong...

Post by mrburnette »

Mangy_Dog wrote: Sun Oct 25, 2020 11:35 am ...
I dunno because i resoldered this chip a few times from transferring off the other boards maybe I cooked it :/
Clearly you are working at a high-level of prototype assembly (nice board BTW.) I hope my comments regarding lib testing did not offend; too often I go off-track with a generalized teaching moment that is for less sophisticated readers. At most times, there are many more non-members reading than members.
Sadly normal functions dont appear to be working as when i try to run my project the project hangs for up to 30 seconds during the wire begin stage... it ether hangs for good or or might start the rest of the program.

I have limited debug capability, Without writing a passthrough sketch I cant try to connect directly... However i cant see how it would work if it hangs at begin anyway...
The "hang" is likely the I2C timing out (or not returning from init of an incorrect address.)

My experience with I2C and libmaple (Roger's core) have been entirely positive:
https://www.hackster.io/rayburne/oled-t ... -10-b81b28
https://www.hackster.io/rayburne/maple- ... ate-74468b

But my use above is not at the same level of sophistication/complexity as your project. I doubt the chip has been "cooked" but static damage may be an issue. Not having a Saleae or bus-pirate is a serious disadvantage working through protocol issues.

I will say that back many years ago on Arduino.cc, I helped an Op track down a weird issue with a workbench rambling project to be the florescent lighting and open circuit wiring: said wiring acting like an antenna and the induced voltage was swamping the Arduino. Seems the light fixtures had been salvaged from a business: the short-term fix was incandescent lighting (these days LED.)

Clearly I have no helpful suggestions, so I'm going to go quiet and maybe some of our members will have an insight to assist you.


Ray
User avatar
Mangy_Dog
Posts: 90
Joined: Sat May 02, 2020 11:45 pm
Answers: 1

Re: i2c MPR121, Need help trouble shooting whats wrong...

Post by Mangy_Dog »

mrburnette wrote: Sun Oct 25, 2020 1:14 pm Clearly you are working at a high-level of prototype assembly (nice board BTW.) I hope my comments regarding lib testing did not offend; too often I go off-track with a generalized teaching moment that is for less sophisticated readers. At most times, there are many more non-members reading than members.
The "hang" is likely the I2C timing out (or not returning from init of an incorrect address.)

My experience with I2C and libmaple (Roger's core) have been entirely positive:
https://www.hackster.io/rayburne/oled-t ... -10-b81b28
https://www.hackster.io/rayburne/maple- ... ate-74468b

But my use above is not at the same level of sophistication/complexity as your project. I doubt the chip has been "cooked" but static damage may be an issue. Not having a Saleae or bus-pirate is a serious disadvantage working through protocol issues.

I will say that back many years ago on Arduino.cc, I helped an Op track down a weird issue with a workbench rambling project to be the florescent lighting and open circuit wiring: said wiring acting like an antenna and the induced voltage was swamping the Arduino. Seems the light fixtures had been salvaged from a business: the short-term fix was incandescent lighting (these days LED.)

Clearly I have no helpful suggestions, so I'm going to go quiet and maybe some of our members will have an insight to assist you.
Ray
No its ok thank you, and no offence taken, i know I can be a pain sometimes, I try not to expect things to just work, but sometimes it really is tiring when hardware isnt working, and i cant find the fault and wireup appears correct. Also its not entirely a prototype at this stage, But theres only 3 and I wanted to get one of these to some one by christmas, which is why ive wanted to avoid another PCB spin, thats looking a lot less likely now.

I also didnt want to do another PCB spin as these boards take several hours to a couple of days to populate and solder. Too many 0402s all done by hand, my oven and a reflow gun.

And also the library testing comment was fine, I had been doing that for getting the other components working... Like the display driver chip. As that was a mixture of bad solder joins and bad config commands for the init code which took far too long to get working and find the faults.

What about trying to slow down i2c? Where can i find the command to slow it in case its either inductance or interference? Its such a tight board, maybe something is shafting it...
Just a dogs body developer, mostly making props and stuff...
mrburnette
Posts: 633
Joined: Thu Dec 19, 2019 1:23 am
Answers: 7

Re: i2c MPR121, Need help trouble shooting whats wrong...

Post by mrburnette »

This link announces significant change in Roger's I2C implementation:
http://stm32duinoforum.com/forum/viewto ... _2408.html

Other I2C-centric posts in Roger's old (crashed) forum can be found using Google's site search:
https://www.google.com/search?&q=I2C+si ... oforum.com
stevestrong
Posts: 502
Joined: Fri Dec 27, 2019 4:53 pm
Answers: 8
Location: Munich, Germany
Contact:

Re: i2c MPR121, Need help trouble shooting whats wrong...

Post by stevestrong »

A redesign has been implemented a while ago, developped by Donna.
But it was tested and it worked.
In your place I would try to drive an I2C slave module with bluepill to see whether the core works for you at all.
User avatar
Mangy_Dog
Posts: 90
Joined: Sat May 02, 2020 11:45 pm
Answers: 1

Re: i2c MPR121, Need help trouble shooting whats wrong...

Post by Mangy_Dog »

I kinda thought about doing that... But I dont think i have any bluepills or modules on hand D: Ill have to order some off ali.
Just a dogs body developer, mostly making props and stuff...
Post Reply

Return to “General discussion”