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.

LP5861T: LP5861T initialization

Part Number: LP5861T
Other Parts Discussed in Thread: LP5861

Tool/software:

Hello,

I'm trying to interface LP5861T with a USB-I2C bridge chip (MCP2221), but it seems something is wrong with the initialization sequence, can someone have a look at the following source code and let me know if the  initialization function is ok?

// Write a single byte to LP5861T register
void LP5861_Write(uint8_t i2cTargetAddress, uint16_t startRegAddress, uint8_t data)
{
uint8_t payload[2] = {0};

i2cTargetAddress = (i2cTargetAddress << 2) | ((uint8_t) (startRegAddress >> 8)); //get the highest 2 bits of the startRegAddress to construct the i2c slave address with the 5 bits device address
payload[0] = (uint8_t) startRegAddress; //get the lower 8 bits of the startRegAddress
payload[1] = data; //data to send
qDebug() << Qt::hex << i2cTargetAddress << Qt::hex << payload[0] << Qt::hex << payload[1];
flag = Mcp2221_I2cWrite(handle, 2, i2cTargetAddress, I2cAddr7bit, payload);
}

// Initialize LP5861 device
void LP5861_init()//(uint8_t i2cTargetAddress, uint16_t startRegAddress)
{
// GP0 - VSYNC signal, only with data refresh modes 2 and 3
//OutValues[0] = MCP2221_GPVAL_HIGH; //set GP0 (output high) - VSYNC pin
//Mcp2221_SetGpioValues(handle, OutValues); //now set the DIO pins values


LP5861_Write(I2C_TARGET_ADDRESS_INDEPENDENT, reset_reg, 0xff); // Reset device
QThread::usleep(500); //wait for t_por (max 500us) to enter normal mode

LP5861_Write(I2C_TARGET_ADDRESS_INDEPENDENT, chip_en_reg, 0x01); // Enable device
QThread::usleep(150); //wait for t_chip_en (max 100us) to enter normal mode

/* initialize device */
LP5861_Write(I2C_TARGET_ADDRESS_INDEPENDENT, dev_initial, 0x00); // Data refresh mode = Mode_1, PWM frequency = 125 KHz (no VSYNC required for Mode_1)
LP5861_Write(I2C_TARGET_ADDRESS_INDEPENDENT, dev_config1, 0x00); // Linear dimming scale, PWM phase shift off
LP5861_Write(I2C_TARGET_ADDRESS_INDEPENDENT, dev_config2, 0x00); // Low brightness compensation clock shift number setting for all groups (1,2,3) is off
LP5861_Write(I2C_TARGET_ADDRESS_INDEPENDENT, dev_config3, 0x0E); // Maximum current 125 mA
}

// set current for all channels (0-255) via dc0-dc17 registers
void LP5861_SetCurrentAll(uint8_t CurrentValue)
{
for(i = 0; i <= 17; i++)
{
LP5861_Write(I2C_TARGET_ADDRESS_INDEPENDENT, dcReg[i], CurrentValue);
}
}

Thanks,

Karim

  • Hi Karim,

    Thank you for reaching out.

    I'm still reviewing the code. I'm wondering what the problem is? the I2C communication NACK or the LEDs does not turned on?

    If the I2C communication NACK. please share us the I2C waveform for analysis.

    If you want to turn on the LEDs. You need to write some data into resigter 200h~223h since the default value if 00h so PWM is off.

     

    BR,

    Leon

  • Hi Leon,

    Thank you for the response, really appreciate it. The LEDs turned on fine once the PWM registers were set before setting DC registers.
    Now another problem came up, the channels only sink half of the amount of current set in "Dev_Config3" register, so if channel is set to 125 mA, it only sinks 62.5 mA. I tested that with multiple current settings and outcome is always the same. Any clue why that would happen?

    Cheers,
    Karim

  • Hi Karim,

    The LP5861T device is able to adjust the output current of three color groups separately. For each color, the device has 7-bits data in 'CC_Group1', 'CC_Group2', and 'CC_Group3'. And the default setup is 50%. So it only sinks half of 125mA.

    BTW, to better support this project, can you share us what the end equipment is and project schedule? we can move to email to discuss this: leon-he@ti.com, Thanks!

    BRs,

    Leon He

  • Hi Leon,

    Thanks for the further information on the "CC_GroupX" registers, now everything works perfectly. 
    I will reach out to you via email for further questions I have.

    Cheers,
    Karim