Hello, I am using an RF266. I am trying to control a Triple Axis Accelerometer and Gyro MPU6050 using I2C. When I hook up the board the SCL line is held high but the SDA line always stays low. The getI2cResult result is always 2 (I2C_BUSY) for all calls other than the i2cInit() where getI2cResult returns a 1.
This is the code I am using:
from synapse.switchboard import *
from synapse.platforms import *
from synapse.hexSupport import *
address = 0x68
@setHook(HOOK_STARTUP)
def initAccelerometer():
i2cInit(False) # chip has internal pullups
ucastSerial("\x00\x00\x01") # put your correct Portal address here!
crossConnect(DS_STDIO,DS_TRANSPARENT)
print getI2cResult()
i2cWrite("\x68\x6B\x00",1,True)
print getI2cResult()
@setHook(HOOK_1S)
def callI2C():
print "X Values:"
print "Acc"
print GetAccX()
print getI2cResult()
def GetAccX():
cmd = ""
cmd += chr((address << 1) + 1)#(address<<4)+(1<<8)+59
cmd += chr(59)
acc1 = i2cRead("\x69\x3B",2,1,True)
return acc1
This is the code I am using:
from synapse.switchboard import *
from synapse.platforms import *
from synapse.hexSupport import *
address = 0x68
@setHook(HOOK_STARTUP)
def initAccelerometer():
i2cInit(False) # chip has internal pullups
ucastSerial("\x00\x00\x01") # put your correct Portal address here!
crossConnect(DS_STDIO,DS_TRANSPARENT)
print getI2cResult()
i2cWrite("\x68\x6B\x00",1,True)
print getI2cResult()
@setHook(HOOK_1S)
def callI2C():
print "X Values:"
print "Acc"
print GetAccX()
print getI2cResult()
def GetAccX():
cmd = ""
cmd += chr((address << 1) + 1)#(address<<4)+(1<<8)+59
cmd += chr(59)
acc1 = i2cRead("\x69\x3B",2,1,True)
return acc1
Comment