This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DLPC6401: Dimming DLPC6401 over I2C

Part Number: DLPC6401

Hi there,

 

I am programming the chip DLPC6401 by the dsPIC33EP512MC502 via I2C protocol.

I would like to modify the output colour by control the LED Current Control (register 0x4B) and turn of the White Point Correction (WPC) by set the register 0x57 as 0x0. However, it does not work and the reading values from register 0x4B is not the written values. I don't know is there any register control the WPC.

Is there any register that is set up wrong value or wrong sequence?

 

Kind Regards,

Alex

  • Hi Alex,
    For any register WRITE operation you must Set BIT7 of the command register. For example, for the LED Current Control 0x4B you must set register address as 0x4B | 0x80 and send it.
    Let us know if you are still facing the problem.
    Regards,
    Sanjeev
  • Hi Sanjeev,

    Thank for your help. I did as your comment. But my problem haven't been solved yet.

    Following code  is my setup for DLPC6401

    Write I2C: 0x34, 0x83, 0x00;

    Write I2C: 0x34, 0x82, 0x00;

    Write I2C: 0x34, 0x84, 0x02;

    Write I2C: 0x34, 0x85, 0x82;

    Write I2C: 0x34, 0x80, 0x08;

    Write I2C: 0x34, 0x8F, 0x00, 0x78;

    Write I2C: 0x34, 0x96, 0x00;

    Write I2C: 0x34, 0x97, 0x00;

    Write I2C: 0x34, 0x88, 0x01;

    Write I2C: 0x34, 0x89, 0x01;

    Write I2C: 0x34, 0xD0, 0x17;

    Write I2C: 0x34, 0xD1, 0x80, 0x07, 0xB0, 0x04;

    Write I2C: 0x34, 0xD2, 0x00, 0x05, 0x20, 0x03;

    Write I2C: 0x34, 0x86, 0x00,;

    Write I2C: 0x34, 0xD7, 0x02; (Disable CCI)

    Write I2C: 0x34, 0xCB, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x00; (Blue colour is the brightest)

    Write I2C: 0x34, 0x90, 0x00;

    Read I2C: 0x35, 0x4B:--> 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x00;

    But after about 1 second 

    Read I2C: 0x35, 0x57: --> 0x00

    Read I2C: 0x35, 0x4B: --> 0x00, 0xAE, 0x00, 0xC3, 0x00, 0xCF;

    The ICC was OFF, but the LED current is still controlled by somewhere.

    Regards,

    Alex

  • Alex,
    Could you read the STAUS byte after sending each write command,
    www.ti.com/.../dlpu012.pdf 2.2.2.1 STATUS (STAT) Byte
    Basically after sending each write command, read back one byte response, see you are getting correct or expected response..

    By the way what is the I2C clock speed, try 100kHz first. Also look at the bus if there is any unusual activity.

    Regards,
    Sanjeev
  • Hi Sanjeev,

    Thank you for your comments.

    These are writing and reading data between dsPIC33EP512MC502 and DLPC6401. The clock speed is 100kHz.

    The format of my writing is:

    +  I2C_Write: device address (including write bit), register address, data byte 0, data byte 1,...;

    +  I2C_Read: device address (including write bit), register address, device address (including read bit), STAT byte, data byte 0, data byte 1,....;

    1) I2C_Write: 0x34, 0x83, 0x00;                                                                  I2C_Read: 0x34, 0x03, 0x35, 0x01, 0x00;

    2) I2C_Write: 0x34, 0x82, 0x00;                                                                  I2C_Read: 0x34, 0x02, 0x35, 0x01, 0x00;

    3) I2C_Write: 0x34, 0x84, 0x00;                                                                  I2C_Read: 0x34, 0x04, 0x35, 0x01, 0x02;   // Different from writing data

    4) I2C_Write: 0x34, 0x85, 0x82;                                                                  I2C_Read: 0x34, 0x05, 0x35, 0x01, 0x82; 

    5) I2C_Write: 0x34, 0x80, 0x01;                                                                  I2C_Read: 0x34, 0x00, 0x35, 0x01, 0x01;

    6) I2C_Write: 0x34, 0x8F, 0x00, 0x78;                                                        I2C_Read: 0x34, 0x0F, 0x35, 0x01, 0x00, 0x78;

    7) I2C_Write: 0x34, 0x96, 0x00;                                                                  I2C_Read: 0x34, 0x16, 0x35, 0x01, 0x00;

    8) I2C_Write: 0x34, 0x97, 0x00;                                                                  I2C_Read: 0x34, 0x17, 0x35, 0x03, 0x00;       // STAT Command or Parameter Error is true

    9) I2C_Write: 0x34, 0x88, 0x01;                                                                  I2C_Read: 0x34, 0x08, 0x35, 0x01, 0x01;

    10) I2C_Write: 0x34, 0x89, 0x01;                                                                  I2C_Read: 0x34, 0x09, 0x35, 0x01, 0x01;

    11) I2C_Write: 0x34, 0xD0, 0x11;                                                                  I2C_Read: 0x34, 0x50, 0x35, 0x03, 0x07;     // STAT Command or Parameter Error is true

    12) I2C_Write: 0x34, 0xD1, 0x80, 0x07, 0xB0, 0x04;                                    I2C_Read: 0x34, 0x51, 0x35, 0x01, 0x80, 0x07, 0xB0, 0x04;

    13) I2C_Write: 0x34, 0xD2, 0x00, 0x05, 0x20, 0x03;                                    I2C_Read: 0x34, 0x52, 0x35, 0x01, 0x00, 0x05, 0x20, 0x03;

    14) I2C_Write: 0x34, 0x86, 0x00;                                                                  I2C_Read: 0x34, 0x06, 0x35, 0x01, 0x00;

    15) I2C_Write: 0x34, 0xD7, 0x02;                                                                  I2C_Read: 0x34, 0x57, 0x35, 0x01, 0x02;

    16) I2C_Write: 0x34, 0xCB, 0x00, 0x5F, 0x00, 0x5F, 0x00, 0x00;                 I2C_Read: 0x34, 0x4B, 0x35, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00; // After write command, the GPIO26 (INIT_BUSY) goes high.

    17) I2C_Write: 0x34, 0x90, 0x00;                                                                  I2C_Read: 0x34, 0x10, 0x35, 0x01, 0x00;

    18) After about 1 second                                                                               I2C_Read: 0x34, 0x57, 0x35, 0x01, 0x00; // The data from register 57 has changed (line 15)

    19)                                                                                                                 I2C_Read: 0x34, 0x4B, 0x35, 0x01, 0x00, 0xae, 0x00, 0xC3, 0x00, 0xCF;

    The below fig. show the GPIO26 state during the command line 16.

    In addition, there is a delay of ACK signal from DLPC6401 as shown in below fig. Is it normal or abnormal.

    The fig. show the writing duration of I2C_Write 0x34, 0x83, 0x00;

    ACK for DLPC6401 address (0x34) is followed instantanues.

    ACK for register address (0x83) takes about 1.5ms delay.

    ACK for data takes about 90us delay.

  • Alex,

    Before going to further i would recommend we fix the i2c command - for this you can use simple source select command 0x00, see if it works first,

    For Write

    w 0x34 0x80 0x00
    delay 1ms
    R 35 0xXX //Just read 1-byte of data from the device and it will tell what happen to the command sent; this maps to STATUS byte

    Now for reading

    W 0x34 0x00
    delay 1ms
    R 35 0xXX 0xXX // read two bytes where 1byte is the STATUS byte and 2nd one is the register setting for register 0x00.

    If this works then we can go to the next step of loading multiple commands.

    Please note the time taken to execute varies from command to command.

    Regards,
    Sanjeev
  • Hi Sanjeev,

    I did your comments with 1ms delay.
    These are results:
    Write: 0x34, 0x80, 0x00;
    delay 1ms
    Read: 0x35, 0x00 (STAT is 0x00)
    delay 1ms
    Write: 0x34, 0x00;
    delay 1ms
    Read: 0x35, 0x00, 0x00;

    When I do with 3ms delay
    The results are
    Write: 0x34, 0x80, 0x00;
    delay 3ms
    Read: 0x35, 0x00 (STAT is 0x00)
    delay 3ms
    Write: 0x34, 0x00;
    delay 3ms
    Read: 0x35, 0x01, 0x00;

    I increase to 10ms delay
    The results change to
    Write: 0x34, 0x80, 0x00;
    delay 10ms
    Read: 0x35, 0x01 (STAT is 0x01)
    delay 10ms
    Write: 0x34, 0x00;
    delay 10ms
    Read: 0x35, 0x01, 0x00;

    Regards,
    Alex
  • Alex,

    Okay,  10ms is correct delay you are getting proper response -

    I increase to 10ms delay

    The results change to

    Write: 0x34, 0x80, 0x00;

    delay 10ms

    Read: 0x35, 0x01 (STAT is 0x01)

    delay 10ms

    Write: 0x34, 0x00;

    delay 10ms

    Read: 0x35, 0x01, 0x00;

    Now try changing the register 0x00 parameters, so write

    write:  0x34 0x80 0x01 // This should display internal test pattern

    Similarly,

    Write: 0x34 0x80 0x02 // This should display splash

    if this works then you have to use this setup mechanism to communicate with the controller.

    Please refer to DLC6401 software programmer's guide http://www.ti.com/lit/ug/dlpu012/dlpu012.pdf section 2.2.2.1 STATUS (STAT) Byte

    basically you can add logic to read one byte after any read or write command, you can interpret the value following the STATUS iff it is showing 0x01

    Regards,

    Sanjeev

  • Hi Sanjeev,

    Thank you for your advise.

    I have fix the I2C code, which rewrite or reread until the COMMAND or PARAMETER ERROR is FALSE and the SYSTEM FLAG is READY.

    However, I still have two problems.

    Firstly, several reading values are different from the writing values (line 10). It is not always this register, it happens at other register such as 0x17, 0x50.

    1) I2C_Write: 0x34, 0x83, 0x00;                                                                  I2C_Read: 0x34, 0x03, 0x35, 0x01, 0x00;

    2) I2C_Write: 0x34, 0x82, 0x00;                                                                  I2C_Read: 0x34, 0x02, 0x35, 0x01, 0x00;

    3) I2C_Write: 0x34, 0x84, 0x02;                                                                  I2C_Read: 0x34, 0x04, 0x35, 0x01, 0x02;

    4) I2C_Write: 0x34, 0x85, 0x82;                                                                  I2C_Read: 0x34, 0x05, 0x35, 0x01, 0x82; 

    5) I2C_Write: 0x34, 0x80, 0x01;                                                                  I2C_Read: 0x34, 0x00, 0x35, 0x01, 0x01;

    6) I2C_Write: 0x34, 0x8F, 0x00, 0x78;                                                        I2C_Read: 0x34, 0x0F, 0x35, 0x01, 0x00, 0x78;

    7) I2C_Write: 0x34, 0x96, 0x00;                                                                  I2C_Read: 0x34, 0x16, 0x35, 0x01, 0x00;

    8) I2C_Write: 0x34, 0x97, 0x00;                                                                  I2C_Read: 0x34, 0x17, 0x35, 0x01, 0x00; 

    9) I2C_Write: 0x34, 0x88, 0x01;                                                                  I2C_Read: 0x34, 0x08, 0x35, 0x01, 0x01;

    10) I2C_Write: 0x34, 0x89, 0x01;                                                                  I2C_Read: 0x34, 0x09, 0x35, 0x01, 0x02;

    11) I2C_Write: 0x34, 0xD0, 0x11;                                                                  I2C_Read: 0x34, 0x50, 0x35, 0x01, 0x11;

    12) I2C_Write: 0x34, 0xD1, 0x80, 0x07, 0xB0, 0x04;                                    I2C_Read: 0x34, 0x51, 0x35, 0x01, 0x80, 0x07, 0xB0, 0x04;

    13) I2C_Write: 0x34, 0xD2, 0x00, 0x05, 0x20, 0x03;                                    I2C_Read: 0x34, 0x52, 0x35, 0x01, 0x00, 0x05, 0x20, 0x03;

    14) I2C_Write: 0x34, 0x86, 0x00;                                                                  I2C_Read: 0x34, 0x06, 0x35, 0x01, 0x01;

    15) I2C_Write: 0x34, 0xD7, 0x02;                                                                  I2C_Read: 0x34, 0x57, 0x35, 0x01, 0x02;

    16) I2C_Write: 0x34, 0xCB, 0x00, 0x5F, 0x00, 0x5F, 0x00, 0x00;                 I2C_Read: 0x34, 0x4B, 0x35, 0x01, 0x00, 0xAE, 0x00, 0xC3, 0x00, 0xCF; // After write command, the GPIO26 (INIT_BUSY) goes high.

    17) I2C_Write: 0x34, 0x90, 0x00;                                                                  I2C_Read: 0x34, 0x10, 0x35, 0x01, 0x00;

                                                                                                                          I2C_Read: 0x34, 0x20, 0x35, 0x01, 0x01;   // Hardware status Byte

                                                                                                                          I2C_Read: 0x34, 0x21, 0x35, 0x01, 0x0F;   //System status Byte

                                                                                                                          I2C_Read: 0x34, 0x22, 0x35, 0x01, 0x06;   /// Main status Byte

    The second problem is the GPIO26 goes high after the register 0xCB has been written as last fig.

    I tried writing two set of values [0x00, 0x00, 0x00, 0x00, 0x00, 0x00] or [0x00, 0x5F, 0x00, 0x5F, 0x00, 0x00] to 0xCB register , and both case caused the GPIO26 going high.

    I have checked the system state as register 0x20 to 0x22 after the GPIO26 going high and low, but there is not special bit.

    Kind Regards,

    Alex

  • Alex,

    Glad that you are able to make progress. 

    Since you are mentioning still some cases the register settings not matching and are returning different value.

    I would suggest adding one more level of check for command synchronization.

    1. Before any read/write operation poll for GPIO_26 be free i.e., signal showing it is LOW

    2. Send the write/read command to DLPC6401

    3. Poll for GPIO_26 to go HIGH state, basically the DLPC6401 takes few additional ms to set the signal high to indicate the controller now executing the command. Which you are currently doing only via reading the status register. 

    5. After GPIO_26 go HIGH, you can confirm that command is being processed by the controller, you can now return.

    let me know if it helps.

    Regards,
    Sanjeev

  • Hi Sanjeev, 

    Thank you for  your advised. I had checked the GPIO26 before I2C WRITE or I2C READ command was sent.

    I have checked the SDA and SCL signals, they are normal.

    My main issue is the LED current control. I simplified the command. Only write to two register 0xCB and 0xD7.

    I2C Write                                                                        STAT CHECK/I2C Read

    0x34, 0xD7, 0x02;                                                           0x35, 0x01;                      

    0x34, 0x57;                                                                     0x35, 0x01, 0x02;

    0x34, 0xCB, 0x00, 0x5F, 0x00, 0x7F, 0x00, 0x00;         0x35, 0x01;

    0x34, 0x4B;                                                                    0x35, 0x01, 0x00, 0x5F, 0x00, 0x7F, 0x00, 0x00;

    Everything is good now, but after ONE SECCOND.

    0x34, 0x57;                                                                    0x35, 0x01, 0x00;

    0x34, 0x4B;                                                                   0x35, 0x01, 0x00, 0xAE, 0x00, 0xC3, 0x00, 0xCF;

    I haven't written to any other register since the DLPC601 is ON.

    Why does value onthe register 0x57 change?

    Even both WRITING or READING value of register 0x57 is disable the CCI, which mean the WPC is diable too. Why did the data on the register 0x4B change?

    Kind Regards,

    Alex

  • Alex,
    Are you planning to use CCI Control function in the system? www.ti.com/.../dlpu012.pdf refer CCI Control (I2C: 57h)
    To use this you have to install sensor hardware in the system.

    Also in your code, are you calling Register[0x57] with BIT0 set anytime?

    Because you are calling CCI in current adjust mode it is going through the CCI functionality and changing the current settings. Which is causing the problem here.

    If you don't intended to use CCI then don't call 0x57 or you can experiment with Write Reg[0x57] = 0x00.

    Regards,
    Sanjeev
  • Hi Sanjeev,

    Thank you for your support.

    The LED currents are controlled now. The ICC was not called during any more.

    Kind Regards,
    Alex
  • Hi Alex,
    You are welcome.
    Regards,
    Sanjeev