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.

  • Resolved

AM5729: GPIO interrupt error

Mastermind 19925 points

Replies: 3

Views: 117

Part Number: AM5729

Dear Champs,

My customer faced below error of 'unexpected IRQ trap at vector 00' when they test GPIO in Linux PSDK.

root@am57xx-evm:~# ./test/test_gpio_handler  2 3 12 1
[   47.405628] irq 0, desc: f8e0f8ca, depth: 1, count: 0, unhandled: 0
[   47.411940] ->handle_irq():  a6816596, handle_bad_irq+0x0/0x260
[   47.417893] ->irq_data.chip(): d7b580e9, no_irq_chip+0x0/0x88
[   47.423663] ->action():   (null)
[   47.426903]    IRQ_NOPROBE set
[   47.429969]  IRQ_NOREQUEST set
[   47.433035] unexpected IRQ trap at vector 00
[test_gpio_handler.c] Set GPIO3_12 Value: Hi(1)
root@am57xx-evm:~# ./test/test_gpio_handler  2 3 12 0
[   49.305504] irq 0, desc: f8e0f8ca, depth: 1, count: 0, unhandled: 0
[   49.311809] ->handle_irq():  a6816596, handle_bad_irq+0x0/0x260
[   49.317762] ->irq_data.chip(): d7b580e9, no_irq_chip+0x0/0x88
[   49.323533] ->action():   (null)
[   49.326773]    IRQ_NOPROBE set
[   49.329840]  IRQ_NOREQUEST set
[   49.332907] unexpected IRQ trap at vector 00
[test_gpio_handler.c] Set GPIO3_12 Value: Low(0)

When they checked interrupt, they found there were 2 interrupts in IRQ 0, but there was no in IRQ 179 which assigned for GPIO.

root@am57xx-evm:~# cat /proc/interrupts
           CPU0       CPU1
  0:          2          0      none     Edge
17:          0          0      CBAR  32 Level     gp_timer
:
177:          0          0    palmas   8 Level     48070000.i2c:tps659038@58:tps659038_rtc
179:          0          0  48059000.gpio  10 Edge      S2:gpio3_10:dsp1
180:          0          0  48059000.gpio  11 Edge      S2:gpio3_11:ipu2
:
IPI4:          0          0  CPU stop interrupts
IPI5:          1          0  IRQ work interrupts
IPI6:          0          0  completion interrupts
Err:          2

Could you please guide me what should be checked to resolve this issue?

They modified device tree(am5729-beagleboneai.dts) as below.

&dra7_pmx_core {

      k_gpio_intr_pins: pinmux_k_gpio_intr_pins {

                 pinctrl-single,pins = <

                            DRA7XX_CORE_IOPAD(0x350c, PIN_INPUT | MUX_MODE14)      /* vin1a_d6.gpio3_10 */              // AM5729 Datasheet(Pg.100): Multiplexing Characteristics / Address 0x150C

                            DRA7XX_CORE_IOPAD(0x3514, PIN_OUTPUT | MUX_MODE14)      /* vin1a_d8.gpio3_12 */              // AM5729 Datasheet(Pg.100): Multiplexing Characteristics / Address 0x1514

                 >;

      };

};

 

/ {

    k_gpio_intr {

    pinctrl-names = "default";

      pinctrl-0     = <&k_gpio_intr_pins>;

      compatible = "k_gpio_intr";

        status = "okay";

};

};

They are using BeagleBone AI board and their SW is Linux PSDK v6.03.

Please let me know what should be checked to resolve this error.

Thanks and Best Regards,

SI.

root@am57xx-evm:~# ./test/test_gpio_handler  2 3 12 1
[   47.405628] irq 0, desc: f8e0f8ca, depth: 1, count: 0, unhandled: 0
[   47.411940] ->handle_irq():  a6816596, handle_bad_irq+0x0/0x260
[   47.417893] ->irq_data.chip(): d7b580e9, no_irq_chip+0x0/0x88
[   47.423663] ->action():   (null)
[   47.426903]    IRQ_NOPROBE set
[   47.429969]  IRQ_NOREQUEST set
[   47.433035] unexpected IRQ trap at vector 00
[test_gpio_handler.c] Set GPIO3_12 Value: Hi(1)
root@am57xx-evm:~# ./test/test_gpio_handler  2 3 12 0
[   49.305504] irq 0, desc: f8e0f8ca, depth: 1, count: 0, unhandled: 0
[   49.311809] ->handle_irq():  a6816596, handle_bad_irq+0x0/0x260
[   49.317762] ->irq_data.chip(): d7b580e9, no_irq_chip+0x0/0x88
[   49.323533] ->action():   (null)
[   49.326773]    IRQ_NOPROBE set
[   49.329840]  IRQ_NOREQUEST set
[   49.332907] unexpected IRQ trap at vector 00

