Zedboard 上的 OLED

OLED on Zedboard

我是 zedboard 的新手。我有一个 zedboard 运行 宁 Ubuntu 图片。我正在尝试为板上的 运行 OLED 编写驱动程序。在板上启动时,板上的 OLED 显示一些显示器(Xilinx 徽标),因此我假设它已经有驱动程序。我有以下问题:

a) zedboard 中的 OLED 是如何内部连接的,是通过 SPI、GPIO 还是 PL。如果是通过 SPI/GPIOs 那么是哪个引脚?

b) 我可以按照任何教程或文档使用 SPI/GPIO 为 zedboard 中的 OLED 创建用户空间驱动程序?

c) 我有一个 redhat 桌面,有没有我可以用来从我的 redhat 桌面为 zedboard 开发用户空间驱动程序的 SDK。

我在 zedboard 上看到了很多材料,但其中 none 讨论了 OLED 的内部连接方式。在一份文件中,它显示它已连接到 PL。如果是这样,那么我如何在 zedboard 上使用 PL 编写用户空间驱动程序?我将使用 C 进行编码。

感谢您的帮助并提前致谢!

a) How is the OLED in the zedboard internally connected, is it through SPI, GPIOs or the PL. If it's through SPI/GPIOs then which pins?

web 搜索的第一个或第二个结果 "zedboard oled pdf" - http://zedboard.org/sites/default/files/ZedBoard_HW_UG_v1_1.pdf 然后在其中搜索"oled"(pdf文件的页码,未打印在文档中):

page3: 2.4.4 OLED...... ... ...... 19

page4: 128x32 OLED Display

page5: ZYNQ XC7Z020-CSG484 OLED <- bus_of_5 -> 128x32 OLED

page20: 2.4.4 OLED An Inteltronic/Wisechip UG-2832HSWEG04 OLED Display is used on the ZedBoard. This provides a 128x32 pixel, passive-matrix, monochrome display. The display size is 30mm x11.5mm x 1.45mm. Table 11 - OLED Connections ... Interface

oled_pin symb  EPP_pin  Function
9        RES#   U9      Power Reset for Controller and Driver
8        CS#    N/C     Chip Select – Pulled Down on Board
10       D/C#  U10      Data/Command Control
11       SCLK  AB12     Serial Clock Input Signal
12       SDIN  AA12     Serial Data Input Signal 

因此,我们知道了 OLED UG-2832HSWEG04 的型号(数据表 http://www.adafruit.com/datasheets/UG-2832HSWEG04.pdf,其中包含有关数据接口的低级详细信息)和数据连接;这是带有 1 个串行数据输入和 1 个串行时钟的 OLED。

引出线 pdf 为 http://www.xilinx.com/support/documentation/user_guides/ug865-Zynq-7000-Pkg-Pinout.pdf (too long to read), but there is shorter version of pin list in txt format: http://www.xilinx.com/support/packagefiles/z7packages/xc7z020clg484pkg.txt

Device/Package xc7z020clg484 2012 年 9 月 18 日 10:07:35

Pin   Pin Name                 Memory Byte Group  Bank  VCCAUX Group  Super Logic Region  I/O Type 
AA12  IO_L7P_T1_13             1                  13    NA            NA                  HR        
AB12  IO_L7N_T1_13             1                  13    NA            NA                  HR        

HR 表示“支持 3.3V 的高范围 (HR) 组”,两个数据引脚均来自 "bank 13"。引脚名称是 IO_*,所以它 "supports both input, as well as output functionality",并且是 "PL Pins" 的一部分(PL = 可编程逻辑 = FPGA)。 FPGA 部分的默认 Zedboard 固件允许使用 linux 内核(PS = 处理系统 = ARM)通过将此引脚路由到某个内部 processing_system GPIO 引脚来访问此引脚到芯片的 ARM 部分system.ucf 文件如:

NET processing_system7_0_GPIO_pin[5]  LOC = AB12 | IOSTANDARD="LVCMOS25";  # "OLED-SCLK"
NET processing_system7_0_GPIO_pin[6]  LOC = AA12 | IOSTANDARD="LVCMOS25";  # "OLED-SDIN"

然后GPIO引脚在zed_oled组的devicetree(dts)https://github.com/Digilent/linux-digilent/blob/master/arch/arm/boot/dts/digilent-zed.dts中注册:

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

b) Any tutorial or documentation that I can follow to create userspace drivers using SPI/GPIO for the OLED in the zedboard?

根据 Avnet 的入门 pdf,"Demo 2 – OLED Display" 第 17 页的部分(网络搜索为 "zedboard oled")http://zedboard.org/sites/default/files/documentations/GS-AES-Z7EV-7Z020-G-14.1-V6%5B1%5D.pdf#page=17 有内核驱动程序 pmodoled-gpio.ko(在屏幕截图上它报告如 "pmodoled-gpio-spi"), 所以 OLED 由 GPIO 引脚驱动。

有两个帮助脚本:unload_oled 删除内核模块和 load_oled 将其插入内核。驱动程序将创建特殊的设备文件 /dev/zed_oled 以与来自用户 space 的显示一起工作,并且 load_oled 也使用此 zed_oled 界面显示 /root/logo.bin 文件。

zed_oled 的典型用法类似于 cat yourfile.bin > /dev/zed_oled,例如 http://people.mech.kuleuven.be/~lin.zhang/notes/emebedded-linux/zedboard-oled-display.html and better http://zedboard.org/content/zedboard-oled

The .bin file format. ... The screen is written to right to left, top to bottom with each pixel being represented by a bit within one of the bytes within the .bin file. Bits are read-in top down 8 pixels then move over 1 pixel and write the next 8 bits and continue until you are at the end of the row. Then move down 8 pixels and do this again 3 more times.

您可以从 C 应用程序写入,从 http://www.cnblogs.com/popo0904/p/3853144.html 检查代码(您可以使用在线 web 翻译服务来阅读文本)

标准 zedboard 演示中使用的内核模块 PmodOLED 的文档:https://github.com/Digilent/linux-digilent/blob/master/Documentation/pmods/pmodoled.txt

The driver provides a 512 Byte display buffer for the display of PmodOLED. The Whole screen is divided into four lines, each of them is 128 bits wide and 8 bits high, as shown in the figure below.

    +--------------------------...----------------------------+
    +                         Line 4                          +
    +--------------------------...----------------------------+
    +                         Line 3                          +
    +--------------------------...----------------------------+
    +                         Line 2                          +
    +--------------------------...----------------------------+ MSB (bit 7)
    +                         Line 1                          +
    +--------------------------...----------------------------+ LSB (bit 0)
byte 127                                                     byte 0

Users can perform read and write functions to the device node to access the data inside the display buffer.

并且有驱动源码:https://github.com/Digilent/linux-digilent/blob/06b388903e5459687ba2538ae3895ffe29e2e39e/drivers/pmods/pmodoled-gpio.c

c) I have a redhat desktop, is there any SDk I can use to develop userspace drivers for the zedboard from my redhat desktop.

ZEDboard 上此 OLED 的标准驱动程序是 kernel-space,您可以从预编译的 ZEDboard 固件中使用它。或者您可以根据 zedboard 说明构建内核,所有内核驱动程序也将被构建(如果在内核配置中启用):http://zedboard.org/content/creating-linux-kernel-image-boot-zc702-sd-card-slot