I am trying to get the I2C1 bus in master mode up and running on the Nucleo-L432KC board and I can't get it working. I am using the Wire and TwoWire class which don't work with the way I have the code written (below). I have tried setting the SDA and SCL pins using the setSDA() and setSCL() functions. I've tried altering the pin maps as suggest on this web page (https://github.com/stm32duino/wiki/wiki/API#i2C). Still nothing, I've checked the pins with an oscilloscope and there's no activity.
I know I'm missing something here but I have no idea what it is. I'm I missing a configuration setting in the setup() function? If you know please let me know.
Thanks.
Example code:
Code: Select all
void setup() {
Wire.setSDA(D4);
Wire.setSCL(D5);
Wire.begin();
}
void loop() {
Wire.beginTransmission(0b0101110);
Wire.write(0x00);
Wire.write(0x7A);
Wire.endTransmission();
delay(250);
}