UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor bercik1314
Visitor
676 Views
Registered: ‎10-16-2018

Setting GPIO values (PS-PL EMIO) from userspace linux don't work if SPI (EMIO) enabled

Jump to solution

Hi Dear,

I have the question about ZedBoard. I have a linux on it and SPI enabled (PS - master, PL - slave). I sending data from PL to PS and it works fine, but if any interface in EMIO is enabled (e.g. SPI or UART) I cannot set GPIO values from userspace linux. I can export GPIO by putting: "echo 960 > /sys/class/gpio/export", then I can set it as output: "echo out > /sys/class/gpio/gpio960/direction", but if I would like to set value to '1': "echo 1 > /sys/class/gpio/gpio960/value", it cannot set. There is no error, but if I put: "cat /sys/class/gpio/gpio960/value" in output I get '0'.
If I disable SPI in EMIO, GPIO works fine - I can set values. Can anyone help me? I will be grateful for your help. Thanks!

--Robert

0 Kudos
1 Solution

Accepted Solutions
Visitor bercik1314
Visitor
577 Views
Registered: ‎10-16-2018

Re: Setting GPIO values (PS-PL EMIO) from userspace linux don't work if SPI (EMIO) enabled

Jump to solution

I found the solution. In / sys / class / gpio / gpio960 / value there is a value GPIO as input, not output. So, If i change this value to '1' in this file will be 0, but it will be 1 in the physical output. Thanks for suggestions.

 

-- Robert

 

View solution in original post

0 Kudos
4 Replies
Moderator
Moderator
620 Views
Registered: ‎09-12-2007

Re: Setting GPIO values (PS-PL EMIO) from userspace linux don't work if SPI (EMIO) enabled

Jump to solution

what is the SPI connected to in the PL?

0 Kudos
Visitor bercik1314
Visitor
598 Views
Registered: ‎10-16-2018

Re: Setting GPIO values (PS-PL EMIO) from userspace linux don't work if SPI (EMIO) enabled

Jump to solution

Thanks for reply.

I created IP block (SPI slave) in PL side that is connected to the another IP block that increment integer value. This value is send to PS via SPI. I noticed situations when GPIO works fine but SPI don't work. If one of it works fine, second don't. Exists any solution of this problem? Thanks!

spi.png
0 Kudos
Explorer
Explorer
589 Views
Registered: ‎03-13-2014

Re: Setting GPIO values (PS-PL EMIO) from userspace linux don't work if SPI (EMIO) enabled

Jump to solution

Robert,

If you want to control the pins with GPIO then you will need to switch the function. Look in the Zynq 7000 TRM ug585. Section B.28 System Level Control Registers. Find the register for each pin you want to control from GPIO (MIO_PIN_xx) and switch it to GPIO (from SPI in your case) As a hack you can use the devmem. Has an example switch serial port to GPIO control

#enable GPIO clock
devmem 0xF800012C 32 0xD50445
#switch MIO 46, 47 to GPIO
devmem 0xF80007B8 32 0x1400
devmem 0xF80007BC 32 0x1400

 

0 Kudos
Visitor bercik1314
Visitor
578 Views
Registered: ‎10-16-2018

Re: Setting GPIO values (PS-PL EMIO) from userspace linux don't work if SPI (EMIO) enabled

Jump to solution

I found the solution. In / sys / class / gpio / gpio960 / value there is a value GPIO as input, not output. So, If i change this value to '1' in this file will be 0, but it will be 1 in the physical output. Thanks for suggestions.

 

-- Robert

 

View solution in original post

0 Kudos