Author Topic: PCA9685 i2c problem  (Read 3797 times)

0 Members and 1 Guest are viewing this topic.

Offline xuioTopic starter

  • Contributor
  • Posts: 46
  • Country: de
PCA9685 i2c problem
« on: May 02, 2015, 03:14:11 pm »
I have made a custum board with an ATMega32u4 (sparkfun pro micro 3.3v bootloader, Yeah its arduino based :palm: ), an IMU (BNO055) and a PCA9685.
When I ran the i2c scanner script (from the arduino website) it only recognized the BNO055 (0x29), but not the PCA9685, which should be at 0x40.

It does also not react to the example sketch from the adafruit library.

The schematic is a clone of adafruits 12 Channel servo board, I assembled 3 boards so far and none of them is working, so a chip fault is unlikely.

The schematic is attached and yes: the i2c bus has pullup resistors.

Thanks for your help!

Moritz

Edit: This is the QFN version of the chip
« Last Edit: May 02, 2015, 03:23:49 pm by xuio »
 

Offline eneuro

  • Super Contributor
  • ***
  • Posts: 1528
  • Country: 00
Re: PCA9685 i2c problem
« Reply #1 on: May 02, 2015, 10:42:40 pm »
... but not the PCA9685, which should be at 0x40.
How did you got this address?
While you have all A0..A5 pins pull down to ground (0), than according to its datasheet https://www.adafruit.com/datasheets/PCA9685.pdf 
Quote
The last bit of the address byte defines the operation to be performed. When set to logic 1
a read is selected, while a logic 0 selects a write operation.
For I2C read we get: 10000001 -> 0x81 write 10000000 -> 0x80

I'd suggest use small AVR MPU like my favourite ATTiny85 and try to talk to this thing a few lines of custom C code.
Another option is to use I2C optoisolated PC <-> MPU intrface and call this device directly from PC without need to use any MPU.
I've made such PC Linux based I2C optoisolated PCB with PC817 5kV optocouplers and it performs quite well below 50kHz, while cutoff of slow PC817 is around 80kHz, so rather than messing with Arduino library which might have bugs, I'd rather go to the bacics and run simple AVR I2C code or PC based while it is easy log everything on PC hard disk for analysis directly from I2C ;)

BTW: Yep, probably you forgot about this last bit and then 1000000 -> 0x40 but you need add 1 bit more for R/~W :-DMM

Anyway quite nity PCA9685 PWMed LED driver I  might want to use in one project to drive H bridges for DC motors control  :-+
« Last Edit: May 02, 2015, 10:48:27 pm by eneuro »
12oV4dWZCAia7vXBzQzBF9wAt1U3JWZkpk
“Let the future tell the truth, and evaluate each one according to his work and accomplishments. The present is theirs; the future, for which I have really worked, is mine”  - Nikola Tesla
-||-|-
 

Offline xuioTopic starter

  • Contributor
  • Posts: 46
  • Country: de
Re: PCA9685 i2c problem
« Reply #2 on: May 03, 2015, 11:35:26 am »
I had a look at the schematic again this morning and it turns out that SDA and SCL are switched on the PCB, but only for this chip.
I fixed it with a couple of bodge wires and everything is working now.

So yeah Murphys Law all the way… :palm:

But thanks eneuro for your help!

Moritz
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf