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.

Linux/LP55231: LP55231 linux device driver issue

Part Number: LP55231
Other Parts Discussed in Thread: LP5523, TIDA-00757

Tool/software: Linux

Hi Ti Support Team :

I am trying to integrate the LP55231 linux device driver with our MIPS based board running openwrt. I try to load firmware i see the following error.

[    5.760000] lp5523x 0-0032: no platform data

[    5.770000] lp5523x: probe of 0-0032 failed with error -22

  •  ls -l ./sys/bus/i2c/drivers/lp5523x

--w------- 1 root root 4096 Mar 30 11:23 bind
--w------- 1 root root 4096 Mar 30 11:23 uevent
--w------- 1 root root 4096 Mar 30 11:23 unbind

  • ls -l ./proc/device-tree/ssx4@16000000/i2c@a00000/lp55231@32

dr-xr-xr-x 2 root root 0 Mar 30 12:07 chan0
dr-xr-xr-x 2 root root 0 Mar 30 12:07 chan1
dr-xr-xr-x 2 root root 0 Mar 30 12:07 chan2
dr-xr-xr-x 2 root root 0 Mar 30 12:07 chan3
dr-xr-xr-x 2 root root 0 Mar 30 12:07 chan4
dr-xr-xr-x 2 root root 0 Mar 30 12:07 chan5
dr-xr-xr-x 2 root root 0 Mar 30 12:07 chan6
dr-xr-xr-x 2 root root 0 Mar 30 12:07 chan7
-r--r--r-- 1 root root 1 Mar 30 12:07 clock-mode
-r--r--r-- 1 root root 11 Mar 30 12:07 compatible
-r--r--r-- 1 root root 8 Mar 30 12:07 name
-r--r--r-- 1 root root 4 Mar 30 12:07 reg

Best Regards!

