Go Down

Topic: Problem reaching the PCA9633 LED-Driver with I2C (Read 124 times) previous topic - next topic

GRiSDOF

Hello,

I am trying to program the PCA9633 LED-Driver.

It should be used like a Digital Output, but i can only use I2C that's why i don't have the opportunity to use the GPIOS.

I've already checked the Adresses I am using. The main-adress is "0x60" and to control the PWM's (so the 4 outputs) i am using {0x02, 0x03, 0x04, 0x05}

and to have 5V i should send 0xFF and to have 0V i should send 0x00.

But nothing changes when i send the commands. It still stays at +5V..

Here's my Code:

Code: [Select]
#include <Wire.h>
#define Addr 0x60

void setup()
{
  Wire.begin();
  Serial.begin(9600);
}

void loop()
{
  Wire.beginTransmission(Addr);
  Wire.write(0x08);
  Wire.write(0x10);
  Wire.endTransmission();
  delay(500);
 
  Wire.beginTransmission(Addr);
  Wire.write(0x02);
  Wire.write(0x00);
  Wire.endTransmission();
  delay(500);
 
  Wire.beginTransmission(Addr);
  Wire.write(0x03);-
  Wire.write(0xFF);
  Wire.endTransmission();
  delay(500);
  }

pylon

Quote
It should be used like a Digital Output, but i can only use I2C that's why i don't have the opportunity to use the GPIOS.
Are we really talking about an Arduino UNO? Post a wiring diagram!

Quote
The main-adress is "0x60" and to control the PWM's (so the 4 outputs) i am using {0x02, 0x03, 0x04, 0x05}
For what do you use these values? At least in the posted code you don't use all the values.

GRiSDOF

Quote
Are we really talking about an Arduino UNO? Post a wiring diagram!
U really think i am going to an Arduino Forum using no Arduino ?! haha

Quote
For what do you use these values? At least in the posted code you don't use all the values.
To set the PWM output. 0x02 is Output1 0x03 is Output2...
And 0x60 is the Main-Address of the PCA9633 (calculated in Datasheet and checked)

groundFungus

#3
Feb 14, 2019, 09:42 am Last Edit: Feb 14, 2019, 09:43 am by groundFungus
The first thing that I do when an I2C device does not work is to run the I2C scanner sketch to confirm communication with the I2C bus and confirm the I2C address of the device.  What is returned in serial monitor when you run the scanner sketch?

Code: [Select]
// I2C scanner by Nick Gammon.  Thanks Nick.

#include <Wire.h>

void setup() {
  Serial.begin (115200); //*****  make sure serial monitor baud matches *****

  // Leonardo: wait for serial port to connect
  while (!Serial)
    {
    }

  Serial.println ();
  Serial.println ("I2C scanner. Scanning ...");
  byte count = 0;
 
  Wire.begin();
  for (byte i = 1; i < 120; i++)
  {
    Wire.beginTransmission (i);
    if (Wire.endTransmission () == 0)
      {
      Serial.print ("Found address: ");
      Serial.print (i, DEC);
      Serial.print (" (0x");
      Serial.print (i, HEX);
      Serial.println (")");
      count++;
      delay (1);  // maybe unneeded?
      } // end of good response
  } // end of for loop
  Serial.println ("Done.");
  Serial.print ("Found ");
  Serial.print (count, DEC);
  Serial.println (" device(s).");
}  // end of setup

void loop() {}

GRiSDOF

I have already checked this with an I2C-Scanner..

But that's what i get:

I2C scanner. Scanning ...
Found address: 3 (0x3)
Found address: 96 (0x60)
Done.
Found 2 device(s).


AND

Quote
And in case you can properly communicate with the PCA9633, then please check the Mode Register 1 bit 4 SLEEP setting. The value needs to be 0 so that the OSC is turn on. If the OSC is turned off, the LEDs cannot be turned on or off.
This is what a "support" of the manufacturer says, but i have no clue what this means.
I mean i have no idea how to "code" this then..

pylon

Quote
But that's what i get:

I2C scanner. Scanning ...
Found address: 3 (0x3)
Found address: 96 (0x60)
Done.
Found 2 device(s).
That's correct, the first is the reset all address, the second is the address you've chosen by your wiring.

I would have expected it to react on the 0x70 address too as that is the LED All Call address of the PCA9633.

Quote
And in case you can properly communicate with the PCA9633, then please check the Mode Register 1 bit 4 SLEEP setting. The value needs to be 0 so that the OSC is turn on. If the OSC is turned off, the LEDs cannot be turned on or off.
Interesting, I wouldn't have noticed that if they weren't mentioning it. The default value for the SLEEP bit is enabled, so the first thing to do on that chip is to disable sleep state:

Code: [Select]
  Wire.beginTransmission(Addr);
  Wire.write(0x00);
  Wire.write(0x10);
  Wire.endTransmission();


Setting register 8 to 0x10 activates output 2, the settings of register 2 and 3 are ignored by the chip with this setting of register 8.

Go Up