adafruit / Adafruit-Raspberry-Pi-Python-Code

Adafruit library code for Raspberry Pi
1.43k stars 686 forks source link

MCP4725 "Error accessing ...: Check your I2C address" #143

Closed enricozb closed 8 years ago

enricozb commented 8 years ago

Having a bit of a weird behavior... I have two MCP4725 break out boards. SDA and SDL wired in series, as I understood it should be with I2C. I have a raspberry pi model b rev 1. Running

sudo i2cdetect -y 0

will output

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- 62 63 -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --  

Awesome. I have one of the A0 pins wired to 3.3V so that its address is 0x63. Now, when the sample code in the folder is run,

python sinewave.py

This output occurs.

Error accessing 0x62: Check your I2C address
Error accessing 0x62: Check your I2C address
Error accessing 0x62: Check your I2C address
Error accessing 0x62: Check your I2C address
Error accessing 0x62: Check your I2C address
Error accessing 0x62: Check your I2C address
Error accessing 0x62: Check your I2C address
Error accessing 0x62: Check your I2C address
Error accessing 0x62: Check your I2C address
Error accessing 0x62: Check your I2C address
Error accessing 0x62: Check your I2C address
Error accessing 0x62: Check your I2C address
Error accessing 0x62: Check your I2C address
Error accessing 0x62: Check your I2C address
Error accessing 0x62: Check your I2C address
Error accessing 0x62: Check your I2C address
Error accessing 0x62: Check your I2C address
Error accessing 0x62: Check your I2C address
Error accessing 0x62: Check your I2C address
Error accessing 0x62: Check your I2C address
Error accessing 0x62: Check your I2C address
Error accessing 0x62: Check your I2C address
Error accessing 0x62: Check your I2C address
Error accessing 0x62: Check your I2C address

However, it will then work properly. It outputs those errors before proper operation. If I try to change the speed at which .setVoltage is being called, it will never work and will only output those errors. For example,

from Adafruit_MCP4725 import MCP4725
import time

x_dac = MCP4725(0x63)
y_dac = MCP4725(0x62)

while(True):
        x_dac.setVoltage(0)
        y_dac.setVoltage(0)
        time.sleep(0.1)

        x_dac.setVoltage(0)
        y_dac.setVoltage(4096)
        time.sleep(0.1)

        x_dac.setVoltage(4096)
        y_dac.setVoltage(4096)
        time.sleep(0.1)

        x_dac.setVoltage(4096)
        y_dac.setVoltage(0)
        time.sleep(0.1)

The errors will continuously print, and never does the output voltage change on either board. Any help would be appreciated. Thanks!

enricozb commented 8 years ago

Disregard this, I didn't have the DAC grounded. No idea how it worked in the first place.