Does i.MX6's GPIO have pull-up/pull-down resistance?

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

Does i.MX6's GPIO have pull-up/pull-down resistance?

Jump to solution
6,842 Views
9crkzhou
Contributor III

I'm using the interrupt function, the noise of a finger-touch will generats many times interrupts

did i.MX6 got a pull-up/down resistance ?

Tags (3)
1 Solution
2,454 Views
raymondwang
Senior Contributor I

Example:

IOMUX config MX6Q_PAD_EIM_A25__GPIO_5_2 without any PAD control default,we can new pad control using MACRO NEW_PAD_CTRL

#define MX6Q_GENERIC_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \

PAD_CTL_PUS_22K_UP | PAD_CTL_SPEED_HIGH | \

PAD_CTL_DSE_40ohm | PAD_CTL_HYS)

static iomux_v3_cfg_t mx6q_xxx_pads[] = {

NEW_PAD_CTRL(MX6Q_PAD_EIM_A25__GPIO_5_2,MX6Q_GENERIC_PAD_CTRL),

};

Now you can see EIM_A25 as gpio_5_2 with pull up 22k pad control.

View solution in original post

0 Kudos
8 Replies
2,454 Views
raymondwang
Senior Contributor I

I think you should put this question in iMX space.

BTW, iMX6 GPIO have internal pull-up/down resistor setting. You can set that through IOMUX register.

2,454 Views
9crkzhou
Contributor III

thx,can you tell me more about this? which function(in which file) could achive this?

2,455 Views
raymondwang
Senior Contributor I

Example:

IOMUX config MX6Q_PAD_EIM_A25__GPIO_5_2 without any PAD control default,we can new pad control using MACRO NEW_PAD_CTRL

#define MX6Q_GENERIC_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \

PAD_CTL_PUS_22K_UP | PAD_CTL_SPEED_HIGH | \

PAD_CTL_DSE_40ohm | PAD_CTL_HYS)

static iomux_v3_cfg_t mx6q_xxx_pads[] = {

NEW_PAD_CTRL(MX6Q_PAD_EIM_A25__GPIO_5_2,MX6Q_GENERIC_PAD_CTRL),

};

Now you can see EIM_A25 as gpio_5_2 with pull up 22k pad control.

0 Kudos
2,454 Views
9crkzhou
Contributor III

Another Question: did you ever use the IOMUX tool ? it can generates codes, but when I use it in my button driver project, it appears the kernel crashed

I just putted the iomux config function into the module_init function , info like this:

root@freescale /$ insmod key.ko

Hello,zhouhua!
Unable to handle kernel paging request at virtual address 020e034c
pgd = b8730000
[020e034c] *pgd=00000000
Internal error: Oops: 805 [#1] PREEMPT SMP
Modules linked in: key(+)
CPU: 0    Not tainted  (3.0.15 #9)
PC is at zhouhua_init+0x20/0x80 [key]
LR is at zhouhua_init+0xc/0x80 [key]
pc : [<7f002020>]    lr : [<7f00200c>]    psr: 60000013
sp : b8323ea8  ip : c093a000  fp : 80099630
r10: 7f002000  r9 : 7f0003e4  r8 : 00000001
r7 : 00000000  r6 : 00000001  r5 : b8322000  r4 : 80a872c0
r3 : 020e0000  r2 : 0000b0b0  r1 : 00000005  r0 : 0000002b
Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: 10c53c7d  Table: 4873004a  DAC: 00000015

SP: 0xb8323e28:
3e28  00000000 00000000 b8323e5c 8005e3a8 00000000 b8241200 b8241200 b8134a00
3e48  b8e4e0c0 0000040f 00000005 00000001 00000000 8003fa10 0000002b 00000005
3e68  0000b0b0 020e0000 80a872c0 b8322000 00000001 00000000 00000001 7f0003e4
3e88  7f002000 80099630 c093a000 b8323ea8 7f00200c 7f002020 60000013 ffffffff
3ea8  80a872c0 8003a570 00000002 8bf1a240 00000002 7f002000 40000000 00000002
3ec8  b8740220 00000000 00000001 8009c074 7f0003e4 7f0003e4 7f00042c 00000001
3ee8  b87376c0 00000001 7f0003e4 80099548 80099630 8009b834 7f0003f0 2ab24000
3f08  00000000 00000124 00000000 000a7008 7f000510 7f0003f0 b8704140 c0aa6000

IP: 0xc0939f80:
9f80  ******** ******** ******** ******** ******** ******** ******** ********
9fa0  ******** ******** ******** ******** ******** ******** ******** ********
9fc0  ******** ******** ******** ******** ******** ******** ******** ********
9fe0  ******** ******** ******** ******** ******** ******** ******** ********
a000  0000000d
Unhandled fault: imprecise external abort (0x1406) at 0xc0939ffc

what's the condition?

0 Kudos
2,454 Views
raymondwang
Senior Contributor I

I don't think your oops caused by iomux config since iMX6 iomux module is initialized very early.

You should pay more on double check your key driver:

PC is at zhouhua_init+0x20/0x80 [key]

This implies your module init function can not  be init properly. If possible ,you can paste it here to analyze.

0 Kudos
2,454 Views
9crkzhou
Contributor III

because I'v wrote a same driver code , and it woks well, the only difference is the iomux setting in zhouhua_init() function

when I use

mxc_iomux_v3_setup_pad(MX6Q_PAD_SD4_DAT3__GPIO_2_11);

it works well

when using gpio2_iomux_config() generated by IOMUX tool , it crashed.

static int __init zhouhua_init (void)
{
        int iRet=0;
        printk("\nHelloe,zhouhua!\n");

        gpio2_iomux_config();
//      mxc_iomux_v3_setup_pad(MX6Q_PAD_SD4_DAT3__GPIO_2_11);           /* IOMUX setting                */

        if (gpio_request(IMX_GPIO_NR(2, 11), "lalalademaxiya") == 0) {                /* request first,so that no     */
                                                                                                                   /* other module will register   */
                                                                                                                   /* this IO                      */
                                                                                                                   /* the second parameter         */
                iRet = misc_register(&my_miscdev);
                if (iRet) {
                    printk("register failed!\n");
                }
        } else {
                printk("already in use!!!\n");
        }
        return iRet;
}

0 Kudos
2,453 Views
raymondwang
Senior Contributor I

Dear zhou, iomux tool generated code is based on physical address register base. But in linux iMX6 MMU enabled that means we must use virtual address for register access.

in /arch/arm/mach-mx6/mm.c

void __init mx6_map_io(void)

{

  iotable_init(mx6_io_desc, ARRAY_SIZE(mx6_io_desc));

  mxc_iomux_v3_init(IO_ADDRESS(MX6Q_IOMUXC_BASE_ADDR));

  mxc_arch_reset_init(IO_ADDRESS(MX6Q_WDOG1_BASE_ADDR));

  mx6_set_cpu_type();

  mxc_cpu_lp_set(WAIT_CLOCKED);

}

Bolded address is virtual address for iomux base. So if you want to use IOMUX tool generated code,please replace the REGS_IOMUXC_BASE with new IO_ADDRESS(MX6Q_IOMUXC_BASE_ADDR).

If I guess without error, you should add this before including "registers/regsiomuxc.h"

#define REGS_IOMUXC_BASE IO_ADDRESS(MX6Q_IOMUXC_BASE_ADDR)

  Good luck!

2,453 Views
9crkzhou
Contributor III

thanks .it helps.

it seems that the best way to configure the iomux (with mmu runing )is not using the iomux tool.

0 Kudos