I would like to know if somebody have tried to connect ConnectME (NS7520 microprocessor) with some I2C bus device. For example: I would like to use PCF8574 (Remote 8-Bit I/O Expander for I2C-Bus. http://www-s.ti.com/sc/ds/pcf8574.pdf). Can I make two ConnectME development board gpio ports act like it is I2C bus? I think I need to connect SDA(serial data) and SCL(serial clock). Maybe there is other solution? I just need to read and write data to that PCF8574 chip from ConnectME module. Any suggestions?
Thank you!
The answer:
Bit-bang,
Bit-bang,
Bit-bang.
The NS7520 uP does not provide a native I2C interface. Bit-banging is your only solution.
dh
Yes, I have attached 7 segment displays along with an 8-bit I/O expander using the I2C protocol off two of the GPIO ports. And yes, it is by bit-banging.
I was only able to get it up to 100 kHz. Considering the type of ARM it is, I was thinking that I should be able to get a higher rate. Well, I have sent something to support, but no response yet.
If you’ve ever written your own code for an 8051 variant that creates an I2C bus, then you can probably use the same code. You just need to access the Digi’s ports a little different.
Sorry, can’t provide code snippets. But, here are some hints.
Look into the NS7520 hardware reference document, under the PORTA Configuration register section. There is a register that controls everything for that port. On power up, configure the mode and direction for the two pins that you are going to use for the I2C protocol. Set the direction to outputs, and data as high. You bit-bang the clock and data going out. For the acknowledge bit, quickly change the direction of the SDA pin and read the value. Quickly change the direction back so you can continuing writing data. If you are doing a read, after sending the address, make sure the direction of the SDA pin has changed to input mode so you can read the data coming back.
Anyone have a solution to the startup delay that jams the bus until the ME starts?
-Erik
Would anyone share some code snippet for this bit-banging?