I have a "generic" board with an STM32F103C8. (I use the last core version and for this version, https://github.com/stm32duino/Arduino_Core_STM32 give version 1.9.0)
On datasheet it is said that for I2C1 I can use PB9 as alternate SDA and PB8 as alternate SCL (confirmed with STM32CUBEmx).
So, with help on I2C example I try this very simple code :
Code: Select all
#include <Wire.h>
TwoWire WIRE1(PB9,PB8);
void setup(){
WIRE1.begin(); // join i2c bus (address optional for master)
}
byte x = 0;
void loop(){
WIRE1.beginTransmission(4); // transmit to device #4
WIRE1.write(x); // sends one byte
WIRE1.endTransmission(); // stop transmitting
x++;
delay(200);
}
I really not understand where is the problem.. this is very basic code and it must work.. any Id ?