I am part of a research group that is developing a concept for a PCB for an external piece of equipment. This piece of equipment can be controlled with a microcontroller. It communicates to my microcontroller through I2C, using SDA and SCL pins. However, it uses another pin; they call it an "interrupt pin" and it allows slaves to send commands to the master. The external piece of equipment states in its interfacing description that this interrupt pin should be controleld by an open-drain pin on a microcontroller. Fair enough.
Our microcontroller is an ATMega328p with Arduino bootloader. In prototyping I have abused Arduino's pinMode to emulate open-drain:
void setup ()
{
digitalWrite (pin, LOW) ;
}
void loop ()
{
...
pinMode (pin, OUTPUT) ; // drive pin low
...
pinMode (pin, INPUT) ; // hi-Z state
}
But as you probably know, this results in odd waveforms when the signals are checked with an oscilloscope. In the thread linked, the guy who ran into the same issue added an external 10k pullup to the pin and it solved his waveforms. It seemed to work correctly.
As none of us are very knowledgeable about this specific issue; are we correct in assuming that if a piece of external equipment requires control by an open-drain pin on "some microcontroller", this can be realized by switching INPUT/OUTPUT on an ATMega328p together with a 10k pullup resistor added to the pin?