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.

TDA4VM: GPIO output value always 0

Part Number: TDA4VM
Other Parts Discussed in Thread: DRA829,

Hi TI,

I test the gpio output on our custom board, but I found the gpio value cannot be changed, I have double checked my dts configuration of gpio, and I think it's correct, below are my dts configuration and the the test of gpio with sysfs. And I found the same issue on EVM, please help. thanks

test command:

k3-j721e-common-proc-board.dts:

k3-j721e-main.dts:

   

BR

  • Hi,

    Can you try with PIN_INPUT instead of PIN_OUTPUT.

    For example we have a working GPIO mux;

            sw11_button_pins_default: sw11-button-pins-default {
                    pinctrl-single,pins = <
                            J721E_WKUP_IOPAD(0xcc, PIN_INPUT, 7) /* (G28) WKUP_GPIO0_7 */
                    >;
            };
    

    Let me know if that help you. If no further questions please click on verify answer.

    Best Regards,
    Keerthy

  • Hi Keerthy,

    issue persist, it performs the same, do you get any further suggestion? and we have also try some other gpio ports,it does'n work, no matter  PIN_OUTPUT or PIN_INPUT. Below is the try for WKUP_GPIO0_7:

      

  • Hi Veitch,

    Let us take your first example GPIO0_14.

    Now AG24 is the PAD that needs to be configured to GPIO mode.



    Use the below command from Linux command prompt:

    devmem2 0x11c038 w 0x08050007

    So pin muxing is done.

    Let us get to GPIO layer:

    cat /sys/class/gpio/gpiochip252/label
    600000.gpio

    We are interested in GPIO0 which is labelled 600000.gpio


    root@j7-evm:~# cat /sys/class/gpio/gpiochip252/base
    252

    Base is 252 in my setup so I add 14 to 252. 252 + 14 = 266.


    echo 266 > /sys/class/gpio/export

    echo out > /sys/class/gpio/gpio266/direction

    echo 1 > /sys/class/gpio/gpio266/value

    cat /sys/class/gpio/gpio266/value
    1

    Hope this gives you the right sequence. If no further questions please click on verify answer.

    Best Regards,
    Keerthy

  • Hi Keerthy,

    thanks for your qucik reply, this command "devmem2 0x11c038 w 0x08050007" helps, but I still get some questions regarding to this topic need to be clarified.

    1.Should I do this every time for each gpio manually? Could I configure the direction or value of gpio in dts? 

    2.And It seems the  PIN_OUTPUT/PIN_INPUT have no effect,even if I have already set the specific gpio to PIN_OUTPUT in dts,but the default direction of the gpio is still in untill I change it by "echo out > /sys/class/gpio/gpioX/direction"

    3.How should I do if I want configure the gpio output state in kernel for the power on timing of outside peripherals devices? Is there an referrence about configuring gpio in kernel.

    thanks

    BR

  • Hi Veitch,

    I Optimized the pinmux value. Basically 'devmem2 0x11c038 w 0x00040007'

    Should do the trick for you.

    1.Should I do this every time for each gpio manually? Could I configure the direction or value of gpio in dts? 


    DTS value for 0x00040007 corresponds to PIN_INPUT | 0x7. This should have ideally helped you. It seems like
    your DTS setting is getting overwritten. You can try to dump out the value of register:

    devmem2 0x11c038 w

    Let us check if your DTS setting to PIN_INPUT is really taking effect.

    Can you let me know if that is getting over written by pin muxing of some other node.

    3.How should I do if I want configure the gpio output state in kernel for the power on timing of outside peripherals devices? Is there an referrence about configuring gpio in kernel.

    You can try gpio-hog in dts. That should switch the GPIO to output and also set the value to some default.

    Ex: Refer gpio-hog instances in arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts


    Best Regards,
    Keerthy

  • Hi Keerthy, 

    You can try to dump out the value of register:

    devmem2 0x11c038 w

    Let us check if your DTS setting to PIN_INPUT is really taking effect.

    Can you let me know if that is getting over written by pin muxing of some other node.

    It seems there are three dts note using the AG24,what are the other two dts(k3-j721e-common-proc-board-infotainment.dts and k3-j721e-eaik.dts) using for?And I have tried to remove the overwritten by above two dts, but Its value of register is still 0x0x00010004(Expectantly should be 0x00050007?)

    You can try gpio-hog in dts. That should switch the GPIO to output and also set the value to some default.

    Ex: Refer gpio-hog instances in arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts

    what should I do if I need to do some delay for the gpio output in kernel? since the device requires a power-on sequence which is control by gpio.

    thanks

    BR 

  • Hi Keerthy,

    Let us take your first example GPIO0_14.

    Now AG24 is the PAD that needs to be configured to GPIO mode.



    Use the below command from Linux command prompt:

    devmem2 0x11c038 w 0x08050007

    So pin muxing is done.

    It works on AG24 under your steps,but not work on AH24(GPIO0_25), the issue occurs again,do you know why? I think AH24 has been setting to PINOUTPUT|7

    thanks

    BR

  • Hi,

    You are configuring the wrong pinmux register. Check the data sheet: https://www.ti.com/lit/ds/symlink/dra829v.pdf?ts=1636071319638&ref_url=https%253A%252F%252Fwww.ti.com%252Fproduct%252FDRA829V

    Page: 137

    The right address of the AH24 is 0x11c068

    Could you try with that?

    what should I do if I need to do some delay for the gpio output in kernel? since the device requires a power-on sequence which is control by gpio.

    GPIO-HOG will happen when the parent gpio controller driver is probed. Is that good enough for you?

    - Keerthy

  • Hi Keerthy,


    You are configuring the wrong pinmux register. Check the data sheet: https://www.ti.com/lit/ds/symlink/dra829v.pdf?ts=1636071319638&ref_url=https%253A%252F%252Fwww.ti.com%252Fproduct%252FDRA829V

    Page: 137

    The right address of the AH24 is 0x11c068

    Could you try with that?

    Our platform is TDA4VM instead of DRA829, why should we use the address of dra829?

    GPIO-HOG will happen when the parent gpio controller driver is probed. Is that good enough for you?

    I want to do something like GPIO0_0(output high)--->delay(5ms)--->GPIO0_1(output high) , the point is how to do the delay in dts, can it be implemented by GPIO-HOG?

    what are the other two dts(k3-j721e-common-proc-board-infotainment.dts and k3-j721e-eaik.dts) using for?

    And could you please help with this question?

  • Our platform is TDA4VM instead of DRA829, why should we use the address of dra829?

    TDA4VM/DRA829/J721e all mean the same.


    I want to do something like GPIO0_0(output high)--->delay(5ms)--->GPIO0_1(output high) , the point is how to do the delay in dts, can it be implemented by GPIO-HOG?

    No GPIO-HOG will enable a one time setting of GPIO level.


    k3-j721e-eaik.dts

    This is Edge-AI-Kit. This is used for a different variant of TDA4VM board. It is called the SK board. You can focus on the k3-j721e-common-proc-board.dts.


    k3-j721e-common-proc-board-infotainment.dts

    This is an overlay for infotainment peripherals. This is applied on top of  k3-j721e-common-proc-board.dts. Some basics of overlays on DTS is here: https://www.kernel.org/doc/html/latest/devicetree/overlay-notes.html

    If no other questions please click on verify answer.

    - Keerthy