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.

LM8330: Linux driver

Part Number: LM8330


Tool/software:

Hi,

I'm trying to use the lm8330 to have a keypad (6x6) and set the other pins as standard GPIO.
The keypad part works. The GPIOs are not working.

Here is the overall config of the lm8330 :


    lm8330_write8(lm8330, LM8330_CLKEN_REG, (uint8_t)(0x01));
    lm8330_write8(lm8330, LM8330_KBDSETTLE_REG, active_time);
    lm8330_write8(lm8330, LM8330_KBDBOUNCE_REG, debounce_time);
    lm8330_write8(lm8330, LM8330_KBDSIZE_REG, ((keypad_rows<<4) | keypad_columns));
    lm8330_write16(lm8330, LM8330_KBDDEDCFG_REG, keypad_selector);
    lm8330_write8(lm8330, LM8330_IOCGF_REG, (uint8_t)(0x10));
    lm8330_write8(lm8330, LM8330_KBDIC_REG, (uint8_t)(0x83));
    lm8330_write8(lm8330, LM8330_KBDMSK_REG, (uint8_t)(0x03));
    lm8330_write8(lm8330, LM8330_RSTINTCLR_REG, (uint8_t)(0x1));
    lm8330_write8(lm8330, LM8330_CLKMODE_REG, (uint8_t)(0x1));

This is the config of the GPIOs. I'm trying to configure KPY9 as output :

    lm8330_write8(lm8330, LM8330_GPIOOME2_REG, (uint8_t)(0x0));
    lm8330_write8(lm8330, LM8330_GPIODIR2_REG, (uint8_t)(0x4));

And the command to change state :
    lm8330_write16(lm8330, LM8330_GPIOPDATA2_REG, (gpio_state) ? 0x404 : 0x400);

What i've forgotten ? Is it possible to have Linux driver or example about this part ?

Best regards,
Jerome

  • Hi, Jerome,

    For your GPIOPDIR2 register configuration, you're setting 0x4, it seems to indicate KPY10.

    No complete source code in your thread, it's just my guess according to code pieces here.  

    Regards,

    Yonghua

  • Hi,

    Yes it was a mistake, but it didn't solve my issue.

    Normally, according to the doc, the component works by priority.

    1) KBDSIZE is fixed at 0x66 (for a 6x6 keyboard)
    2) KBDDEDCFG to 0xFF to use all pins in keypad or GPIO function
    3) IOCFG at 0x0 to stay on the main function
    4) - GPIODIR at 0x2 for output on KPY9
    - GPIOME at 0x0 because we are on an output 
    - GPIOMS is ignored 
    - IOPC at 0x0 because I don't have any pull resistors
    I don't know if there is something missing to configure besides these registers, but impossible to make an LED flash


    Regards,
    Jerome

  • Hi Jerome,

    The team is still looking into this and will respond here with an update soon. Thank you for your patience.

    Regards,

    Jack 

  • Hi, 
    The problem is finally resolved, it was a bad configuration of the KBDDEDCFG register as well as a binary offset on the GPIOPDATA register.
    Thank you for your help.
    Regards,
    Jerome