Jump to content
  • 0

mike lee


Hi Digilent,

              zedboard, vivado 2015.4, petalinux 2015.4, /dev/zed_oled, pmodoled-gpio.ko

I am working on zedboard to enable onboard-OLED display. First vivado outputs bitstream hardware, then petalinux generates " BOOT.BIN + Image.ub ", finally zedboard bootup by the SD card. " insmod pmodoled-gpio.ko " does bring /dev/zed_oled .

However, " cat logo.bin > /dev/zed_oled " has nothing to display.

Then I decided to add oled block design in vivado project. I tried two different versions, including tamu https://github.com/ama142/ZedboardOLED-v1.0-IP  and Digilent https://github.com/Digilent/vivado-library/tree/master/ip/Pmods/PmodOLED_v1_0  . After making external pin assignment, Vivado / petalinux all functions. However, there is still no outputs on OLED.

Please advise how to turn on OLED in petalinux/vivado. Thanks in advance


(P.S. OLED by itself works well on OOB package with digilent logo output)

Link to comment
Share on other sites

18 answers to this question

Recommended Posts

Hey Mike,

That pmodoled driver is from an old demo, and we did not intend to continue supporting it. It is not intended to work with the PmodOLED IP core in the vivado project.

Here's what you will need to do to get it to work in a newer project:

1) In Vivado IPI, open the Zynq Processing system IP, enable GPIO over EMIO with a width of 7.

2) Make the new EMIO GPIO interface on the Zynq IP block external.

3) Open your XDC and add the following constraints (replace gpio with name of external emio gpio bus as found in your block diagram wrapper): 

set_property PACKAGE_PIN G17 [get_ports {gpio[0]}];  # "OTG-RESETN"
set_property PACKAGE_PIN U11  [get_ports {gpio[1]}];  # "OLED-VBAT"
set_property PACKAGE_PIN U12  [get_ports {gpio[2]}];  # "OLED-VDD"
set_property PACKAGE_PIN U9   [get_ports {gpio[3]}];  # "OLED-RES"
set_property PACKAGE_PIN U10  [get_ports {gpio[4]}];  # "OLED-DC"
set_property PACKAGE_PIN AB12 [get_ports {gpio[5]}];  # "OLED-SCLK"
set_property PACKAGE_PIN AA12 [get_ports {gpio[6]}];  # "OLED-SDIN"

You should then be able to build the project and import it into your petalinux project. Be sure to include the zed_oled device tree node as you have written it in a previous post.



Link to comment
Share on other sites

Hi sbobrowicz,

Following your advice I made progress on UIO. Now OLED can output correctly in petalinux. Many thanks.

However, the data transfer to PmodOLED is very slow. Below is what I am doing,

For GPIO, directly write to register GPIO_TRI_OFFSET (0x04) to set direction, and then write to register GPIO_DATA_OFFSET (0x00) for data transfer. According to SPI user guide https://www.xilinx.com/support/documentation/ip_documentation/axi_quad_spi/v3_2/pg153-axi-quad-spi.pdf, I find SPI_Control_Register (0x60) and  SPI_Data_Transmit_Register (0x68). Still I don't know how to define num-transfer-bits, max-frequency for SPI; guess my UIO-SPI is running @ default mode, which makes data transfer very slow, and I have to add delay function after each byte transfer to wait previous transfer settled.

Please advise how to properly setup the num-transfer-bits, max-frequency for UIO-SPI. Thanks in advance.




Link to comment
Share on other sites

Hi sbobrowicz,

The suggestion you provided is working on petalinux flow with simple GPIO connection for OLED device.

For PmodOLED IP core provided by your company, we can use it in our Vivado SDK design flow without problem. We are wondering how to incorporate PmodOLED IP core into our petalinux flow to simplify the development of our linux application software. Do you have any visibility how to make it work? Any comment or suggestion is highly appreciated.

Again, thank you for the great support.



Link to comment
Share on other sites

The number of data bits and the clock frequency is set at the block diagram by double clicking the Quad SPI IP core. IMO, this is a major downside of the AXI QUAD SPI IP core, because it means you can not change the clock speed from software without rebuilding the bitstream. Unfortunately we don't currently have an alternative. 

So you will need to open your block diagram in Vivado and change the clock divider values for the Quad SPI core, then rebuild and import into petalinux. Note the SCLK frequency will be equal to the frequency of the ext_spi_clock signal divided by the ratio value. 10 MHz for the SCLK frequency should be good.

The number of data bits should be set to 8.  

Link to comment
Share on other sites

Hi Jon,

back to work, here is the status,

I have successfully replicated your external_mux.zip project, i.e., generates bitstream from the vivado project, outputs hardware and launchs SDK for both PmodOLED and testoled in your external_mux.zip. OLED displays "PmodOLED" "by Digilent" "Simple Demo" etc.

However, petalinux-build still misses the OLED ouputs.

