I'm trying to use the Arduino Wire library for the Nucleo F446RE board (STM32 boards groups 2.2.0), but I don't get any signal on the SDA and SCL, both have pullup resistors (I've tested 10k, 1k, 4k7).
I've already tried to configure the SDA and SCL pins with Wire.setSDA() and Wire.setSCL() and still no result.
I monitored all pins of the F446RE on the Oscilloscope and all pins are static, none makes any pulse.
To test I'm doing a simple scanner. Does anyone know how I can use i2C on the F446RE with the Wire library?
This is my code:
Code: Select all
#include <Wire.h>
//TwoWire Wire2(PC0, PC1);
void setup()
{
Serial.begin(9600);
Serial.println("===== I2C SCANNER STM32 =====");
//Wire.setSDA(PB7);
//Wire.setSCL(PB8);
//Wire.setClock(100000);
Wire.begin();
delay(100);
}
void loop()
{
uint8_t devices = 0;
byte addr = 0x00, error = 0x00;
Serial.println(" ");
Serial.println("Scanning...");
for(addr = 1; addr < 127; ++addr)
{
Wire.beginTransmission(addr);
error = Wire.endTransmission();
if(error == 0)
{
Serial.print("I2C Device: 0x");
if(addr < 16) Serial.print("0");
Serial.println(addr, HEX);
++devices;
}
else if(error == 4)
{
Serial.print("Unknow error address: ");
if(addr < 16) Serial.print("0");
Serial.println(addr, HEX);
}
}
Serial.println(String("Devices Found: ") + String((int) devices));
delay(1000);
}