curtis63 5 Posted January 13, 2017 Share Posted January 13, 2017 So, I'm using Energia and getting frustrated with Wire.h. I need to do some i2c communications and figured it would be fairly easy to write my own Bit-Bang implementation of i2c. I got started and things seem to be working pretty well. However, I discovered the concept of OpenCollector. It seems that OpenCollector means that the pin is set to High by default with a Pullup Resister and you just set it to LOW and then it goes back to high when you're not setting it to LOW. It also goes to low when a slave i2c device sets it to LOW. Question is how the heck do we do this with Energia?? Does pinMode(INPUT) set a pin to OpenCollector mode? Does pinMode(INPUT_PULLUP) set a pin to OpenCollector mode? If either of these do, what does digitalWrite(LOW) do on that pin? It sets it to LOW, but for how long? Do you have to set it back to HIGH, or does it get pulled back up to HIGH, or does setting it to HIGH, just release the LOW pull-down? This behavior doesn't seem to be documented anywhere that is easy to find. Perhaps it's not intended to be used that way, but I don't know how a person would implement i2c correctly without being able to set the SCL and the SDA to OpenCollector mode and to be able to pulse the clock. Speaking of pulsing the clock, how is that to be accomplished? Seems like you should be able to pull it LOW and then let it go, but I'm not sure how to 'let it go' back to its HIGH state without just calling digitalWrite(HIGH) on that pin.. But then aren't I holding it high? Anyway, if somebody has a good explanation around this, I would LOVE to hear it. I found some hints about it at the following location http://energia.nu/Constants.html But it didn't use the term OpenCollector anywhere... Quote 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.