I inserted following lines into pl.dtsi, (borrowed from digilent-zed.dts  https://gist.github.com/godspeed1989/5523696)

        zed_oled {
            compatible = "dglnt,pmodoled-gpio";
            /* GPIO Pins */
            vbat-gpio = <&gpio0 55 0>;
            vdd-gpio = <&gpio0 56 0>;
            res-gpio = <&gpio0 57 0>;
            dc-gpio = <&gpio0 58 0>;
            /* SPI-GPIOs */
            spi-bus-num = <2>;
            spi-speed-hz = <4000000>;
            spi-sclk-gpio = <&gpio0 59 0>;
            spi-sdin-gpio = <&gpio0 60 0>;

# insmod pmodoled-gpio.ko  ==>  which shows /dev/zed_oled

# cat /sys/kernel/debug/gpio

GPIOs 906-1023, platform/e000a000.gpio, zynq_gpio:
 gpio-961 (OLED VBat           ) out lo    
 gpio-962 (OLED VDD            ) out lo    
 gpio-963 (OLED_RESET          ) out lo    
 gpio-964 (OLED_D/C            ) out lo    
 gpio-965 (spi_gpio.2          ) out lo    
 gpio-966 (spi_gpio.2          ) out lo  

# cat logo.bin > /dev/zed_oled ==> displays nothing

comparing to OOB results

zynq> cat /sys/kernel/debug/gpio                                                               


GPIOs 0-117, platform/e000a000.gpio, xgpio:                      
gpio-55  (OLED VBat           ) out lo                                    
gpio-56  (OLED VDD            ) out lo                                    
gpio-57  (OLED_RESET          ) out hi                                
gpio-58  (OLED_D/C            ) out hi                                    
gpio-59  (spi_gpio.2          ) out lo                                        
gpio-60  (spi_gpio.2          ) out lo
There are differences of gpio numberings, as well as gpio-57 / 58 out hi.

Please advise, thanks in advance


Link to comment
Share on other sites

1 hour ago, jpeyron said:

Hi @mike lee,

I have reached out to a more experienced Embedded Linux engineer to look into your question. I did find an Avnet post here that might be helpful.

thank you,


Hi Jon,

Thank you for the quick response.

The Avnet weblink http://zedboard.org/content/zedboard-oled still plays with OOB package. The script listed is the exact same file as located in " /usr/bin/load_oled " in OOB package.

insmod /lib/modules/`uname -r`/pmodoled-gpio.ko;
if [ -c /dev/zed_oled ]; then
        cat /root/logo.bin > /dev/zed_oled;

I want to use OLED display in my own project, which requests to involve a vivado IP in block diagram design, and to construct a Petalinux kernel/device module(s) to facilitate OLED outputs.

Notice OLED is only provided by zedboard, while zc702/zc706 do not have OLED. Therefore, I am solely depend on Digilent Talents to reach out. Many Thanks





Link to comment
Share on other sites

Yea, that old driver just bit-bangs out SPI on the GPIO controller, that's one of the reasons we don't want to invest the time to keep using it. Also, we are trying to move away from any sort of custom kernel drivers in general, unless it really makes sense (like in the case of audio and video).

We have been working on some examples this summer that use the generic UIO driver to communicate with Pmods from user space. These demos will be distributed as a petalinux 2017.1 (or newer) project. We are shooting for end of summer, but I can't guarantee that timeline. 

My suggested approach for now for using the PmodOLED IP or most other Pmod IP's will be to just use the UIO driver with them, and then port over the bare-metal libraries/demos included with the IP's to linux user space. This can be done in most cases by just replacing the register accesses with accesses that use the mmap-ed UIO device instead. You can post again if you need some help using UIO, but we have a few UIO related posts already that should help you get started. I recommend this guide to learn about the Generic UIO driver in general: https://www.kernel.org/doc/html/v4.11/driver-api/uio-howto.html . It suggests writing your own driver, but you can get around this by using the uio_pdrv_genirq driver and modifying the bootargs to add generic-uio to the compatibility list. 

For some select pmods, it makes more sense to load existing drivers that are targeted for the device the pmod is designed around. One example of this is the PmodRTCC, a real-time clock and calendar, that will automatically set the system time at boot if you use the correct device tree node. 



Link to comment
Share on other sites

Hi Jon,

Thank you for the vivado file. The project misses the IP component (guess you put pmodoled_v1_0 in other directory path), and also there is no pin assignment .xdc file.

It will take me some time to dig it through locally. Will report after I construct my own vivado project.



Link to comment
Share on other sites

Hi @mike lee,

Sorry about the missing files. To get the IP in the project you will need to download it from our github here. Then in Vivado go to project settings->ip->manage IP repository and add the vivado library folder you downloaded there. I also using the Zedboard board files which have a tutorial on how to add them here.  Also here is our Zedboard resource page. The get started with Zynq is a good tutorial to go through as well if you haven't yet. 



Link to comment
Share on other sites

Hi Joe,

Just check back, and still eager waiting Linux guru's resolute.

In the meanwhile, I am wondering whether you can provide the PmodOLED IP for vivado-2014.1 (petalinux kernel 3.x). The github version https://github.com/Digilent/vivado-library/tree/master/ip/Pmods/PmodOLED_v1_0 is for vivado-2015 (kernel 4.0). I would like to try with an early kernel version, since OOB package was based on kernel 3.3 .

Below is extracted from early version petalinux (with vivado 2014.1), and witnessed xgpiops numbering agreeable.

# cat /sys/kernel/debug/gpio
GPIOs 0-117, platform/e000a000.ps7-gpio, xgpiops:
 gpio-55  (OLED VBat           ) out lo
 gpio-56  (OLED VDD            ) out lo
 gpio-57  (OLED_RESET          ) out hi
 gpio-58  (OLED_D/C            ) out hi

Thanks in advance.



Link to comment
Share on other sites


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

  • Create New...