Can't change LEDs states using PCA9685

Discussion of the PICO module, baseboard or peripherals

Can't change LEDs states using PCA9685

Postby donut » Sat Feb 18, 2017 9:02 am

I have a PCA9685 IC connected to I2C of cubieboard like board.

Also OE pin is connected to one GPIO pin. I'm using IC2tools to communicate with PCA9685, I can read/write to registers without any problems, but changes I do to registers does not take effect, LEDs don't change them state.

There are 4 RGB leds connected through a resistor to PCA9685 (as Fig 15 of PCA9685 datasheet:http://www.kynix.com/uploadfiles/pdf65976/PCA9685BS2c118_658254.pdf ), this is, 12 channels are being used. Doesn't matter which value I write to PWM registers, LEDs state are always the same, oddly, colors are not equal to each LED. 1 LED has red, 1 LED has blue, 1 magenta and 1 white. However, colors are not random, always I turn off/on PCA9685 the same colors are assumed by the same LEDs.

I can switch all LEDs on/off by changing OE pin state.

Here is the code I'm using to test.

Code: Select all
#!/bin/bash

set -e

PCA9685_BUS=1
PCA9685_ADDR=0x41
PCA9685_OE="pi15"

# config GPIO as output and set initial state
${PWD}/gpio_config.sh "$PCA9685_OE" "out" "1"

# set output logic as inverted
i2cset -y $PCA9685_BUS $PCA9685_ADDR 0x01 0x10

# restart
i2cset -y $PCA9685_BUS $PCA9685_ADDR 0x00 0x91
sleep 1

# change to normal mode
i2cset -y $PCA9685_BUS $PCA9685_ADDR 0x00 0x01
sleep 1

for (( i = 0x06; i <= 0x45; i++ )); do
    i2cset -y $PCA9685_BUS $PCA9685_ADDR $i 0x0F
done
Running I2Cdump I can see registers were changed.
[root@board test]# i2cdump 1 0x41
No size specified (using byte-data access)
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-1, address 0x41, mode byte
Continue? [Y/n]
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 01 10 e2 e4 e8 e0 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f    ????????????????
10: 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f    ????????????????
20: 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f    ????????????????
30: 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f    ????????????????
40: 0f 0f 0f 0f 0f 0f XX XX XX XX XX XX XX XX XX XX    ??????XXXXXXXXXX
50: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
60: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
70: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
80: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
90: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
a0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
b0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
c0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
d0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
e0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
f0: XX XX XX XX XX XX XX XX XX XX 00 00 00 00 1e 00    XXXXXXXXXX....?.


I've tried others values than 0x0F, same issue.
Any idea over what can be happening?
donut
 
Posts: 1
Joined: Sat Feb 18, 2017 8:54 am

Re: Can't change LEDs states using PCA9685

Postby tharakram » Thu Jul 27, 2017 5:38 am

Used to drive an analog RGB LED Strip using a raspberry pi and ... Hook up the pi to the PCA9685 breakout board using the I2C ... --reverse Reverse the fade, to return back to the initial state. ... The color changes a maximum of --max-random-walk per change. ... You can't perform that action at this time.
tharakram
 
Posts: 2
Joined: Thu Jul 27, 2017 5:34 am


Return to Hardware and peripherals

Who is online

Users browsing this forum: No registered users and 1 guest

cron