avr_fred:
Open drain? Don't conflate SPI with I2C, they're two different standards.
I'm not mixing SPI and I2C. The device I am interfacing with is using SPI and is expecting the MISO to be an open drain. I brought up I2C because the ATmega328 has a built in I2C interface which uses open collectors.
MarkT:
No, they are perfectly regular pins.
They are most certainly not perfectly regular pins. The ATmega328 has a built in I2C interface and these pins are open collectors/open drain.
https://playground.arduino.cc/Main/WireLibraryDetailedReference#inside
This reference goes into detail about how the i2c part of the chip is a separate processing unit. The more I read about it the less likely it seams to me that I will be able to access these pins directly.
Smajdalf:
Well we don't know what OP wants. Maybe he is just confused. But maybe he needs to interface something with SPI-like protocol where open drain is used for voltage level shifting. In this case protection diodes ARE big issue.
I am most certainly confused as a regular state of being
But yes, I am interfacing with a device that is SPI-like. The protocol is SPI with an additional ACK line. The MISO and ack lines are not push-pull, it is expecting both to be an open collector on the slave device (arduino)
avr_fred:
The atmega328 supports hardware based SPI master and slave with four pre-assigned pins. SPI does not require open drain, only a means of releasing control of MISO by the slave when it is no longer being addressed. Tri-stating the output works just fine. What I don't know is if exsisting SPI libraries for Arduino support this control, I honestly doubt it as there is next to nothing published when using the Arduino as a slave. About the only good reference on the web is:
Gammon Forum : Electronics : Microprocessors : SPI - Serial Peripheral Interface - for Arduino
And scroll down to where you see "How to make an SPI slave".
I am also interfacing my Arduino Pro Mini with a usb host shield, which uses the standard SPI pins. Is it possible to create multiple instances of the SPI object with different pin assignments?
MarkT:
All Arduino pins can be operated pseudo-open-drain, just go digitalWrite(pin, LOW) and toggle
with pinMode (pin, INPUT) and pinMode (pin, OUTPUT).
I have read on other forums this is not good practice. does switching pin mode happen fast enough for a high speed use case like this? And how much current can the device sink before protection circuit is overwhelmed.
However, none of the forums I've seen this discussed in have had a proper solution. is there just a small circuit I can add to the output pin to convert it to an open drain. like the most minimal circuit?