New Horizons

Welcome to my blog

My name is Sven Andersson and I
work as a consultant in embedded
system design, implemented in ASIC
and FPGA.
In my spare time I write this blog
and I hope it will inspire others to
learn more about this fantastic field.
I live in Stockholm Sweden and have
my own company

Contact

You are welcome to contact me
and ask questions or make comments
about my blog.

In this experiment we will use SDK to create and run software for the new custom PL peripheral. But first we will configure the programmable logic (PL) using the newly created bitstream file. Let's start Xilinx SDK.

xsdk &

Configuration

Click the configuration icon in the top menu. This will open the "Program FPGA" window. Find and select the bitstream file (system_wrapper.bit) that was exported to SDK. I will always use the words configure and configuration when I talk about "programming the hardware" on the board.

Click Program and wait a minute or two.

If the configuration is successful this blue LED will light up.

Create a new application project.

1. Select File->New->Application Project

2. Type LED_Dimmer in the project name and select "Use existing" under Board Support Package. Click Next.

3. Select Empty Application to be used as a template and click Finish.

4. The new software project will appear in the Project Explorer window. Expand LED_Dimmer and right-click on src and select New->File.

5. Enter the name main.c. Click Finish.

6. The C file will open in the editor window. It should be blank as an empty application was specified. Now we can start writing our application program.

Don't invent the wheel again

Xilinx has included a lot of documentation, program examples, and low-level drivers in the SDK installation. To access this information we open the system.mss file (if not already open).

Where is the axi_gpio driver

I can't find the <axi_gpio> driver. Is should be included in the board support package we have generated earlier.

Rebuilding the board support package

The GPIO module was added after we created the standalone_bsp_0. To inlude the new module we have to rebuild the BSP. This is what we are going to do:

Open SDK and delete the standalone_bsp_0

Create a new BSP with same name

When we open the system.mss file this time it displays the axi_gpio driver.

Let's click the Documentation hyperlink.

Error opening Firefox

When clicking one of the hyperllnks in the system.mss file to open Firefox this error message appear on the terminal screen.

This is not the first time I see this error message. The problem seems to be that Xilinx includes their own shared C-libraries and that they are not updated automatically by the Ubuntu software updater. An easy fix is to rename this library and then Firefox will pick up the Ubuntu shared library.

// Since the LED width is 1e6 clk cycles, we need to normalize // the period to that clk. Since we accept values 0-9, that will // scale period from 0-999,000. 0 turns off LEDs, 999,000 is full // brightness

jmales2 March 12, 2015 06:11 PM PDTI'm following all the steps and I still don't have the "axi0 gpio" driver. I even tried Sergio_Avramenko solution and still nothing.

What am I missing?

Leonardo Solis December 19, 2014 01:28 AM PSTb

Leonardo Solis December 19, 2014 01:27 AM PSTJust to mention: I faced twice errors when trying to open the documentation hyperlinks. I needed to repeat the steps but in another folder:

/opt/Xilinx/Vivado/2013.4/ids_lite/ISE/lib/lin64

Regards,

Hubert Huang December 2, 2014 01:47 PM PSTHi,
I'm wondering why the LED width is 1e6 clk cycles. We set it or just the API makes it? And where I can get documents about drivers APIs? I can't understand why the third parameter in the function XGpio_DiscreteWrite stands for the duty_cycle width out to the PL GPIO peripheral.
Thank you for reading. My email is hyx0408@126.com. Welcome your email.

Sergio_Avramenko November 11, 2014 04:33 AM PST"No axi_gpio" solved

You should not only delete standalone_bsp_0 but also hw_platform_0 has to be deleted before you generate new BSP.

Bartek November 3, 2014 01:23 AM PSTHello, I have problem with GPIO driver. I tried to delete standalone_bsp_0 and make a new the same thing, but there's no any axi_gpio. Where's the problem? Also compilation is impossible because of error - xgpio.h:no such file or directory.

VADDI CHANDRA SEKHAR August 7, 2014 02:06 PM PDTSir Thank you, i followed what you have said, and the program worked,
Sir i want to know how to read and write to the DDR memory of the board.
Can you tell me how to do it?

Uzair Zaidi June 6, 2014 12:26 PM PDThii,

I am also facing the same problem.
Can anyone tell me, how to resolve this problem?

I have succesfully run gpio-demo program on zc702 board. Now I want to run the same board on microzed board.

I have succesfully access GPIO (lit LED#47) on microzed board as an standalone application, and now I am trying to access it from userspace in linux.

I have the BSP for microZed (created following your blog), and all my petalinux related commands are working perfectly fine.

I created BOOT.BIN and image.ub. And linux boots perfectly fine.

Once I get command prompt, I cd /bin:

root@Xilinx-ZC702-14_7:/bin# gpio-demo -g 47 -o 0
Failed to open /sys/class/gpio/gpiochip47/ngpio: No such file or directory
Failed to open /sys/class/gpio/gpiochip47/ngpio: No such file or directory
root@Xilinx-ZC702-14_7:/bin#

47 is the number of my LED on the board.

Then I looked in /sys/class/gpio/ and I found gpiochip0 , which indicates that GPIO_BASE is 0.

So I gave the command accordingly:

root@Xilinx-ZC702-14_7:/bin# gpio-demo -g 0 -o 1
Usage: gpio-demo [-g GPIO_BASE] COMMAND
where COMMAND is one of:
-i Input value from GPIO and print it
-o VALUE Output value to GPIO
-c Cylon test pattern
-k KIT test pattern
GPIO_BASE indicates which GPIO chip to talk to (The number can be
found at /sys/class/gpio/gpiochipN).
The highest gpiochipN is the first gpio listed in the dts file,
and the lowest gpiochipN is the last gpio listed in the dts file.
E.g.If the gpiochip240 is the LED_8bit gpio, and I want to output '1'
to the LED_8bit gpio, the command should be:
gpio-demo -g 240 -o 1

gpio-demo written by Xilinx Inc.

Why this error is coming?

Kindly help me.

(I have also asked this question in forum really appreaciate for your suggestions).