7 years, 5 months ago.  This question has been closed. Reason: Off Topic

Every second i2c.read fail on Nucleo F446RE

Hi, I am sorry for my bad English. I want connect my Nucleo (F443RE) with DS2484 aka bridge i2c to onewire. When I tried to use OneWire library from mbed storage, I identified a problem with i2c communication.

So I made a simple test...

Test

#include "mbed.h"

#define ADRS                                0x30        // 7bit i2c address of 1Wire master represented by DS2484
#define DEVICE_RESET                0xF0        // hex code for reset 1Wire master device

    Serial pc(SERIAL_TX, SERIAL_RX);
    I2C i2c(PB_9, PB_8);     // i2c1 pins
    
int main() {  
                
                char data_write[1];
                char data_read[1];
                         data_write[0] = DEVICE_RESET;

                i2c.write(ADRS, data_write,1) ;
                
                wait(1);
            
                while(1){
                       wait_us(10);
                       i2c.read(ADRS, data_read, 1);
                       pc.printf("registr 0x%X \n", data_read[0]);          //Print to PC program Termite
                       data_read[0]= 0;
                } 
}

This code send reset command for bridge and in While function again and again try to read a status registr of the bridge. Result in Termite is... "registr 0x18 registr 0x0 registr 0x18 registr 0x0" again and again same result...

Same code I tested on Nucleo F767ZI without problem, result is always "registr 0x18".

BTW: I have pull up on I2c lines, I2c address work well.

I have an idea where the problem is but I am a Newbe so... Where is the problem? :)

Best regards and thx, John

1 Answer

7 years, 5 months ago.

Hi Jan, there is a problem with the I2C on (some) ST platforms (see here). The issue was raised on github (see here) and has been addressed in a new revision of the library. Right click on mbed.lib in you project and select ''update''. I think the fix is included in the most recent release, otherwise it will be soon..

Accepted Answer