Jump to content

msp430g2 software i2c: how to do open-drain?

Recommended Posts

I'm working in project where few MSP430G2* and i2c-ready ADC/DAC are doing I2C communication. While the DAC/ADC have proper open-drain SDA/SCL, I don't find a way to operate MSP430G2* with open-drain output while software bit-banging ports P1.6 and P1.7.


So, did I miss some details in SLAS722/SLAU144 and msp430g2 could operate honest open-drain (as in opposite to manipulate P1DIR.[67] while keeping P1OUT.[67] low, that how I'm doing now)? 


Link to post
Share on other sites

Actually, that isn't working. I made that mistake myself once, when PxREN is enabled, PxDIR does not switch it from hard to soft driving, but rather switched PxIN to read from PxOUT or from the actual pin.

To switch between pull-down and drive low you'd need to set PxOUT to 0, PxDIR to 1 and control using PxREN (1=pull-down/release, 0=drive low).

When switching to read mode (when receiving the ack bit and responses) switch PxDIR to 0 to let PxIN read the actual pin state, you cannot drive the pin low while PxDIR is 0, so switch back to 1 to enable driving the pin again.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...