Eathen Lee

  • Hi, Eathen,

    Sorry for the delay for the resonse.

    We'll take a look about this error.

    By the way, do you solve the problem yet?

    Thanks.
    Regards,
    Kenneth
  • Hi Kenneth :
    Thanks for your reply and help ,

    The problem is not solved.

    Thanks!
    Eathen
  • Hi Eathen,

       I am sorry we have no linux expert who can help you on this, would you try to copy the context to your exiting driver and generate the LP5523 linux for your system?

    Any more support please let me know, thanks!

    Summer

  • Hi Summer :
    we try to use I2C tools R/W i2c register as below , please help check it . Thanks!

    # ./i2cdetect -y -r 0
    0 1 2 3 4 5 6 7 8 9 a b c d e f
    00: -- -- -- -- -- -- -- -- -- -- -- -- --
    10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    30: -- -- 32 33 34 -- -- -- -- -- -- -- -- -- -- --
    40: UU -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
    50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    60: -- -- UU -- -- -- -- -- -- -- -- -- -- -- -- --
    70: -- -- -- -- -- -- -- --

    # ./i2cdump -f -y 0 0x18
    No size specified (using byte-data access)
    0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
    00: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
    10: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
    20: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
    30: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
    40: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
    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 XX XX XX XX XX XX XXXXXXXXXXXXXXXX
  • Hi Summer :
    we try to use I2C tools dump i2c register as below , please help check it and how to write register to turn on leds . Thanks!

    # ./i2cdump -f -y 0 0x32
    No size specified (using byte-data access)
    0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
    00: 00 00 00 00 01 ff 00 00 00 00 00 00 00 00 00 00 ....?...........
    10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    20: 00 00 00 00 00 00 af af af af af af af af af 00 ......?????????.
    30: 00 00 00 00 00 00 40 00 00 00 68 00 00 00 00 19 ......@...h....?
    40: 00 00 00 03 48 00 00 00 00 00 00 00 00 10 20 00 ...?H........? .
    50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    80: 00 06 00 00 00 00 10 00 00 00 00 00 00 00 00 00 .?....?.........
    90: 77 5b 46 b0 44 1f e8 01 00 00 00 00 00 00 00 00 w[F?D???........
    a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

    # ./i2cdump -f -y 0 0x33
    No size specified (using byte-data access)
    0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
    00: 00 00 00 00 01 ff 00 00 00 00 00 00 00 00 00 00 ....?...........
    10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    20: 00 00 00 00 00 00 af af af af af af af af af 00 ......?????????.
    30: 00 00 00 00 00 00 40 00 00 00 68 00 00 00 00 19 ......@...h....?
    40: 00 00 00 03 48 00 00 00 00 00 00 00 00 10 20 00 ...?H........? .
    50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    80: 00 06 00 00 00 00 10 00 00 00 00 00 00 00 00 00 .?....?.........
    90: 78 5a 47 b1 44 1f f1 01 00 00 00 00 00 00 00 00 xZG?D???........
    a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

    # ./i2cdump -f -y 0 0x34
    No size specified (using byte-data access)
    0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
    00: 00 00 00 00 01 ff 00 00 00 00 00 00 00 00 00 00 ....?...........
    10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    20: 00 00 00 00 00 00 af af af af af af af af af 00 ......?????????.
    30: 00 00 00 00 00 00 40 00 00 00 68 00 00 00 00 19 ......@...h....?
    40: 00 00 00 03 48 00 00 00 00 00 00 00 00 10 20 00 ...?H........? .
    50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    80: 00 06 00 00 00 00 10 00 00 00 00 00 00 00 00 00 .?....?.........
    90: 77 5f 45 b1 42 1f eb 01 00 00 00 00 00 00 00 00 w_E?B???........
    a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
  • Hi Summer :
    can you provide the register value to turn on led1, led2, ........ led8,led9 . we can use the i2cset command write register value to test LED.
    Thanks!
  • Hi Eathen,

        Please refer the below code to turn on LED, thanks!

    void SendData_2(unsigned char Chip_ADD,unsigned char *current)// unsigned char *pwm,unsigned char *exp,unsigned char *currenty
    {    int i,j;
           MAP_I2C_setSlaveAddress(EUSCI_B1_BASE, Chip_ADD);

           MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, LP55231_REG_RESET);  //send register address
           MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,LP55231_RESET); // send register data

    4263.i2c_master_w_multibyte-master_code.c
    /* --COPYRIGHT--,BSD
     * Copyright (c) 2017, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     * --/COPYRIGHT--*/
    /*******************************************************************************
     *  MSP432 I2C - EUSCI_B0_BASE I2C Master TX multiple bytes to MSP432 Slave
     *
     *  Description: This demo connects two MSP432 's via the I2C bus. The master
     *  transmits to the slave. This is the MASTER CODE. It continuously
     *  transmits an array of data and demonstrates how to implement an I2C
     *  master transmitter sending multiple bytes using the USCI_B0 TX interrupt.
     *  ACLK = n/a, MCLK = HSMCLK = SMCLK = BRCLK = default DCO = ~3.0MHz
     *
     *                                /|\  /|\
     *                MSP432P401      10k  10k      MSP432P401
     *                   slave         |    |         master
     *             -----------------   |    |   -----------------
     *            |     P1.6/UCB0SDA|<-|----+->|P1.6/UCB0SDA     |
     *            |                 |  |       |                 |
     *            |                 |  |       |                 |
     *            |     P1.7/UCB0SCL|<-+------>|P1.7/UCB0SCL     |
     *            |                 |          |                 |
     *
     ******************************************************************************/
    /* DriverLib Includes */
    #include <ti/devices/msp432p4xx/driverlib/driverlib.h>
    
    /* Standard Includes */
    #include <stdint.h>
    #include <stdbool.h>
    
    /* Slave Address for I2C Slave */
    #define SLAVE_ADDRESS1 0x40
    #define SLAVE_ADDRESS2 0x33
    #define SLAVE_ADDRESS3 0x34
    #define SLAVE_ADDRESS4 0x35
    /* TIDA-00757 Board specific LEDs */
    #define TIDA00757_D1    1
    #define TIDA00757_D2    2
    #define TIDA00757_D3    3
    #define TIDA00757_D4    4
    #define TIDA00757_D5    5
    #define TIDA00757_D6    6
    #define TIDA00757_ALL   7
    
    /* Colors */
    #define COLOR_OFF       0
    #define COLOR_BLUE      1
    #define COLOR_GREEN     2
    #define COLOR_SKYBLUE   3
    #define COLOR_RED       4
    #define COLOR_PURPLE    5
    #define COLOR_YELLOW    6
    #define COLOR_WHITE     7
    
    /* Address */
    #define LP55231_DEVICE1_ADDR            0x32
    #define LP55231_DEVICE2_ADDR            0x33
    
    /* Registers */
    #define LP55231_REG_ENABLE              0x00
    #define LP55231_REG_OUTPUT_CTRL_MSB     0x04
    #define LP55231_REG_OUTPUT_CTRL_LSB     0x05
    #define LP55231_REG_D1_CTRL             0x06
    #define LP55231_REG_D2_CTRL             0x07
    #define LP55231_REG_D3_CTRL             0x08
    #define LP55231_REG_D4_CTRL             0x09
    #define LP55231_REG_D5_CTRL             0x0A
    #define LP55231_REG_D6_CTRL             0x0B
    #define LP55231_REG_D7_CTRL             0x0C
    #define LP55231_REG_D8_CTRL             0x0D
    #define LP55231_REG_D9_CTRL             0x0E
    #define LP55231_REG_D1_PWM              0x16
    #define LP55231_REG_D2_PWM              0x17
    #define LP55231_REG_D3_PWM              0x18
    #define LP55231_REG_D4_PWM              0x19
    #define LP55231_REG_D5_PWM              0x1A
    #define LP55231_REG_D6_PWM              0x1B
    #define LP55231_REG_D7_PWM              0x1C
    #define LP55231_REG_D8_PWM              0x1D
    #define LP55231_REG_D9_PWM              0x1E
    #define LP55231_REG_D1_CURRENT_CTRL     0x26
    #define LP55231_REG_D2_CURRENT_CTRL     0x27
    #define LP55231_REG_D3_CURRENT_CTRL     0x28
    #define LP55231_REG_D4_CURRENT_CTRL     0x29
    #define LP55231_REG_D5_CURRENT_CTRL     0x2A
    #define LP55231_REG_D6_CURRENT_CTRL     0x2B
    #define LP55231_REG_D7_CURRENT_CTRL     0x2C
    #define LP55231_REG_D8_CURRENT_CTRL     0x2D
    #define LP55231_REG_D9_CURRENT_CTRL     0x2E
    #define LP55231_REG_MISC                0x36
    #define LP55231_REG_STATUS              0x3A
    #define LP55231_REG_RESET               0x3D
    #define LP55231_REG_MASTER_FADER1       0x48
    #define LP55231_REG_MASTER_FADER2       0x49
    #define LP55231_REG_MASTER_FADER3       0x4A
    
    /* Bit description in registers */
    #define LP55231_ENABLE                  0x40
    #define LP55231_DISABLE                 0x00
    #define LP55231_PWR_SAVE                0x20
    #define LP55231_PWM_PWR_SAVE            0x04
    #define LP55231_CP_AUTO                 0x18
    #define LP55231_CP_1x                   0x08
    #define LP55231_AUTO_CLK                0x02
    
    #define LP55231_RESET                   0xFF
    #define LP55231_FADER_MAPPING_MASK      0xC0
    #define LP55231_FADER_MAPPING_SHIFT     6
    
    
    /*****************************************************************************
    * GLOBAL FUNCTIONS
    */
    /* Statics */
    const eUSCI_I2C_MasterConfig i2cConfig =
    {
            EUSCI_B_I2C_CLOCKSOURCE_SMCLK,          // SMCLK Clock Source
            3000000,                                // SMCLK = 3MHz
            EUSCI_B_I2C_SET_DATA_RATE_400KBPS,      // Desired I2C Clock of 400khz
            0,                                      // No byte counter threshold
            EUSCI_B_I2C_NO_AUTO_STOP                // No Autostop
    };
    
    unsigned char exp[]={0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08};
    unsigned char current[]={0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f};
    unsigned char pwm[]={0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef};
    unsigned char pwm_0[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
    
    
    
    
    
    void SendData_1(unsigned char Chip_ADD,unsigned char *pwm,unsigned char *exp,unsigned char *current)// unsigned char *pwm,unsigned char *exp,unsigned char *currenty
    {    int i;
           MAP_I2C_setSlaveAddress(EUSCI_B1_BASE, Chip_ADD);
    
           MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x00);  //send register address
           MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0x00); // send register data
           __delay_cycles(50000); //6/25M=240ns
           MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x00);  //send register address
           MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0x40); // send register data
    
           MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x2f);  //send register address
           MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0x48); // send register data
    
           MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x07);  //send register address
           for(i=0;i<9;i++)
           {MAP_I2C_masterSendMultiByteNext(EUSCI_B1_BASE,exp[i]);} // send register data
          // MAP_I2C_masterSendMultiByteStop(EUSCI_B1_BASE);
    
           MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x22);  //send register address
           for(i=0;i<9;i++)
              {MAP_I2C_masterSendMultiByteNext(EUSCI_B1_BASE,current[i]);} // send register data
          // MAP_I2C_masterSendMultiByteStop(EUSCI_B1_BASE);
    
         MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x16);  //send register address
           for(i=0;i<9;i++)
              {MAP_I2C_masterSendMultiByteNext(EUSCI_B1_BASE,pwm[i]);} // send register data
          // MAP_I2C_masterSendMultiByteStop(EUSCI_B1_BASE);
    
        }
    void SendData_2(unsigned char Chip_ADD,unsigned char *current)// unsigned char *pwm,unsigned char *exp,unsigned char *currenty
    {    int i,j;
           MAP_I2C_setSlaveAddress(EUSCI_B1_BASE, Chip_ADD);
    
           MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, LP55231_REG_RESET);  //send register address
           MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,LP55231_RESET); // send register data
           __delay_cycles(50000); //6/25M=240ns
           MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, LP55231_REG_MISC);  //send register address
           MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,LP55231_CP_1x | LP55231_AUTO_CLK | LP55231_PWR_SAVE); // send register data
           //MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0x28); // send register data
    
           MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, LP55231_REG_OUTPUT_CTRL_MSB);  //send register address
                         MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0x01); // send register data
                         MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, LP55231_REG_OUTPUT_CTRL_LSB);  //send register address
                                MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0xFF); // send register data
    
    
           MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, LP55231_REG_ENABLE);  //send register address
           MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,LP55231_ENABLE); // send register data
           __delay_cycles(50000); //6/25M=240ns
    
    
           MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x22);  //send register address
           for(i=0;i<9;i++)
              {MAP_I2C_masterSendMultiByteNext(EUSCI_B1_BASE,current[i]);} // send register data
           MAP_I2C_masterSendMultiByteStop(EUSCI_B1_BASE);
           MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x16);  //send register address
                  MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0x0f); // send register data
                  MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x17);  //send register address
                 MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0xff); // send register data
                 MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x18);  //send register address
                 MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0xff); // send register data
                 MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x19);  //send register address
                 MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0xff); // send register data
                 MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x1A);  //send register address
                 MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0xff); // send register data
                 MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x1B);  //send register address
                 MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0xff); // send register data
                 MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x1c);  //send register address
                 MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0xff); // send register data
                 MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x1d);  //send register address
                 MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0xff); // send register data
                 MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x1f);  //send register address
                 MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0xff); // send register data
              //for(j=0;j<10000;j++)
              //{ __delay_cycles(1500); //25M=240ns
              //MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, LP55231_REG_RESET);  //send register address
                     //MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,LP55231_RESET); // send register data
             // MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x16);  //send register address
                           // MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0x0f); // send register data
                            //MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x1d);  //send register address
                            //MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0x00); // send register data
                            //__delay_cycles(15000); //25M=240ns
                            //MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, LP55231_REG_RESET);  //send register address
                                   //MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,LP55231_RESET); // send register data
                                      //MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x16);  //send register address
                                                    //MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0x00); // send register data
                                                    //MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x1d);  //send register address
                                                    //MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0xff); // send register data
              //}
           MAP_I2C_masterSendMultiByteStop(EUSCI_B1_BASE);
    
        }
    
    
    
    //![Simple I2C Config]
    /* I2C Master Configuration Parameter */
    //![Simple I2C Config]
    int main(void)
    {
        volatile uint32_t ii;
         int size;
        /* Disabling the Watchdog */
        MAP_WDT_A_holdTimer();
        MAP_CS_initClockSignal(CS_ACLK,CS_LFXTCLK_SELECT, CS_CLOCK_DIVIDER_1);
       GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P4,GPIO_PIN2,GPIO_PRIMARY_MODULE_FUNCTION);
        /* Select Port 6 for I2C - Set Pin 4, 5 to input Primary Module Function,
         *   (UCB1SIMO/UCB1SDA, UCB1SOMI/UCB1SCL).     */
        MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P6,
                GPIO_PIN5|GPIO_PIN4, GPIO_PRIMARY_MODULE_FUNCTION);
        GPIO_setAsOutputPin(GPIO_PORT_P5, GPIO_PIN6);
    
        //![Simple I2C Example]
        /* Initializing I2C Master to SMCLK at 400kbs with no autostop */
        MAP_I2C_initMaster(EUSCI_B1_BASE, &i2cConfig);
        /* Set Master in transmit mode */
        MAP_I2C_setMode(EUSCI_B1_BASE, EUSCI_B_I2C_TRANSMIT_MODE);
        /* Enable I2C Module to start operations */
        MAP_I2C_enableModule(EUSCI_B1_BASE);
        GPIO_setOutputLowOnPin(GPIO_PORT_P5, GPIO_PIN6); //PWM PIN
        __delay_cycles(6); //6/25M=240ns
        GPIO_setOutputHighOnPin(GPIO_PORT_P5, GPIO_PIN6);
        //size=sizeof(table)/sizeof(table[0]);
        //size=size/2;
    
        SendData_2(0x32,current);
    
        //load_SRAM(0x40);
       // SendData(0x40,table,size);
        while (1)
        {
            /* Delay between Transmissions */
           // for (ii = 0; ii < 4000; ii++);
           /* Making sure the last transaction has been completely sent out */
            while (MAP_I2C_masterIsStopSent(EUSCI_B1_BASE) == EUSCI_B_I2C_SENDING_STOP);
        }
    }
    
    /*******************************************************************************
     * The USCIAB0TX_ISR is structured such that it can be used to transmit any
     * number of bytes by pre-loading TXByteCtr with the byte count. Also, TXData
     * points to the next byte to transmit.
     ******************************************************************************/
    void EUSCIB2_IRQHandler(void)
    {
        uint_fast16_t status;
    
        status = MAP_I2C_getEnabledInterruptStatus(EUSCI_B1_BASE);
        MAP_I2C_clearInterruptFlag(EUSCI_B1_BASE, status);
    
        if (status & EUSCI_B_I2C_NAK_INTERRUPT)
        {
            MAP_I2C_masterSendStart(EUSCI_B1_BASE);
        }
    
        //if (status & EUSCI_B_I2C_TRANSMIT_INTERRUPT0)
        //{
       // }
    }
    

           __delay_cycles(50000); //6/25M=240ns
           MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, LP55231_REG_MISC);  //send register address
           MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,LP55231_CP_1x | LP55231_AUTO_CLK | LP55231_PWR_SAVE); // send register data
           //MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0x28); // send register data

           MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, LP55231_REG_OUTPUT_CTRL_MSB);  //send register address
                         MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0x01); // send register data
                         MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, LP55231_REG_OUTPUT_CTRL_LSB);  //send register address
                                MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0xFF); // send register data


           MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, LP55231_REG_ENABLE);  //send register address
           MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,LP55231_ENABLE); // send register data
           __delay_cycles(50000); //6/25M=240ns


           MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x22);  //send register address
           for(i=0;i<9;i++)
              {MAP_I2C_masterSendMultiByteNext(EUSCI_B1_BASE,current[i]);} // send register data
           MAP_I2C_masterSendMultiByteStop(EUSCI_B1_BASE);
           MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x16);  //send register address
                  MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0x0f); // send register data
                  MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x17);  //send register address
                 MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0xff); // send register data
                 MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x18);  //send register address
                 MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0xff); // send register data
                 MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x19);  //send register address
                 MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0xff); // send register data
                 MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x1A);  //send register address
                 MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0xff); // send register data
                 MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x1B);  //send register address
                 MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0xff); // send register data
                 MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x1c);  //send register address
                 MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0xff); // send register data
                 MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x1d);  //send register address
                 MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0xff); // send register data
                 MAP_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, 0x1f);  //send register address
                 MAP_I2C_masterSendMultiByteFinish(EUSCI_B1_BASE,0xff); // send register data

    unsigned char exp[]={0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08};
    unsigned char current[]={0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f};
    unsigned char pwm[]={0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef};
    unsigned char pwm_0[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

    /* Slave Address for I2C Slave */
    #define SLAVE_ADDRESS1 0x40
    #define SLAVE_ADDRESS2 0x33
    #define SLAVE_ADDRESS3 0x34
    #define SLAVE_ADDRESS4 0x35
    /* TIDA-00757 Board specific LEDs */
    #define TIDA00757_D1    1
    #define TIDA00757_D2    2
    #define TIDA00757_D3    3
    #define TIDA00757_D4    4
    #define TIDA00757_D5    5
    #define TIDA00757_D6    6
    #define TIDA00757_ALL   7

    /* Colors */
    #define COLOR_OFF       0
    #define COLOR_BLUE      1
    #define COLOR_GREEN     2
    #define COLOR_SKYBLUE   3
    #define COLOR_RED       4
    #define COLOR_PURPLE    5
    #define COLOR_YELLOW    6
    #define COLOR_WHITE     7

    /* Address */
    #define LP55231_DEVICE1_ADDR            0x32
    #define LP55231_DEVICE2_ADDR            0x33

    /* Registers */
    #define LP55231_REG_ENABLE              0x00
    #define LP55231_REG_OUTPUT_CTRL_MSB     0x04
    #define LP55231_REG_OUTPUT_CTRL_LSB     0x05
    #define LP55231_REG_D1_CTRL             0x06
    #define LP55231_REG_D2_CTRL             0x07
    #define LP55231_REG_D3_CTRL             0x08
    #define LP55231_REG_D4_CTRL             0x09
    #define LP55231_REG_D5_CTRL             0x0A
    #define LP55231_REG_D6_CTRL             0x0B
    #define LP55231_REG_D7_CTRL             0x0C
    #define LP55231_REG_D8_CTRL             0x0D
    #define LP55231_REG_D9_CTRL             0x0E
    #define LP55231_REG_D1_PWM              0x16
    #define LP55231_REG_D2_PWM              0x17
    #define LP55231_REG_D3_PWM              0x18
    #define LP55231_REG_D4_PWM              0x19
    #define LP55231_REG_D5_PWM              0x1A
    #define LP55231_REG_D6_PWM              0x1B
    #define LP55231_REG_D7_PWM              0x1C
    #define LP55231_REG_D8_PWM              0x1D
    #define LP55231_REG_D9_PWM              0x1E
    #define LP55231_REG_D1_CURRENT_CTRL     0x26
    #define LP55231_REG_D2_CURRENT_CTRL     0x27
    #define LP55231_REG_D3_CURRENT_CTRL     0x28
    #define LP55231_REG_D4_CURRENT_CTRL     0x29
    #define LP55231_REG_D5_CURRENT_CTRL     0x2A
    #define LP55231_REG_D6_CURRENT_CTRL     0x2B
    #define LP55231_REG_D7_CURRENT_CTRL     0x2C
    #define LP55231_REG_D8_CURRENT_CTRL     0x2D
    #define LP55231_REG_D9_CURRENT_CTRL     0x2E
    #define LP55231_REG_MISC                0x36
    #define LP55231_REG_STATUS              0x3A
    #define LP55231_REG_RESET               0x3D
    #define LP55231_REG_MASTER_FADER1       0x48
    #define LP55231_REG_MASTER_FADER2       0x49
    #define LP55231_REG_MASTER_FADER3       0x4A

    /* Bit description in registers */
    #define LP55231_ENABLE                  0x40
    #define LP55231_DISABLE                 0x00
    #define LP55231_PWR_SAVE                0x20
    #define LP55231_PWM_PWR_SAVE            0x04
    #define LP55231_CP_AUTO                 0x18
    #define LP55231_CP_1x                   0x08
    #define LP55231_AUTO_CLK                0x02

    #define LP55231_RESET                   0xFF
    #define LP55231_FADER_MAPPING_MASK      0xC0
    #define LP55231_FADER_MAPPING_SHIFT     6

  • Hi Eathen,

    I'll close this thread due to inactivity.

    You can reply to this thread directly if you have more questions and it will open again.

    If you think this helps, please click "Resolve".

    Thanks.
    Regards,
    Kenneth
  • Hi Kenneth :

    We can communicate LP55231 through I2C test tool command(ex. i2cdump) but currently LP55231 driver can’t properly initialized during Linux kernel bring up.
    So we’d like to know how to initialized LP55231 manually, please advise the corresponding registers so we can perform manually by the i2c-tools command.
    Thank you very much for your understanding.

    example :

    Usage: i2cset [-f] [-y] [-m MASK] [-r] [-a] I2CBUS CHIP-ADDRESS DATA-ADDRESS [VALUE] ... [MODE]

    #. /i2cset -f -y 0 0x32 0x00 0x40
    # ./i2cdump -f -y 0 0x32 
    No size specified (using byte-data access)
    0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
    00: 40 00 00 00 01 ff 00 00 00 00 00 00 00 00 00 00 @...?...........
    10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    20: 00 00 00 00 00 00 af af af af af af af af af 00 ......?????????.
    30: 00 00 00 00 00 00 40 00 00 00 48 00 00 00 00 19 ......@...H....?
    40: 00 00 00 03 48 00 00 00 00 00 00 00 00 10 20 00 ...?H........? .
    50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    80: 00 06 00 00 00 00 10 00 00 00 00 00 00 00 00 00 .?....?.........
    90: 77 5d 45 ad 43 1f e3 0d 00 00 00 00 00 00 00 00 w]E?C???........
    a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

    Best Regards!

    Eathen

  • Hi, Eathen,

    Please send Reset Register (3DH) with FFH to make the device enter RESET mode as datasheet 7.4.1 says.

    Thanks.
    Regards,
    Kenneth
  • Hi Kenneth :
    we try to write below ADDRESS VALUE for Led test not work . can you help provide the turn on LED D1 example ADDRESS VALUE ?
    Write I2C[32] 00 - 40
    Write I2C[32] 36 - 01
    Write I2C[32] 3B - 00
    Write I2C[32] 05 - 01
    Write I2C[32] 16 - 80
    Write I2C[32] 26 - AF

    Best regards
    Eathen Lee
  • Hi, Eathen,

    Please modify your code as following:
    Write I2C[32] 00 - 40
    Write I2C[32] 3D - FF
    Write I2C[32] 36 - 1A - Need to enable charge pump
    Write I2C[32] 05 - 01
    Write I2C[32] 16 - 80

    This should work.

    Please let me know if this solves your problem.
    Thanks.
    Regards,
    Kenneth
  • Hi Kenneth :
    yes, Thanks!
    but we need LP55231 linux device driver with our MIPS based board running openwrt . i try to load firmware i see the following error.
    [ 5.760000] lp5523x 0-0032: no platform data
    [ 5.770000] lp5523x: probe of 0-0032 failed with error -22

    Best Regards!
    Eathen Lee.
  • Hi, Eathen,

    Glad to hear it works.

    To be honest, we don't have experts on Linux that can understand the error.

    I think this maybe a problem by transplanting the code to your platform. You can search the error code's meaning(error -22) for your platform.

    Since you can use the code to light on the LED, can you generate a the driver project from your side and use the linux driver for reference? 

    Sorry again and thanks for your understanding.

    Regards,

    Kenneth

  • Hi Kenneth :
    Thanks for your help.
    one more question :
    current we can turn on LED D1 blue light , can you also provide D1 RED/GREEN light ADDRESS VALUE ?

    Best Regards!
    Eathen
  • Hi, Eathen,

    I get that you are using  an RGB LED as your D1.

    If using former code turns on your blue channel, the other two channels should be like following:

    So using the following code should turn on all your 3 channels in D1:

    Write I2C[32] 05 - 07

    If you use other channels to control your RED/GREEN, you can adjust the value based on the above table.

    Please let me know if this solves your problem.
    Thanks.
    Regards,
    Kenneth

  • Hi Kenneth :
    Thanks for your help , close it .
    Best Regards!
    Eathen
  • Hi Eathen,

        I see you already solve this issue in another thread, then I will close this one, if you have the further requestion, please contact us free, thanks!

    Summer