i.MX8 ADC_IN0 pin can't set as GPIO function

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX8 ADC_IN0 pin can't set as GPIO function

Jump to solution
4,040 Views
zoro
Contributor II

Hi all:

1. i.MX8 ADC_IN0 pin can't config to GPIO function, here is my dts pin config:

SC_P_ADC_IN0_LSIO_GPIO3_IO18            0x1E000000

2. when as output function, pin value always 0;

3. when as input function, gpio value always 0 no matter what level at the pin connected.

0 Kudos
Reply
1 Solution
2,793 Views
igorpadykov
NXP Employee
NXP Employee

>>SC_P_COMP_CTL_GPIO_1V8_3V3_GPIORHT_PAD, it can work now,
>but i don't know why

right, seems correct usage with *_PAD, similar example can be found for

"SC_P_COMP_CTL_GPIO_1V8_3V3_GPIORHB_PAD" in

fsl-imx8qxp-mek-lcdif.dts\freescale\dts\boot\arm64\arch - linux-imx - i.MX Linux kernel 

That specific "dual voltage" pad setting is needed for i.MX8QM/QXP processors,

details can be found in IOMUX Chapter of Reference Manual.

Best regards
igor

View solution in original post

0 Kudos
Reply
10 Replies
2,793 Views
nolan_zinn
Contributor IV

igorpadykov‌ Do you know how to change this

SC_P_COMP_CTL_GPIO_1V8_3V3_GPIORHB_PAD 0x000514a0

to use the 3.3V level instead of 1.8V?  I assume it has to do with the hex value at the end, but I couldn't find any references on how to set this in the devicetree.

Thanks,

Nolan Z

0 Kudos
Reply
2,792 Views
igorpadykov
NXP Employee
NXP Employee

Hi zeng

this pad is dual voltage pad and needs special configuartion, one can try to add in dts:

pinctrl_hog*:
SC_P_COMP_CTL_GPIO_1V8_3V3_GPIORHT    0x000514a0

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply
2,792 Views
zoro
Contributor II

igorpadykov‌, Thanks for your reply at first.

1. Here is my current config in dts:

pinctrl_hog: hoggrp {
    fsl,pins = <
        [...]
        SC_P_COMP_CTL_GPIO_1V8_3V3_GPIORHT      0x000514a0
        SC_P_ADC_IN0_LSIO_GPIO3_IO18                        0x1E000000 //irq
    >;
};

2. It can not work well.

0 Kudos
Reply
2,792 Views
zoro
Contributor II

1. when i change SC_P_COMP_CTL_GPIO_1V8_3V3_GPIORHT to SC_P_COMP_CTL_GPIO_1V8_3V3_GPIORHT_PAD, it can work now, but i don't know why.  :smileyhappy:

pinctrl_hog: hoggrp {
    fsl,pins = <
        SC_P_COMP_CTL_GPIO_1V8_3V3_GPIORHT_PAD    0x000514a0
        SC_P_ADC_IN0_LSIO_GPIO3_IO18                               0x1E000000 //irq
    >;
};

2. Is 1V8_3V3 in SC_P_COMP_CTL_GPIO_1V8_3V3_GPIORHT_PAD means the pin compatible 1.8V and 3.3V External voltage?

3. What is the mean RH in GPIORHT? 

0 Kudos
Reply
2,794 Views
igorpadykov
NXP Employee
NXP Employee

>>SC_P_COMP_CTL_GPIO_1V8_3V3_GPIORHT_PAD, it can work now,
>but i don't know why

right, seems correct usage with *_PAD, similar example can be found for

"SC_P_COMP_CTL_GPIO_1V8_3V3_GPIORHB_PAD" in

fsl-imx8qxp-mek-lcdif.dts\freescale\dts\boot\arm64\arch - linux-imx - i.MX Linux kernel 

That specific "dual voltage" pad setting is needed for i.MX8QM/QXP processors,

details can be found in IOMUX Chapter of Reference Manual.

Best regards
igor

0 Kudos
Reply
2,792 Views
zoro
Contributor II

1. We can control ADC_IN0 as GPIO input/output  at /sys/class/gpio/ in filesystem now;

2. but when i try to use ADC_IN0  as interrupt pin, it still can't work. 

    2.1 I have use this tool to test interrupt: GitHub - OnionIoT/gpioIrq: Example of using sysfs for edge detection interrupts on the Omega's GPIOs 

    2.2  I have try this tool at Raspberry Pi 0, it is ok: 

0 Kudos
Reply
2,792 Views
igorpadykov
NXP Employee
NXP Employee

may be helpful to look:

https://community.nxp.com/thread/510246 

0 Kudos
Reply
2,793 Views
zoro
Contributor II

I read the post, but i still don't know how to enable the irq for  ADC_IN0, still can't work. :smileysad:

0 Kudos
Reply
2,793 Views
igorpadykov
NXP Employee
NXP Employee

also one can look at example pinctrl_gpio_leds: SC_P_SPDIF0_TX_LSIO_GPIO2_IO15    

fsl-imx8qm-ddr4-arm2.dts\freescale\dts\boot\arm64\arch - linux-imx - i.MX Linux kernel 

Best regards
igor

0 Kudos
Reply
2,793 Views
zoro
Contributor II

1. I always try the both edge type interrupt at ADC_IN0 before and it can't work;

2. when i try rising/falling edge type interrupt at ADC_IN0 today and it works for me;

3. i.MX8 GPIO driver do not support both edge type interrupt;

pastedImage_4.png

Thanks.

0 Kudos
Reply