I was using Arduino Wire library to perform I2C master. The board I selected was Seeed nRF52 mbed-enabled boards → Seeed XIAO BLE Sense - nRF52840. The SCL was a multi-purpose pin which sometimes needed to be controlled with pinMode() and digitalWrite() after I2C communications. The problem I encountered was, once the I2C communication already happened, if I wanted to take SCL back with Wire.end(), pinMode() and digitalWrite() had no effect. Here is the code,
Wire.end();
digitalWrite(SCL_PIN, HIGH);
pinMode(SCL_PIN, OUTPUT);
digitalWrite(SCL_PIN, LOW);
delayMicroseconds(5000);
digitalWrite(SCL_PIN, HIGH);
pinMode(SCL_PIN, INPUT);
Wire.begin();
Wire.setClock(400000UL);
I tried multiple SCL pins. None was working.
Any help will be highly appreciated.