AVR GPIO as open collector/drain

Hello All. I need an Open Collector line on my mega128 based board. Having read the datasheet I could not find any directions how to configure a port output to make it OC. Is it really impossible or I had missed a proper page? Reagards, Alex

Reply to
Alexander Baranov
Loading thread data ...

It's not possible; there are full totem-pole drivers on all pins. Use an external bipolar transistor.

Reply to
larwe

Write 0 to the appropriate PORTx register bit. Use the appropriate DDRx direction register bit as the output.

VLV

Reply to
Vladimir Vassilevsky

By the way... why do you need it? If it is for I2C then look at the two-wire interface module. That's an exception to the "totem pole on all pins" statement.

Reply to
larwe

  1. Thanks, Vladimir!
2.As I've read at avrfreaks, TWI module of AVR does not work properly in multimaster mode. Under some conditions on the bus it freezes and can be released only by TWI disable/enable
Reply to
Alexander Baranov

You are the first one I know who does care about the I2C multimaster mode. In my ~20 years of experience, I have never seen a system with more then one master on I2C. What is it?

Vladimir Vassilevsky

DSP and Mixed Signal Design Consultant

formatting link

Reply to
Vladimir Vassilevsky

Well, to say the truth neither have I. But I was asked to consult 'pure' software developer about the possibility of implementation of bit-banging TWI protocol on their system, which had previously worked using TWI block. They use TWI for interboard communication. Necessary condition: 'no hardware changes'. Alex.

Reply to
Alexander Baranov

But is this MultiMaster ? - Doing Multi-Master (with the arbitration ) in SW is not going to be easy.... Tho if you have control on BOTH ends, you can probably cobble something together.

-jg

Reply to
Jim Granville

Forget the AVR and use a PIC !

Reply to
Marra

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.