P2040: How to configure GPIO as an interrupt

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

P2040: How to configure GPIO as an interrupt

1,307件の閲覧回数
gouravjain
Contributor IV

Hi,

In my custom board, based on P2040rdb, tired to configure GPIO22/IRQ04 as an interrupt.

Kept RCW bit[373]= 0 and GPICR = 0x00000200 and EIVPR2 = 0x80080002 (it must rigger on high to low).

While inserting module im getting error,

genirq: Setting trigger mode 0 for irq22 failed ((mpc8xxx_irq_set_type+0x0/0xec)).

And not able to catch interrupt.

root@hmd-modem::~# cat /proc/interrupts
CPU0 CPU1 CPU2 CPU3
16: 0 0 0 0 OpenPIC Edge mpic-error-int
22: 0 0 0 0 mpc8xxx-gpio Edge CYCLONE_GPIO_IRQ22

Pls let me know if i'm missing anything here.

Thanks in advance.

--

Gourav

0 件の賞賛
返信
8 返答(返信)

1,072件の閲覧回数
ufedor
NXP Employee
NXP Employee

You wrote:

> configure GPIO22/IRQ04 as an interrupt.

GPIO interrupts are jointly connected to the MPIC as internal interrupt 39 - refer to the QorIQ P2040 Reference Manual, Table 24-1. P2040 Internal Interrupt Assignments.

This means that you have to configure IIVPR39.

0 件の賞賛
返信

1,072件の閲覧回数
gouravjain
Contributor IV

Hi ufedor,

Thanks for your response.

Can you pls explain how to configure i.e. which all registers need to be changed??

0 件の賞賛
返信

1,072件の閲覧回数
ufedor
NXP Employee
NXP Employee

From hardware point of view you have to configure GPIMR = 0x00000200 and IIVPR39.

Consider that you have to properly declare the IRQ in the DTS.

Refer to /Documentation/powerpc/booting-without-of.txt for details. The value of the "interrupt" property is calculated by the following formula:
   
   [DTS_interrupt_number] = ([EIVPR/IIVPR_addr] - [Interrupt_Source_Configuration_Registers_Base]) / 0x20

where [EIVPR/IIVPR_addr] is the address of the interrupt configuration registers of the IRQ being declared, [Interrupt_Source_Configuration_Registers_Base] is 0x5000 for P2040.

0 件の賞賛
返信

1,072件の閲覧回数
gouravjain
Contributor IV

Hi,

Interrupt is getting triggered on GPIO-22, after doing following settings,

bit -22 is for GPIO-22

1) GPIER : 0x00000000

2) GPIMR : 0x00000200        bit-22=1 i.e. gpio-22 is non-masked, enabled 

3) GPICR : 0x00011015         bit-22=0 i.e. interrupt can be triggered in high to low and low to high

4) IIVPR39(0xFE0506E0): 0x7261703D bit 8 =0, As per ref manual all internal interrupts will be active high.

But im getting interrupts in both the edges. Pls have a look in register settings.

Thanks,

Gourav

0 件の賞賛
返信

1,072件の閲覧回数
ufedor
NXP Employee
NXP Employee

> 3) GPICR : 0x00011015         bit-22=0 i.e. interrupt can be triggered in high to low and low to high

Set the bit 22 to 1 - i.e.:

GPICR = 0x00011215

0 件の賞賛
返信

1,072件の閲覧回数
gouravjain
Contributor IV

"1" menas interrupt will be triggered on high to low transaction but  "IIVPR30" register tells all internal interrupts will be active high. What does it mean??

Anyways, I made bit 22 as 1 but still interrupts are triggering on both the edges.

0 件の賞賛
返信

1,072件の閲覧回数
gouravjain
Contributor IV

Hi ufedor,

Waiting for your reply....

0 件の賞賛
返信

1,072件の閲覧回数
ufedor
NXP Employee
NXP Employee

1) Use a debug mode to ensure that when GPICR[22]=1, the GPIER[22] is set only by high-to-low change on the port.

2) Ensure that GPIER[22] is cleared (by writing 1) in the interrupt handler.

0 件の賞賛
返信