Hi many thanks for your answer.
It is a surprise to me you successfully done the I2C connection with the default Wire instance.
as you can see below, I drove a lot of tests, and non of them are working with the default Wire instance.
I had few results with dedicated TwoWire instance (PB7,PB6) but never at address 4,48 and 50. And why these address ? I can understand 4... But the others?
Maybe there are some difference of parameters in board selection?
Here is what I have:
"Generic STM32F4 series"
"blackpill F411CE"
I have to add that my blackpill is not weact but this one which has good reviews as well (5 stars):
https://fr.aliexpress.com/item/40011578 ... 6c374v2gIM
Here are some conclusions about detection programs:
A/ Jetson nano as master // STM32 as slave -> KO
B/ Jetson nano // servo controller as slave -> perfect
C/ STM32 as master // servo controller as slave -> OK (with custom TwoWire instance) for 5 minutes
D/ STM32 as master // STM32 as slave -> OK (with custom TwoWire instance) for 5 minutes
never succed to have the blackpill as slave detected by the jetson nano. Every time I have the same errors.
I am going more deep tests with an ESP32 board which I know is correctly detected by Jetson Nano as well as my servo controller.
Maybe you have more ideas about:
1/ the differences between your results and my results - using the default Wire instance - and why the address detected are not the same, and in your situation why 3 occurences?
2/ other assumptions about the errors?
Regards,
Christian
Here is whet I've done:
A/ Jetson nano // STM32 as slave
1/ manually redefine SDA and SCL
- error message with dmesg and timeout issues as I previously described
2/ use the default wire constant
- no errors but no detection.
B Jetson nano servo controller as slave
perfectly detected
C/ STM32 as master // servo controller as slave
1/ custom TwoWire instance (change the SDA and SCL values to B7 and B6) => Working 5-10 minutes (probably because of multiple input power and USB power)
serial console is :
« Scanning…
I2C device found at address 0x40 !
I2C device found at address 0x70 !
Done
«
but after 5-10 minutes : « Scanning No I2C devices found » → I have to reset the STM32
2/ use the default wire constant => Not working
- errors message : « Unknown error at address 0xxx » where xx is from 01 to 0x7e
- No I2C devices found
C/ STM32 as master // STM32 as slave
1/ STM32 as master : use default Wire, STM32 as slave : use default wire
2/ STM32 as master : use default Wire, STM32 as slave : use custom wire
3/ STM32 as master : use custom Wire, STM32 as slave : use default wire
1/ STM32 as master : use default Wire, STM32 as slave : use default wire
Scanning…
No I2C device found
2/ STM32 as master : use default Wire, STM32 as slave : use custom wire
Scanning…
No I2C device found
3/ STM32 as master : use custom Wire, STM32 as slave : use custom wire
Scanning…
I2C device found at address 0X04 !
Done
here is the code used :
#include <Wire.h> //include Wire.h library
void setup()
{
Wire.begin(); // Wire communication begin
Serial.begin(9600); // The baudrate of Serial monitor is set in 9600
while (!Serial); // Waiting for Serial Monitor
Serial.println("\nI2C Scanner");
}
void loop()
{
byte error, address; //variable for error and I2C address
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for (address = 1; address < 127; address++ )
{
// The i2c_scanner uses the return value of
// the Write.endTransmisstion to see if
// a device did acknowledge to the address.
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0)
{
Serial.print("I2C device found at address 0x");
if (address < 16)
Serial.print("0");
Serial.print(address, HEX);
Serial.println(" !");
nDevices++;
}
else if (error == 4)
{
Serial.print("Unknown error at address 0x");
if (address < 16)
Serial.print("0");
Serial.println(address, HEX);
}
}
if (nDevices == 0)
Serial.println("No I2C devices found\n");
else
Serial.println("done\n");
delay(5000); // wait 5 seconds for the next I2C scan
}