这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 嵌入式开发 » MCU » [求救大神]4412开发板设置外部中断为下降沿触发,但是在上升沿的时候也触发中断

共3条 1/1 1 跳转至

[求救大神]4412开发板设置外部中断为下降沿触发,但是在上升沿的时候也触发中断

菜鸟
2017-02-20 14:52:30     打赏

 

设置和问题如下:
1. 中断信号经过硬件消斗处理;
1. 调试迅为4412的外部中断时,设置中断为下降沿触发,但是在上升沿的时候也触发了中断,这里上升沿触发中断时,中断脚的电平读出来为 0;
2. 设置的外部中断脚为EXYNOS4_GPX2(0),EXYNOS4_GPX2(1),EXYNOS4_GPX1(2),EXYNOS4_GPX3(0)),EXYNOS4_GPX3(2);
3. 其中引脚EXYNOS4_GPX3(0)设置为下降沿中断时,在上升沿不会像其他引脚一样触发中断;
4. 设置为上升沿触发中断时,在上升沿会触发两次中断,在第一次中断时,读取中断脚的电平为 0,在第二次中断时,读取中断脚的电平为 1 ;
5. 调试过程中没有加载下列make menuconfig 路径中提供的的任何驱动:
Device Drivers  --->                                                              
         Input device support  --->
                           

·     Keyboards  --->  
6. 中断配置代码如下:

    ret = gpio_request(EXYNOS4_GPX3(2), "EINT26");

    if (ret) {

                printk("%s: request GPIO %d for EINT26 failed, ret = %d\n", DRIVER_NAME,

                EXYNOS4_GPX3(2), ret);

                return ret;

             }

    s3c_gpio_cfgpin(EXYNOS4_GPX3(2), S3C_GPIO_SFN(0xF));

    s3c_gpio_setpull(EXYNOS4_GPX3(2), S3C_GPIO_PULL_UP);

    gpio_free(EXYNOS4_GPX3(2));

    ret = gpio_request(EXYNOS4_GPX3(2), "EINT26");

    if (ret) {

                printk("%s: request GPIO %d for EINT26 failed, ret = %d\n", DRIVER_NAME,

                EXYNOS4_GPX3(0), ret);

                return ret;

             }

    s3c_gpio_cfgpin(EXYNOS4_GPX3(0), S3C_GPIO_SFN(0xF));

    s3c_gpio_setpull(EXYNOS4_GPX3(0), S3C_GPIO_PULL_UP);

    gpio_free(EXYNOS4_GPX3(0));

    ret = gpio_request(EXYNOS4_GPX2(1), "EINT17");

    if (ret) {

                printk("%s: request GPIO %d for EINT17 failed, ret = %d\n", DRIVER_NAME,

                EXYNOS4_GPX2(1), ret);

                return ret;

             }

    s3c_gpio_cfgpin(EXYNOS4_GPX2(1), S3C_GPIO_SFN(0xF));

    s3c_gpio_setpull(EXYNOS4_GPX2(1), S3C_GPIO_PULL_UP);

    gpio_free(EXYNOS4_GPX2(1));

    ret = gpio_request(EXYNOS4_GPX1(2), "EINT10");

    if (ret) {

                printk("%s: request GPIO %d for EINT10 failed, ret = %d\n", DRIVER_NAME,

                EXYNOS4_GPX1(2), ret);

                return ret;

             }

    s3c_gpio_cfgpin(EXYNOS4_GPX1(2), S3C_GPIO_SFN(0xF));

    s3c_gpio_setpull(EXYNOS4_GPX1(2), S3C_GPIO_PULL_UP);

    gpio_free(EXYNOS4_GPX1(2));

    ret = request_irq(IRQ_EINT(26), eint26_interrupt,

                        IRQ_TYPE_EDGE_FALLING /*IRQF_TRIGGER_FALLING*/, "eint26", pdev);

    if (ret < 0) {

                    printk("Request IRQ %d failed, %d\n", IRQ_EINT(26), ret);

                    goto exit;

                 }

    ret = request_irq(IRQ_EINT(24), eint24_interrupt,

                        IRQ_TYPE_EDGE_FALLING /*IRQF_TRIGGER_FALLING*/, "eint24", pdev);

    if (ret < 0) {

                    printk("Request IRQ %d failed, %d\n", IRQ_EINT(24), ret);

                    goto exit;

                 }

    ret = request_irq(IRQ_EINT(17), eint17_interrupt,

                        IRQ_TYPE_EDGE_FALLING /*IRQF_TRIGGER_FALLING*/, "eint17", pdev);

    if (ret < 0) {

                    printk("Request IRQ %d failed, %d\n", IRQ_EINT(17), ret);

                    goto exit;

                 }

    ret = request_irq(IRQ_EINT(10), eint10_interrupt,

                        IRQ_TYPE_EDGE_FALLING /*IRQF_TRIGGER_FALLING*/, "eint10", pdev);

    if (ret < 0) {

                    printk("Request IRQ %d failed, %d\n", IRQ_EINT(10), ret);

                    goto exit;

                 }

7. 中断信号波形:
 



专家
2017-02-21 07:08:35     打赏
2楼
建议屏蔽为一个管脚。一个一个来判断是否中断异常。

菜鸟
2017-02-27 09:48:20     打赏
3楼
 楼上很厉害

共3条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]