kbanks
08-04-2008, 05:31 PM
This came in as an email, posted on the forum on behalf of the customer
We are looking to interface with Dallas 1-wire devices and you recently suggested the DS2482 i2c to 1-wire bridge. This will work for our purposes.
Looking through the documentation and the user manual I don't see any way to specifically address the i2c bus. I think this functionality may only be available in the beta versions of the software. Is this right? Can you provide some documentation on how I would access the i2c bus from within Python? Typically I access the i2c bus from the pic using i2c_initialize, i2c_read and i2c_write functions and I assume that there is something similarly available in python.
Thanks,
Tom Johnson
Controls Plus USA
You are correct, i2c support was not in the 2.0 release, but it has been implemented for the upcoming 2.1 release (as has SPI and CBUS).
In all three cases (i2c, SPI, and CBUS), the RF Engine has to be the "bus master".
We haven't had a chance to update the SNAP Reference Manual yet, but here are the new functions for i2c:
i2cInit(pullups) - setup for I2C, with internal (True) or external (False) pullup resistors
i2cWrite(byteStr,retries,ignoreFirstAck) - send data out I2C - returns bytes actually sent
i2cRead(byteStr,numToRead,retries,ignoreFirstAck) - send data out I2C then read response - returns response string
getI2cResult() - returns status code from most recent I2C operation
As a placeholder until we are able to switch from working on code to working on docs, I have attached some example scripts that USE the new i2c capabilities. If you are familiar with i2c, these example scripts should clarify the usage of the new functions.
i2ctests.py - the overall script
CAT24C128.py - example of using an i2c serial EEPROM
M41T81.py - example of using an i2c clock/calendar chip
We are looking to interface with Dallas 1-wire devices and you recently suggested the DS2482 i2c to 1-wire bridge. This will work for our purposes.
Looking through the documentation and the user manual I don't see any way to specifically address the i2c bus. I think this functionality may only be available in the beta versions of the software. Is this right? Can you provide some documentation on how I would access the i2c bus from within Python? Typically I access the i2c bus from the pic using i2c_initialize, i2c_read and i2c_write functions and I assume that there is something similarly available in python.
Thanks,
Tom Johnson
Controls Plus USA
You are correct, i2c support was not in the 2.0 release, but it has been implemented for the upcoming 2.1 release (as has SPI and CBUS).
In all three cases (i2c, SPI, and CBUS), the RF Engine has to be the "bus master".
We haven't had a chance to update the SNAP Reference Manual yet, but here are the new functions for i2c:
i2cInit(pullups) - setup for I2C, with internal (True) or external (False) pullup resistors
i2cWrite(byteStr,retries,ignoreFirstAck) - send data out I2C - returns bytes actually sent
i2cRead(byteStr,numToRead,retries,ignoreFirstAck) - send data out I2C then read response - returns response string
getI2cResult() - returns status code from most recent I2C operation
As a placeholder until we are able to switch from working on code to working on docs, I have attached some example scripts that USE the new i2c capabilities. If you are familiar with i2c, these example scripts should clarify the usage of the new functions.
i2ctests.py - the overall script
CAT24C128.py - example of using an i2c serial EEPROM
M41T81.py - example of using an i2c clock/calendar chip