2282 views|2 replies

230

Posts

2

Resources
The OP
 

[Experimental Guide] How to view the number of GPIO added on the FPGA side of the SoC FPGA system [Copy link]

 

This article was written by FPGA enthusiast Xiao Meige. Without the author's permission, this article is only allowed to be copied and reproduced on online forums, and the original author must be indicated when reprinting.

Application to register interrupt and write simple interrupt service routine

----------------------------------------------------------------------------
Detect user input from push button / DIP switch:
modprobe gpio_interrupt gpio_number=<n>

When user presses the button or flips the dip switch, a message will be printed
to kernel console.
1. If the user connects to the console on board using serial connection,
the message "Interrupt happened at gpio:<gpio_number>" will be printed on the
console.
2. If the user connects to the console on board using ssh, the message can be
viewed from kernel log via "dmesg" command.

Note: User will need to do "rmmod gpio_interrupt" prior in order to change
gpio_number by calling "modprobe gpio_interrupt gpio_number=<n>" again

User will need to get the GPIO number from /sys/class/gpio/ by using
command 'ls'. E.g.

root@socfpga~:# ls /sys/class/gpio/
gpiochip150 gpiochip152 gpiochip156 gpiochip160
gpiochip192 gpiochip224

From the listing, n can be obtained. The GPIO number may vary for different
design with different device tree entries; this is due to the GPIO numbers are
auto-assign by the kernel.

To confirm the n is associated to which peripheral, user needs to match the
label of the GPIO chip to the address of push button and DIP switch in device
tree.
e.g.
root@socfpga~:# cat /sys/class/gpio/gpiochip150/label
/sopc@0/bridge@0xc0000000/gpio@0x1000100C0

In this reference design, DIP switch is at address 0x10080 while the push button
is at address 0x100c0. So in this case GPIO number 150 - 151 are allocated to
push button 0 - 1.

This post is from Altera SoC

Latest reply

https://bbs.eeworld.com.cn/thread-1165054-1-1.html   Details Published on 2021-5-10 12:11
 
 

3

Posts

0

Resources
2
 

I have the same question, please answer

This post is from Altera SoC
 
 
 

3

Posts

0

Resources
3
 

https://bbs.eeworld.com.cn/thread-1165054-1-1.html

This post is from Altera SoC
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list