I2C don't work on the NUCLEO-F443RE

Dear All,

I am testing the I2C on the NUCLEO-F446RE with the mbed-os-6.15.1.
And it don’t work , no clock, no data output on the oscilloscope.

    I2C i2c(PB_9, PB_8);
    // scan
    dbg("i2c scanning...\n");
    char cmd[2] = {0x00, 0x01};
    for (uint8_t addr = 1; addr < 127; addr++) {
        if ( i2c.write(addr << 1, cmd, 1) == 0 )  {
            dbg("found i2c at:%02X\n", addr);
        }
        thread_sleep_for(50);
    }
    dbg("i2c scan stop\n");

Any solution for the issue ?

Best Regards,
Jason

Hello,

I think Nucleo-F443RE and also F433RE do not exist so you probably mean Nucleo-F446RE.
I tried your code on my Nucleo with a GPIO expander and it is working.

Console:

Mbed OS version 6.15.1

i2c scanning...
found i2c at:20
i2c scan stop

My setup:

  • Nucleo-F446RE
  • i2c GPIOExpander
  • Keil Studio
  • MbedOS 6.15.1

Check wiring and pull-up resistors.

BR, Jan

Dear Jan,

Yes, you are right, wrong P/N. My board is Nucleo-F446RE.
I am using the mbed-studio 1.4.3 with the mbed-os 6.15.1.

I have try to pull up the wires, but the wires will be pull down in the I2C construct…

    DigitalIn sda(SDA_PIN);
    DigitalIn scl(SCL_PIN);

    sda.mode(PullUp);           // wire be pull up
    scl.mode(PullUp);

    I2C i2c(SDA_PIN, SCL_PIN);  // wire be pull down
    i2c.frequency(kHZ(400));

I never used internal resistors with I2C, I used external every time.
But you can try…

    DigitalIn sda(SDA_PIN);
    DigitalIn scl(SCL_PIN);

    I2C i2c(SDA_PIN, SCL_PIN);  // wire be pull down

    sda.mode(PullUp);           // wire be pull up
    scl.mode(PullUp);

However, internal pull-up resistors are usually 40kΩ, but you usually need to use 4,7-10kΩ, I think.
You will see.

BR, Jan

2 Likes

Dear JohnnyK,

You are right, that internal pull-up is not enough and still pull down.
I have to add the external resistors 10K ohm on the wires to pull up, and working.

Thank you for your help.