On P2020, GPIO[0:4] is multiplexed with IRQ[7:11]. How does software configure it usage so that it can be used as GPIO or IRQ? thanks.

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

On P2020, GPIO[0:4] is multiplexed with IRQ[7:11]. How does software configure it usage so that it can be used as GPIO or IRQ? thanks.

1,942 Views
vikashagrawal
Contributor I

On P2020, GPIO[0:4] is multiplexed with IRQ[7:11].  How does software configure it usage so that it can be used as GPIO or IRQ?

Labels (1)
Tags (3)
0 Kudos
Reply
3 Replies

1,459 Views
Pavel
NXP Employee
NXP Employee

Look at the Figure 20-1 of the P2020 Reference Manual. Use the PIC_EIVPRn registers for external interrupt masking.

Use the GPIO_GPIMR register for GPIO interrupt masking.

the P2020 GPIO and IRQ signals are multiplexed and cannot be selected at at pad level. Multiplexing option through PMUXCR registers is not available.

To use GPIO, mask the IRQ through EIVPR registers


Have a great day,
Pavel Chubakov

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

0 Kudos
Reply

1,459 Views
Pavel
NXP Employee
NXP Employee

NXP SDK supports sysfs possibility for GPIO/IRQ using from user space.

Check please that the following kernel configuration options are set. These options are necessary for sysfs GPIO support:

-*- GPIO Support  --->  

[*] /sys/class/gpio/... (sysfs interface)

[*] MPC512x/MPC8xxx GPIO support

GPIO controllers should be declared in the Device Tree file.

More information on the device tree GPIO declaration can be found in the kernel source.

See please the following files:

/Documentation/powerpc/dts-bindings/gpio.txt and /Documentation/powerpc/dts-bindings/fsl/8xxx_gpio.txt

This possibility is available using sysfs from user space.

See the following pages

(http://elinux.org/GPIO)

and

(https://www.kernel.org/doc/Documentation/gpio/sysfs.txt).

and

(http://www.lindusembedded.com/blog/2011/12/29/gpio-general-purpose-inputoutput-interfaces-in-linux-2...)

and

(https://www.kernel.org/doc/Documentation/gpio/sysfs.txt).

Attached file contains .dts file and command dump for GPIO using.

The second method consist of using mmap command.

It is a POSIX-compliant Linux/Unix system call that maps files or devices into memory.

It is a method of memory-mapped file I/O.

For example, look at the following links (http://en.wikipedia.org/wiki/Mmap) and

(http://beej.us/guide/bgipc/output/html/multipage/mmap.html).


Have a great day,
Pavel Chubakov

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

0 Kudos
Reply

1,459 Views
vikashagrawal
Contributor I

Thank you Pavel.

My question is slightly different. We are using VxWorks (and not linux). However my question should be treated as independent of Operating system. My question is related to P2020 register configuration. Which P2020 registers configuration decide whether a particular GPIO pin (in GPIO[0:4]) is configured as GPIO or IRQ? How does P2020 know whether a particular multiplexed pin is being used as GPIO or IRQ.

Thanks,

Vikash

0 Kudos
Reply