jam1
Posts: 47
Joined: Tue Oct 21, 2014 5:51 pm

Software reset on PCA9685

Mon Apr 06, 2015 7:18 pm

Hi,
I am trying to get the Adafruit Motor shield V2 with PCA9685 to be able to accept the software reset command through the I2C connection. It is well defined in the datasheet as the command 0x06 as a chip address, not as a register if I understand the spec. The default values of the first register (MODE1) should be 00010001 or 0x11.

Can you send a chip address with the pigpio (pigs) program?
I tried also with python and C without success.
Did anyone succeeded ?
The only method that works is the power down which is not practical.

User avatar
joan
Posts: 14936
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Software reset on PCA9685

Mon Apr 06, 2015 7:38 pm

I2C addresses 0x00 through 0x07 are reserved by the I2C specification. They oughtn't to be used which is why you can't use them in pigpio/pigs.

You could edit i2cOpen in pigpio.c and comment out the following lines.

Code: Select all

   if ((i2cAddr < 0x08) || (i2cAddr > 0x77))
      SOFT_ERROR(PI_BAD_I2C_ADDR, "bad I2C address (0x%X)", i2cAddr);

jam1
Posts: 47
Joined: Tue Oct 21, 2014 5:51 pm

Re: Software reset on PCA9685

Mon Apr 06, 2015 7:51 pm

Thank you, I will try that.
So, is it possible that all the programs that I saw claiming they are doing a reset by writing 0x06 through I2C are not doing anything in fact?

Or, are the i2c libraries preventing it in general?

User avatar
joan
Posts: 14936
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Software reset on PCA9685

Mon Apr 06, 2015 8:04 pm

jam1 wrote:Thank you, I will try that.
So, is it possible that all the programs that I saw claiming they are doing a reset by writing 0x06 through I2C are not doing anything in fact?

Or, are the i2c libraries preventing it in general?
I don't know. Perhaps those I2C libraries don't bother to validate the inputs. I find the PCA9685 document confusing.

You need to send

S 0x00 0x06 P (start, general call address, reset, stop).

From pigs that would be

pigs i2co 1 0 0 # bus 1 device 0 flags 0
# assume handle 0 returned
pigs i2cwd 0 6

jam1
Posts: 47
Joined: Tue Oct 21, 2014 5:51 pm

Re: Software reset on PCA9685

Mon Apr 06, 2015 8:18 pm

Not working so far

Code: Select all

pi@raspberrypi ~ $ pigs i2co 1 0 0
-75
ERROR: bad I2C address
pi@raspberrypi ~ $ pigs i2co 1 0x60 0
2

User avatar
joan
Posts: 14936
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Software reset on PCA9685

Mon Apr 06, 2015 8:28 pm

You would have had to make the change to pigpio.c and have rebuilt the software and be running the new daemon.

Alternatively there is a bit bang reset at http://abyz.co.uk/rpi/pigpio/code/bb_reset.py. That will work with the unmodified daemon.

jam1
Posts: 47
Joined: Tue Oct 21, 2014 5:51 pm

Re: Software reset on PCA9685

Mon Apr 06, 2015 8:32 pm

Working now.
I did a complete make clean; make ; make install; in PIGPIO and now it's OK.
Thank you again.

Return to “Interfacing (DSI, CSI, I2C, etc.)”