FreeIMU Software I2C Pull-Ups

Asked by avenue33

Hi,

On FreeIMU.cpp, I2C pull-ups are hard-coded removed in lines

// 71 cbi(PORTC, 4);
// 72 cbi(PORTC, 5);

Original code didn't work on my Arduino, so I removed both: now it works.

I don't know the consequence of deactivating internal pull-ups for twi.

I think a warning worth mentioning!

Question information

Language:
English Edit question
Status:
Solved
For:
FreeIMU Edit question
Assignee:
No assignee Edit question
Solved by:
avenue33
Solved:
Last query:
Last reply:

This question was originally filed as bug #751879.

Revision history for this message
Fabio Varesano (fabio-varesano) said :
#1

Hi there, thanks for your contribution.

Actually, that code is a security measure. By disabling the internal pullups you are sure that if your sensors are running at 3.3V you don't pullup to 5V.

But, in order to work this code needs external pullups to be added to the SCL and SDA line. FreeIMU v0.2 and 0,3 already have the pullups integrated so they will work out of the box.
If you share a picture of your circuit I'll gladly review it.

Btw, did you built your own FreeIMU?

Revision history for this message
avenue33 (vilo-rei) said :
#2

Hi Fabio,

Thank you for the explanation.

I bought a standard prototype board and soldered a I2C logic level converter + 3.3V regulator + required capacitors + a general 4-way switch to isolate the whole circuit (5V, Ground, A5/SCL, A4/SDA).

I'm using the Sparkfun breakout boards which include the pull-ups. I'm running at the low I2C speed.

Best regards,

Revision history for this message
avenue33 (vilo-rei) said :
#3

Please convert it into a question.

Revision history for this message
Fabio Varesano (fabio-varesano) said :
#4

Converting into a question.

Revision history for this message
Fabio Varesano (fabio-varesano) said :
#5

The pictures of the circuit from the bug report are at:
https://launchpadlibrarian.net/68360222/I2C%20Protoshield%202.jpg
https://launchpadlibrarian.net/68360963/I2C%20Protoshield%201.jpg

What I2C level converter are you using? You may need to add pullups also on the high level side of the LLC. This is true for example in the PCA9306 which I'm using in FreeIMU v0.2 and v0.3. An example of this is here:
http://www.varesano.net/files/FreeIMU_v0.3_schematics.pdf (sheet 4/6)

Revision history for this message
avenue33 (vilo-rei) said :
#6

Bonjour Fabio,

Yes, I'm using a PCA9306.

• High level side pull-ups are internal

> Wire library
>
> Wire library will enable ATMEL internal Pullups. So using additional pullup's with a short bus may not be required, for example interface only a single nearby EEPROM

 http://www.arduino.cc/playground/Learning/I2C

• Low level side pull-ups 4,7 kΩ are on the IMU Digital Combo Board - 6 Degrees of Freedom ITG3200/ADXL345, on this specific example.

 http://www.sparkfun.com/datasheets/Sensors/IMU/6DOF-Digital-v10.pdf

I'm using the Triple Axis Magnetometer Breakout - HMC5843 on the same bus.

• For other I2C device, I add the pull-ups on a case-by-vase basis: most of the break-out boards do include those pull-ups, so there no need to make them redundant.

 Color Light Sensor Evaluation Board (3,3V): pull-ups included
 Real Time Clock Module (5V): pull-ups not included, external pull-ups added

Do you think that's ok?

How is going your thesis?

Best regards,

--- rei_vilo / Olivier
http://sites.google.com/site/vilorei/
<email address hidden>

Le 6 avr. 2011 à 08:54, Fabio Varesano a écrit :

> Your question #151827 on FreeIMU changed:
> https://answers.launchpad.net/freeimu/+question/151827
>
> Status: Open => Answered
>
> Fabio Varesano proposed the following answer:
> The pictures of the circuit from the bug report are at:
> https://launchpadlibrarian.net/68360222/I2C%20Protoshield%202.jpg
> https://launchpadlibrarian.net/68360963/I2C%20Protoshield%201.jpg
>
> What I2C level converter are you using? You may need to add pullups also on the high level side of the LLC. This is true for example in the PCA9306 which I'm using in FreeIMU v0.2 and v0.3. An example of this is here:
> http://www.varesano.net/files/FreeIMU_v0.3_schematics.pdf (sheet 4/6)
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.launchpad.net/freeimu/+question/151827/+confirm?answer_id=4
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/freeimu/+question/151827
>
> You received this question notification because you are a direct
> subscriber of the question.

Revision history for this message
Fabio Varesano (fabio-varesano) said :
#7

No they are not if you use the original FreeIMU code which disable
them. Just add pullups on the high side from 5V to SDA and SCL and you
should be just fine.

The low level side will use the pullups on the 6DOF board.

On 04/06/2011 11:24 AM, avenue33 wrote:
> • High level side pull-ups are internal

Revision history for this message
avenue33 (vilo-rei) said :
#8

Very clear.

• Original code + external pull-ups
or
• Modified code (with standard internal pull-ups) + no external pull-ups

        // 71 cbi(PORTC, 4);
        // 72 cbi(PORTC, 5);

Thanks.

Revision history for this message
Fabio Varesano (fabio-varesano) said :
#9

Exactly. I'm glad we sorted this out. ;-)