32xan 1 Posted March 31, 2013 Share Posted March 31, 2013 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)? Thanks, Quote Link to post Share on other sites
cde 334 Posted March 31, 2013 Share Posted March 31, 2013 The open-drain mode is not available outside of the USI/USCI mode. Only option is to put the pin in input mode, where it tri-states has high impedance, allowing the pull up to work. 32xan 1 Quote Link to post Share on other sites
spirilis 1,265 Posted April 1, 2013 Share Posted April 1, 2013 Yeah the closest you can get to open-drain is disable the pullup/pulldown (PxREN), set the PxOUT bit for those ports to 0, then control the port using PxDIR (1=pull it hard low, 0=release) Sent from my C3PO via Tapatalk 32xan 1 Quote Link to post Share on other sites
roadrunner84 466 Posted April 1, 2013 Share Posted April 1, 2013 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. 32xan 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.