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

Post here all questions related to LibMaple core if you can't find a relevant section!
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 »

Donna has her own version of Roger's Core:
https://github.com/dewhisna/Arduino_STM32
This branch is 5 commits ahead, 102 commits behind rogerclarkmelbourne:master.
Then, Steve has his own copy of Roger's core:
https://github.com/stevstrong/Arduino_STM32/
This branch is 279 commits ahead, 10 commits behind rogerclarkmelbourne:master.
So, I took a look at Roger's current download from github and it does incorporate the I2C changes.

But, IMO, if you are beyond the 'hobby' stage of STM32 on ArduinoIDE, then the Official Corporate Core is a more sensible approach to computing with the STM32.
User avatar
Mangy_Dog
Posts: 92
Joined: Sat May 02, 2020 11:45 pm
Answers: 1

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

Post by Mangy_Dog »

Ill test the other cores out shortly... And yeah ive been questioning other setups even cubemx bases, but the trouble is I do use some libraries like the graphics chip that relies on these arduino based cores.
This has kept me locked in :D

But then theres the whole... Ive not used the none arduino environment soooo the whole setting up of that is a big step for me. So kinda been putting it off...

interestingly... I just replaced the chip with a fresh chip and still not working... So either something strange going on with i2c (i think unlikely as you guys had it work) or some how ive screwed up the design... Even though it doesnt look like it...
Just a dogs body developer, mostly making props and stuff...
User avatar
Mangy_Dog
Posts: 92
Joined: Sat May 02, 2020 11:45 pm
Answers: 1

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

Post by Mangy_Dog »

If youre interested take a look at the circuit...

Image
Image

and the pcb

Image
Image

One thing i noticed is that the ref design in the datasheet uses pullups on the i2c, but the dev modules dont.
My earlier design didnt use pullups either.
And since posting this im getting messages saying i2c needs pullups... Can anyone here confirm? And if so is there anyway to get the stm to use the internal pullup when in i2c hardware mode?
Just a dogs body developer, mostly making props and stuff...
fredbox
Posts: 125
Joined: Thu Dec 19, 2019 3:05 am
Answers: 2

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

Post by fredbox »

See https://github.com/stm32duino/wiki/wiki/API#i2C.
...
Redefine I2C pins

Because they are defined as WEAK, you can redefine them in your sketch file instead of changing values in the PeripheralPins.c file. You can also enable/disable the internal pull-ups with the second parameter of STM_PIN_DATA().

I would add about a 3.3k pullup to both pins, as the internal pullup is quite high resistance.
User avatar
Mangy_Dog
Posts: 92
Joined: Sat May 02, 2020 11:45 pm
Answers: 1

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

Post by Mangy_Dog »

fredbox wrote: Sun Oct 25, 2020 8:48 pm See https://github.com/stm32duino/wiki/wiki/API#i2C.
...
Redefine I2C pins

Because they are defined as WEAK, you can redefine them in your sketch file instead of changing values in the PeripheralPins.c file. You can also enable/disable the internal pull-ups with the second parameter of STM_PIN_DATA().

I would add about a 3.3k pullup to both pins, as the internal pullup is quite high resistance.
Thats stm's duino core not the libmaple... I dont know if that would work here...
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 7:06 pm ...
And since posting this im getting messages saying i2c needs pullups... Can anyone here confirm? And if so is there anyway to get the stm to use the internal pullup when in i2c hardware mode?

Yes, I2C needs pullups and the internal pullups are too weak.
Everyone has an opinion of the resistors value, but the link is to a TI document on the subject.

https://www.ti.com/lit/an/slva689/slva6 ... 3634417429


Ray

PS: Two 10K SMT or 1/8W can be soldered to the I2C distant-end... When distance is long, a lower value (like 4.7K or 3.3K) may work better, especially at highest I2C speed.
User avatar
Mangy_Dog
Posts: 92
Joined: Sat May 02, 2020 11:45 pm
Answers: 1

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

Post by Mangy_Dog »

Cries, thats gonna mean needing to do YET another pcb spin D:
If i cant use internal pullups
Just a dogs body developer, mostly making props and stuff...
User avatar
Mangy_Dog
Posts: 92
Joined: Sat May 02, 2020 11:45 pm
Answers: 1

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

Post by Mangy_Dog »

I just hacked on some 10k pullups on the i2c pins, on the mcu side of the circuit as i could solder to them.....

And still not working :/

And while my scope doesnt have logic analysing... Its not really picking up much of anything, there might be a single drop pulse but no data going across
Just a dogs body developer, mostly making props and stuff...
fredbox
Posts: 125
Joined: Thu Dec 19, 2019 3:05 am
Answers: 2

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

Post by fredbox »

If you run the I2C scanner program in a loop, you should see a good bit of activity on SCL and SDA with your scope.

Could the problem be the 10K resistor in series with the ADDR pin? The data sheet says to connect ADDR to VDD, VSS, SDA, or SDL but I didn't see any mention about a series resistor.

The data sheet also says "The MPR121 SDA line operates as both an input and an open-drain output. A pull-up resistor, typically 4.7 kΩ, is required on SDA. The MPR121 SCL line operates only as an input. A pull-up resistor, typically 4.7 kΩ, is required on SCL if there are
multiple masters on the 2-wire interface, or if the master in a single-master system has an open-drain SCL output."
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 10:31 pm I just hacked on some 10k pullups on the i2c pins, on the mcu side of the circuit as i could solder to them.....

And still not working :/
...
My understanding is the pull-up should be at the end-of-the-run (sensor, peripheral, etc.) when only one (1) device is used. The resistor load ensures a quick rise and quick fall of the signal. I think of them like the old terminators for SCSI devices. Anyway, with the 3.3V uC, the pull-ups should go to 3.3V on the MPR121.

Are you certain you have the address configured correctly as there are 4 options as I understand.
Adafruit states for their breakout:
Uses I2C 7-bit address 0x5A (can be set to 0x5B, 0x5C or 0x5D)
Post Reply

Return to “General discussion”