[test_gpio_handler.c] Set GPIO3_12 Value: Low(0)

  • Hi,

    I need the following answers:

    1. Can you share the steps to reproduce the failure?
    2. test_gpio_handler.c. Can you share the source code?
    3. What is the use case? What are you trying with gpio?

    I do not have the beagleboneai hardware at the moment. I will try to reproduce on the AM574x-idk.

    Regards,
    Keerthy

  • In reply to Keerthy J:

    Hi Keerthy,

    Thanks for your response.

    Their application code and kernel device driver code are in below.

    AM5729_GPIO_INTERRUPT.zip

    Let me explain more details what they did.

    To test GPIO, they set GPIO3_10 as input to generate interrupt at Rising/Falling Edge and set GPIO3_12 as output to trigger interrupt.

    They set the attribute of each GPIO using gpio_request_one() function and allocated irq # using gpio_to_irq() function, and assign isr and trigger conditions using request_irq() function.

    And, they initialized GPIO interrupt registers as below.

    unsigned int unRegVal = 0x0;

     

        void __iomem *cm_per;

        void __iomem *iomem;

     

    /*

         Enable GPIO3 clock

     

               TRM Pg. 1072

               Address Offset  : 0x0000_0068    (CSL_MPU_L4PER_CM_CORE_REGS 0x4a009700)

               Physical Address: 0x4A00_9768

        */

        cm_per = ioremap(CSL_MPU_L4PER_CM_CORE_REGS, CSL_MPU_L4PER_CM_CORE_SIZE);

        if(!cm_per) {

          printk(KERN_ERR "[%s:%4d:%s] Failed to remap memory for CM_PER.\n",

            __FILENAME__, __LINE__, __FUNCTION__);

          return 0;

        }

        iowrite32(0x02, cm_per + 0x68); // MODULEMODE:  0x0=DISABLED,  0x2=ENABLED

        iounmap(cm_per);

     

    /*

         Setup the IRQ registers with the appropriate values.

     

         TRM Pg. 7109 ~ 7110

         Address Offset  : 0x0000_002C  (CSL_MPU_GPIO3_REGS 0x48057000)

         Physical Address: 0x4A805_702C

    */

        iomem = ioremap(CSL_MPU_GPIO3_REGS, CSL_MPU_GPIO3_SIZE);

        if(!iomem) {

            printk(KERN_ERR "[%s:%4d:%s] Failed to remap memory for GPIO Bank 3 IRQ pin configuration.\n",

                __FILENAME__, __LINE__, __FUNCTION__);

            return 0;

        }

     

               // Configure idle mode

               unRegVal = ioread32(iomem + GPIO_SYSCONFIG);

               BIT_CLR(unRegVal, 3);

               BIT_CLR(unRegVal, 4);

               iowrite32 (unRegVal, iomem + GPIO_SYSCONFIG);

     

     

               // Configure GPIO3_12 as output

               nGpioNum = 12;

               unRegVal = ioread32 (iomem + GPIO_OE);

               BIT_CLR(unRegVal, nGpioNum);

               iowrite32 (unRegVal, iomem + GPIO_OE);

     

    // Configure GPIO3_10 channels as input

               nGpioNum = 10;

                         unRegVal = ioread32 (iomem + GPIO_OE);

            BIT_SET(unRegVal, nGpioNum);

                          iowrite32 (unRegVal, iomem + GPIO_OE);

     

                         // Configure detection events

                         unRegVal = ioread32 (iomem + GPIO_RISINGDETECT);

                         BIT_SET(unRegVal, nGpioNum);

                         iowrite32 (unRegVal, iomem + GPIO_RISINGDETECT);

     

                         unRegVal = ioread32 (iomem + GPIO_FALLINGDETECT);

                         BIT_SET(unRegVal, nGpioNum);

                         iowrite32 (unRegVal, iomem + GPIO_FALLINGDETECT);

     

               // Clear interrupt status

               unRegVal = 0xFFFFFFFF;

               iowrite32 (unRegVal, iomem + GPIO_IRQSTATUS(0));

     

               // Enable interrupts for desired input lines

               unRegVal = ioread32 (iomem + GPIO_IRQSTATUS_SET(0));

               BIT_SET(unRegVal, 10);

               iowrite32 (unRegVal, iomem + GPIO_IRQSTATUS_SET(0));     

     

    iounmap(iomem);

    And then, they output through GPIO3_12 out pin to HI and LOW, and confirmed HI/Low signal, but they faced above errors.

    at this time, they did not load FW for DSP and IPU, and thus DSP and IPU were not worked at this time.

    please let me know if you have a question.

    Thanks and Best Regards,

    SI.

  • In reply to Sung-IL:

    Hi SI,

    I tried mmc Card detect GPIO Interrupt and its working fine on am574x-idk.

    cat /proc/interrupts | grep mmc
     72:      16463          0      CBAR  78 Level     mmc0
     74:      437          0      CBAR  81 Level     mmc1
    178:        1          0  4805d000.gpio  27 Edge      4809c000.mmc cd


    So basically if the intention is validate GPIO IRQs then card detect GPIO is a very
    well demonstrated & validated example for GPIO interrupts on am57xx.

    - Keerthy

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.