Jump to content
  • 0

Figuring out GPIO port mapping for the ArtyZ7-20


loberman

Question

GPIO Pin numbering and offset for ArtyZ7-20

Folks, how do I calculate the offset for the digital shield on the Artyz7-20.

I am testing pins IO26 to IO41 on the inner shield PINS.

root@arm:/sys/class/gpio# ls
export  gpiochip1020  gpiochip902  unexport

The LED'S are here and working fine off the same GPIO in the design as leds_4bits

root@arm:/sys/class/gpio# cat gpiochip1020/ngpio
4

They work fine with

echo 1020> export

echo out > gpio1020/direction

echo 1 > gpio1020/value

How do I figure out where the Digital shield Pins start for IO26 to IO41

There are 118 of them on the gpiochip902, some have to be the buttons and switches as I included those in the design too

root@arm:/sys/class/gpio# cat gpiochip902/ngpio
118

What teh recipe for mapping these to the Linux gpio numbering.

 

Thanks

Laurence

 

 

 

 

 

 

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

Its Just struck me that I forgot to export the hardware and bitstream after making the change and adding the shield before rebuilding the Petalinux Image.

This may be why I am having problems.

Let me test that first before wasting anybody's time here

Link to comment
Share on other sites

That was the issue, I se ethe extra GPIO now

root@arm:~# dmesg | grep gpio
[    0.404388] XGpio: /amba_pl/gpio@41200000: registered, base is 1020
[    0.411904] XGpio: /amba_pl/gpio@41200000: dual channel registered, base is 1004
[    0.420597] XGpio: /amba_pl/gpio@41210000: registered, base is 1000
[    0.428130] XGpio: /amba_pl/gpio@41210000: dual channel registered, base is 998
[    0.436505] XGpio: /amba_pl/gpio@41220000: registered, base is 992

 

Link to comment
Share on other sites

So others don't struggle, IO26 starts on 1004

root@arm:/sys/class/gpio# echo 1004 > export
root@arm:/sys/class/gpio# echo out > gpio1004/direction
root@arm:/sys/class/gpio# echo 1 > gpio1004/value
 And I see the 3.2 volts

Using

while true; do echo 1 > gpio1004/value; echo 0 > gpio1004/value; done

I see the 3.3Khz

Thanks

Laurence

 

Link to comment
Share on other sites

One other tidbit that may help others

Shell loops gives 3.3 Khz, C program gets tio191Khz.

Keep in mind, these are not supposed to switch fast as they have 200Ohm resistors for protection.

// Poor mans oscillator
#define _GNU_SOURCE

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>


int main(int argc, char *argv[]) {
int loop;
int fd;
int ret;

char high[1]="1";
char low[1]="0";
char gpio_name[]="/sys/class/gpio/gpio1004/value";

fd = open(gpio_name,O_WRONLY);
printf("Opened fd=%d\n",fd);


while (1) {
write(fd,high,1);
write(fd,low,1);
}

close(fd);
}

 

 

Link to comment
Share on other sites

Hello Jon

Thank you for all you do for us.

Is there a recent article on the Arty (microblaze) for booting Linux off flash. Its the last step I need to do before jumping into a full design.

I followed Jeff's excellent article and used his flash sizes (Special thanks to Jeff too here by the way)

Using
petalinux-package –boot –force –fpga ../arty7_microblaze_jeff.runs/impl_1/design_1_wrapper.bit –u-boot –kernel –flash-size 16 –flash-intf SPIx1

I have the boot.mcs loaded into flash but on reset its not vectoring to Uboot.

The bitstream for the fpga fabric loads fine but uboot does not load and if I manually load uboot.elf and try boot off flash I get an error

Build date: Dec 27 2017 09:29:25
Serial console: Uartlite
FS-BOOT: No existing image in FLASH.
FS-BOOT: Please download the image with JTAG.

So manually loaded u-boot and tried to boot from flash

Hit any key to stop autoboot: 0
SF: Detected n25q128 with page size 256 Bytes, erase size 64 KiB, total 16 MiB
device 0 offset 0x500000, size 0xa40000
SF: 10747904 bytes @ 0x500000 Read: OK
Wrong Image Format for bootm command

Loading the kernel using xmf works fine with the bit file loaded from Flash so I m very close here.

Clearly I am doing something wrong

Thank You

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...