{"id":9464,"date":"2025-02-28T13:41:20","date_gmt":"2025-02-28T05:41:20","guid":{"rendered":"http:\/\/www.hellofpga.com\/?p=9464"},"modified":"2025-05-13T09:24:31","modified_gmt":"2025-05-13T01:24:31","slug":"petalinux_sys_gpio","status":"publish","type":"post","link":"http:\/\/www.hellofpga.com\/index.php\/2025\/02\/28\/petalinux_sys_gpio\/","title":{"rendered":"\u57fa\u4e8eSmart Zynq\u4e0eLemon Zynq \u7684Petalinux\u5f00\u53d1 \u7ae0\u8282\u4e03 GPIO\u7684\u8f93\u5165\u8f93\u51fa\u5b9e\u9a8c"},"content":{"rendered":"\n<p>\u672c\u6587\u5c06\u5728PETALINUX\u4e0b\u5b9e\u73b0 GPIO\u7684\u8f93\u5165\u8f93\u51fa\u529f\u80fd\u3002\u5176\u4e2d\u8f93\u51fa\u529f\u80fd\u5c06\u7528LED\u706f\u6765\u6f14\u793a\uff0c\u8f93\u5165\u529f\u80fd\u7528\u677f\u5b50\u4e0a\u7684\u6309\u952e\u6765\u6f14\u793a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u6b64\u7ae0\u8282\u5185\u5bb9\u9002\u7528\u4e8e\u4e0b\u5217\u4e3b\u677f<\/strong>\n<ul class=\"wp-block-list\">\n<li><strong>Lemon ZYNQ \uff08CLG400\u5c01\u88c5\u76847020\uff09<\/strong><\/li>\n\n\n\n<li><strong>Smart ZYNQ SP \/ SP2 \/ SL \u7248\u7684\u677f\u5b50\uff08\u975e\u6807\u51c6\u7248\uff09\uff08CLG484\u5c01\u88c5\uff09<\/strong><\/li>\n\n\n\n<li><strong>Smart ZYNQ \u6807\u51c6\u7248\uff08\u505c\u4ea7\uff09 (CLG400\u5c01\u88c57010\/7020 \uff09<\/strong><\/li>\n\n\n\n<li><strong>Ebaz 4205+\u672c\u7ad9\u8f6c\u63a5\u677f<\/strong> <strong> (CLG400\u5c01\u88c57010 \uff09<\/strong><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u672c\u6587\u5728 vivado2018.3 \u4ee5\u53ca Petalinux2018.3 \u7248\u672c\u4e0a\u8fdb\u884c\u6f14\u793a<\/strong><\/li>\n<\/ul>\n\n\n\n<p>\u672c\u6587\u4e2d\u7684\u6d4b\u8bd5\u7684LED\u548cKEY \u90fd\u662f\u63a5\u5728PL(FPGA)\u6d4b\u7684\uff0c\u6240\u4ee5\u672c\u6587\u4e2d\u7684GPIO\u90fd\u662f\u4f7f\u7528EMIO\u65b9\u5f0f\u8fdb\u884c\u63a7\u5236\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e00\u3001VIVADO\u5de5\u7a0b\u90e8\u5206<\/strong> <strong>\uff08<strong>\u4e4b\u524d\u7ae0\u8282<\/strong>\u5236\u4f5c\u7684\u955c\u50cf\u5df2\u7ecf\u5e26LED\u548cKEY\u7684\u90e8\u5206\uff0c\u8fd9\u91cc\u53ea\u505a\u4ecb\u7ecd\uff09<\/strong><\/h2>\n\n\n\n<p>\u6211\u4eec\u4e4b\u524d\u5236\u4f5c\u7684\u955c\u50cf\u4e2d\u5df2\u7ecf\u5305\u542b\u4e86GPIO(EMIO)\u90e8\u5206\u7684\u5185\u5bb9\u4e86\uff0c\u6240\u4ee5<strong>\u672c\u6b21\u5b9e\u9a8c\u4e0d\u9700\u8981\u91cd\u65b0\u5236\u4f5cVIVADO\u5de5\u7a0b\u4ee5\u53caPetalinux \u7cfb\u7edf\u7684\u91cd\u65b0\u7f16\u8bd1\u64cd\u4f5c<\/strong>\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>GPIO\u6dfb\u52a0\u7684\u8fc7\u7a0b\u7684\u5185\u5bb9\u53ef\u4ee5\u56de\u987e\u4e0b\u5217\u7ae0\u8282\uff1a\n<ul class=\"wp-block-list\">\n<li>Smart Zynq \uff1a<a href=\"http:\/\/www.hellofpga.com\/index.php\/2025\/02\/23\/smart_zynq_petalinux_01\/\">\u57fa\u4e8eSmart Zynq \u7684Petalinux\u5f00\u53d1 \u7ae0\u8282\u4e00 Vivado \u57fa\u7840\u786c\u4ef6\u5de5\u7a0b\u642d\u5efa<\/a><\/li>\n\n\n\n<li>Lemon Zynq \uff1a<a href=\"http:\/\/www.hellofpga.com\/index.php\/2024\/10\/24\/lemon_zynq_petalinux_01\/\">\u57fa\u4e8eLemon Zynq \u7684Petalinux\u5f00\u53d1 \u7ae0\u8282\u4e00 Vivado \u57fa\u7840\u786c\u4ef6\u5de5\u7a0b\u642d\u5efa<\/a><\/li>\n\n\n\n<li>Ebaz 4205 + \u672c\u7ad9\u62d3\u5c55\u677f \uff1a<a href=\"http:\/\/www.hellofpga.com\/index.php\/2025\/05\/12\/ebaz4205_petalinux_vivado\/\">\u57fa\u4e8eEBAZ4205\u7684Petalinux\u5f00\u53d1 \u7ae0\u8282\u4e00 Vivado \u57fa\u7840\u786c\u4ef6\u5de5\u7a0b\u642d\u5efa<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>\u8fd9\u91cc\u6211\u4eec\u4e5f\u53ef\u4ee5\u7b80\u5355\u56de\u987e\u4e0b\uff1a<\/p>\n\n\n\n<p>1\uff09 \u5728ZYNQ\u8bbe\u7f6e\u9875\u9762\u6dfb\u52a0GPIO\u7aef\u53e3\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Smart ZYNQ \u662f\u6dfb\u52a04\u4e2aIO\u53e3\uff0c\u7528\u4e8e2\u4e2aLED\u706f\uff0c\u548c2\u4e2a\u6309\u952e<\/strong><\/li>\n\n\n\n<li><strong>Lemon ZYNQ \u662f\u6dfb\u52a08\u4e2aIO\u53e3\uff0c\u7528\u4e8e4\u4e2aLED\u706f\uff0c\u548c4\u4e2a\u6309\u952e<\/strong><\/li>\n\n\n\n<li><strong>EBAZ4205 + \u672c\u7ad9\u62d3\u5c55\u677f  \u662f\u6dfb\u52a08\u4e2aIO\u53e3\uff0c\u7528\u4e8e3\u4e2aLED\u706f\uff0c\u548c5\u4e2a\u6309\u952e<\/strong><\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"310\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2025\/02\/image-6-1024x310.png\" alt=\"\" class=\"wp-image-9377\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2025\/02\/image-6-1024x310.png 1024w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2025\/02\/image-6-300x91.png 300w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2025\/02\/image-6-768x233.png 768w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2025\/02\/image-6.png 1059w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>2) \u5c06\u6211\u4eec\u7684EMIO GPIO \u901a\u8fc7 External \u7684\u65b9\u5f0f\u6620\u5c04\u51fa\u6765\uff0c\u53f3\u952e External<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"912\" height=\"498\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2024\/10\/image-112.png\" alt=\"\" class=\"wp-image-8428\" style=\"width:533px;height:auto\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2024\/10\/image-112.png 912w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2024\/10\/image-112-300x164.png 300w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2024\/10\/image-112-768x419.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>3) \u5728\u9876\u5c42\u6a21\u5757\u4e2d\uff0c\u5c06\u6211\u4eec\u7684GPIO_0 \u5f15\u51fa\u53bb<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>a.\u5728\u9876\u5c42\u6a21\u5757\u5b9a\u4e49\u4e2d\u6dfb\u52a0 inout [3:0]GPIO_EMIO, (Smart ZYNQ \u662f3:0\uff0c Lemon ZYNQ\u662f 7:0 \uff0cEbaz4205+\u8f6c\u63a5\u677f\uff1a7:0)<\/li>\n\n\n\n<li>b.\u5728\u9876\u5c42\u6a21\u5757\u7684zynq \u4f8b\u5316\u90e8\u5206\u6dfb\u52a0 .GPIO_0_0_tri_io(GPIO_EMIO),<\/li>\n<\/ul>\n\n\n\n<p>\u53c2\u8003\u4e0b\u6587\u4e2d\u6807\u52a0\u7c97\u7684\u90e8\u5206\uff1a(\u4ee3\u7801\u4f5c\u7701\u7565\u4e86)<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">`timescale 1ns \/ 1ps<br>module TopModule(<br>    <strong>inout [3:0]GPIO_EMIO,<\/strong><br>\/\/ ...........<br>);<br><br> ZYNQ_CORE_wrapper zynq_u(<br>    <strong>.GPIO_0_0_tri_io(GPIO_EMIO),<\/strong><br>\/\/................<br> );<br>    <br>endmodule<\/pre>\n\n\n\n<p>4) \u5728XDC\u7ea6\u675f\u6587\u4ef6\u4e2d\u589e\u52a0 GPIO\u90e8\u5206\u5bf9\u5e94\u7684\u7ba1\u811a\u7ea6\u675f\uff08\u9700\u8981\u7ed3\u5408\u539f\u7406\u56fe\uff09\uff0c\u5982\u4e0b\u9762\u6240\u793a\uff08\u4e0b\u9762\u7684\u53c2\u8003\u5185\u5bb9\u662f\u57fa\u4e8eSmart ZYNQ SP\/SP2\/SL\u7248\u7684\uff09<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">set_property -dict {PACKAGE_PIN J20 IOSTANDARD LVCMOS33} [get_ports GPIO_EMIO[3]]<br>set_property -dict {PACKAGE_PIN K21 IOSTANDARD LVCMOS33} [get_ports GPIO_EMIO[2]]<br>set_property -dict {PACKAGE_PIN P21 IOSTANDARD LVCMOS33} [get_ports GPIO_EMIO[1]]<br>set_property -dict {PACKAGE_PIN P20 IOSTANDARD LVCMOS33} [get_ports GPIO_EMIO[0]]<\/pre>\n\n\n\n<p><strong>\u4e0a\u9762\u662f\u548cGPIO\u76f8\u5173\u90e8\u5206\u7684\u6dfb\u52a0\u91cd\u70b9\uff0c \u5f53\u7136\u8981\u60f3\u8ba9PETALINUX \u6b63\u5e38\u8dd1\u8d77\u6765\uff0c\u6211\u4eec\u8fd8\u662f\u9700\u8981\u6309\u5de5\u7a0b\u4e00\u90a3\u6837\uff0c\u5c06DDR\u578b\u53f7\uff0cDDR\u4f4d\u5bbd\uff0cUART\uff0cSD\u7b49\u8d44\u6e90\u6dfb\u52a0\u8d77\u6765\u7684\u3002<\/strong><\/p>\n\n\n\n<p>\u5982\u679c\u9700\u8981\u63a7\u5236\u5176\u4ed6\u6392\u9488\u7684GPIO\uff0c\u5219\u6309\u7167\u8fd9\u4e9b\u5185\u5bb9\u624b\u52a8\u4fee\u6539\u5de5\u7a0b\u5373\u53ef\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e8c\u3001PETALINUX\u7684\u7f16\u8bd1\u548c\u70e7\u5f55\uff08\u4e4b\u524d\u7ae0\u8282\u5236\u4f5c\u7684\u955c\u50cf\u5df2\u7ecf\u5e26LED\u548cKEY\u7684\u90e8\u5206\uff0c\u8fd9\u91cc\u53ea\u505a\u56de\u987e\uff09<\/strong><\/h2>\n\n\n\n<p><strong>\u5982\u679c\u8981\u56de\u987e\u5185\u5bb9\u53ef\u4ee5\u53c2\u8003\u4e0b\u9762\u90e8\u5206\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>PETALINUX \u7684\u7cfb\u7edf\u7684\u7f16\u8bd1\u53ca\u955c\u50cf\u7684\u751f\u6210\uff1a<\/strong>\n<ul class=\"wp-block-list\">\n<li><strong>Smart  ZYNQ:<\/strong><a href=\"http:\/\/www.hellofpga.com\/index.php\/2025\/02\/23\/smart_zynq_building_petalinux\/\">\u57fa\u4e8eSmart Zynq \u7684Petalinux\u5f00\u53d1 \u7ae0\u8282\u4e8c \u5728 Ubuntu \u4e0a\u5b8c\u6210 Petalinux \u7684\u5de5\u7a0b\u521b\u5efa\u53ca\u7f16\u8bd1\u5168\u8fc7\u7a0b(TF\u5361\u542f\u52a8)<\/a><\/li>\n\n\n\n<li><strong>Lemon ZYNQ:<\/strong><a href=\"http:\/\/www.hellofpga.com\/index.php\/2024\/10\/25\/lemon_zynq_building_petalinux\/\">\u57fa\u4e8eLemon Zynq \u7684Petalinux\u5f00\u53d1 \u7ae0\u8282\u4e8c \u5728 Ubuntu \u4e0a\u5b8c\u6210 Petalinux \u7684\u5de5\u7a0b\u521b\u5efa\u53ca\u7f16\u8bd1\u5168\u8fc7\u7a0b(TF\u5361\u542f\u52a8)<\/a><\/li>\n\n\n\n<li><strong>Ebaz 4205 + \u8f6c\u63a5\u677f:<\/strong><a href=\"http:\/\/www.hellofpga.com\/index.php\/2025\/05\/13\/4205_images\/\">\u57fa\u4e8eEBAZ4205 \u7684Petalinux\u5f00\u53d1 \u7ae0\u8282\u4e8c \u5728 Ubuntu \u4e0a\u5b8c\u6210 Petalinux \u7684\u5de5\u7a0b\u521b\u5efa\u53ca\u7f16\u8bd1\u5168\u8fc7\u7a0b(TF\u5361\u542f\u52a8)<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>PETALINUX \u955c\u50cf\u7684\u70e7\u5f55\uff1a<\/strong><a href=\"http:\/\/www.hellofpga.com\/index.php\/2025\/02\/23\/zynq_creating_sd_card\/\">\u57fa\u4e8eSmart Zynq\u4e0eLemon Zynq \u7684Petalinux\u5f00\u53d1 \u7ae0\u8282\u4e09 \u521b\u5efa\u53ef\u7528\u4e8ePetalinux \u7cfb\u7edf\u542f\u52a8\u7684SD\u5361\uff08\u5305\u542bboot\u548crootfs\u5206\u533a\uff09<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e09\u3001\u542f\u52a8\u4e3b\u677f\u5e76\u8fdb\u5165PETALINUX\u7cfb\u7edf<\/strong><\/h2>\n\n\n\n<p>\u5c06\u677f\u5b50\u7684\u542f\u52a8\u65b9\u5f0f\u8c03\u6574\u6210SD\u542f\u52a8\uff0c\u5982\u4e0b\u56fe\u6240\u793a<strong> (\u5982\u679c\u662fEBAZ4205\uff0c\u9700\u8981\u901a\u8fc7\u8c03\u6574\u542f\u52a8\u7535\u963b\u7684\u710a\u63a5\u4f4d\u7f6e\uff0c\u67e5\u770b\u524d\u9762\u7ae0\u8282)<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"381\" height=\"383\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/10\/image-27.png\" alt=\"\" class=\"wp-image-5207\" style=\"width:325px;height:auto\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/10\/image-27.png 381w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/10\/image-27-298x300.png 298w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/10\/image-27-150x150.png 150w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/10\/image-27-100x100.png 100w\" sizes=\"auto, (max-width: 381px) 100vw, 381px\" \/><\/figure>\n\n\n\n<p>\u63a5\u4e0b\u6765\u53ef\u4ee5\u5bf9\u4e3b\u677f\u8fdb\u884c\u4e0a\u7535\u3002 \u4e0a\u7535\u4e4b\u540e\u677f\u5b50\u4e0a\u7684POWER\u706f\u4ee5\u53caDONE\u706f\u5c06\u4f1a\u4eae\u8d77\uff0c\u5982\u679c\u6211\u4eec\u7684UART\u548c\u7535\u8111\u8fde\u63a5\u4e86\uff0c\u6b64\u65f6\u7528putty\u7b49\u4e13\u4e1a\u8f6f\u4ef6\u67e5\u770b\u4e32\u53e3\u4fe1\u606f\uff08<strong>\u6ce2\u7279\u7387115200<\/strong>\uff09\uff0c\u53ef\u4ee5\u770b\u5230\u7cfb\u7edf\u5df2\u7ecf\u542f\u52a8\uff0c\u4e32\u53e3\u6b63\u5728\u53d1\u9001\u542f\u52a8\u7684\u65e5\u5fd7\u4fe1\u606f\u3002<strong>\uff08\u5f53\u7136\u8fd9\u91cc\u4e5f\u53ef\u4ee5\u7528 SSH\u65b9\u5f0f\u901a\u8fc7\u7f51\u7edc\u8fdb\u884c\u8fde\u63a5\uff09<\/strong><\/p>\n\n\n\n<p>\u5f53\u7cfb\u7edf\u51fa\u73b0root@localhost:~# \u5c31\u4ee3\u8868\u7cfb\u7edf\u5df2\u7ecf\u6210\u529f\u542f\u52a8\u4e86\uff0c\u7cfb\u7edf\u6b64\u65f6\u505c\u7559\u5728\u7b49\u5f85\u8f93\u5165\u8d26\u53f7\u5bc6\u7801\u7684\u72b6\u6001<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"672\" height=\"285\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2025\/02\/image-11.png\" alt=\"\" class=\"wp-image-9423\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2025\/02\/image-11.png 672w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2025\/02\/image-11-300x127.png 300w\" sizes=\"auto, (max-width: 672px) 100vw, 672px\" \/><\/figure>\n\n\n\n<p>\u6b64\u65f6\u8f93\u5165<strong>\u7528\u6237\u540d root \u5bc6\u7801 root<\/strong>\uff0c\u4e4b\u540e\u5c31\u6b63\u5f0f\u767b\u5f55 petalinux \u4e86<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"558\" height=\"162\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2025\/02\/image-12.png\" alt=\"\" class=\"wp-image-9424\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2025\/02\/image-12.png 558w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2025\/02\/image-12-300x87.png 300w\" sizes=\"auto, (max-width: 558px) 100vw, 558px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u56db\u3001GPIO\u529f\u80fd\u9a8c\u8bc1\u4e00 \u70b9\u4eaeLED<\/strong><\/h2>\n\n\n\n<p>\u8fd9\u91cc\u6211\u4eec\u7528sysfs\u65b9\u5f0f\u6765\u9a71\u52a8GPIO(\u5728\u547d\u4ee4\u884c\u7ec8\u7aef\u4e2d\u8fdb\u884c\u64cd\u4f5c)<\/p>\n\n\n\n<p>a\uff09\u8fdb\u5165 \/sys\/class\/gpio\/ \u76ee\u5f55<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">cd  \/sys\/class\/gpio\/ <\/pre>\n\n\n\n<p>b) \u7528ls\u67e5\u770b \u6587\u4ef6\u5939\u4e0b\u7684\u5185\u5bb9\uff0c\u7531\u4e0b\u56fe\u53ef\u4ee5\u77e5\u9053\u7cfb\u7edf\u5df2\u7ecf\u8bc6\u522b\u51fa\u4e00\u4e2aGPIO\u8bbe\u5907 gpiochip906\u4e86<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ls<\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"727\" height=\"103\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2025\/02\/image-25.png\" alt=\"\" class=\"wp-image-9489\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2025\/02\/image-25.png 727w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2025\/02\/image-25-300x43.png 300w\" sizes=\"auto, (max-width: 727px) 100vw, 727px\" \/><\/figure>\n\n\n\n<p><strong>gpiochip906\u7684\u8d77\u59cb\u7f16\u53f7\u662f906<\/strong>\uff0c\u56e0\u4e3a\u6211\u4eec\u7684\u677f\u5b50\u4e0aLED\u706f\u88ab\u914d\u7f6e\u5230EMIO\u76840 \u548cEMIO 1\u4e0a\u4e86\uff0c\u800cEMIO0 \u548cEMIO1\u5206\u522b\u5bf9\u5e9454\u548c55(\u7f16\u53f70-53\u5c5e\u4e8eMIO)\uff0c\u76f8\u5f53\u4e8e\u5bf9\u5e94linux \u7cfb\u7edf\u7684GPIO960\uff08906+54\uff09\u548cGPIO961\uff08906+55\uff09<\/p>\n\n\n\n<p>c) \u8f93\u5165\u4e0b\u5217\u6307\u4ee4\u8f93\u5c06EMIO0\uff08GPIO960\uff09 \u8282\u70b9\uff08\u5373LED\u706f\uff09\u5bfc\u5165\u7528\u6237\u7a7a\u95f4<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">echo 960 &gt; export<\/pre>\n\n\n\n<p>d) \u63a5\u4e0b\u6765\u6211\u4eec\u5c1d\u8bd5\u70b9\u4eaeLED\u706f\uff0c\u6211\u4eec\u9700\u8981\u7684\u64cd\u4f5c\u662f\u5c06\u8f93\u5165\u8f93\u51fa\u6539\u6210\u4e3a\u8f93\u51fa\u6a21\u5f0f\uff0c \u5e76\u4e14\u5c06LED\u706f\u5bf9\u5e94\u7684EMIO57 \uff08GPIO960\uff09\u8bbe\u7f6e\u4e3a\u9ad8\u7535\u5e73<\/p>\n\n\n\n<p><strong>\u5c06GPIO960\u8bbe\u7f6e\u4e3a\u8f93\u51fa<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">echo out &gt; gpio960\/direction<\/pre>\n\n\n\n<p>\u5206\u522b\u5c06GPIO960(EMIO 0)\u8fdb\u884c\u62c9\u9ad8 \u548c\u62c9\u4f4e\u7684\u64cd\u4f5c\u6765\u89c2\u5bdf\u677f\u5b50\u4e0aLED\u706f\u7684\u72b6\u6001<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u5c06GPIO960\u8bbe\u7f6e\u4e3a\u9ad8\u7535\u5e73  LED\u706f\u88ab\u70b9\u4eae<\/strong> <br>echo 1 &gt; gpio960\/value<br><br><strong>\u5c06GPIO960\u8bbe\u7f6e\u4e3a\u4f4e\u7535\u5e73  LED\u706f\u88ab\u7184\u706d<\/strong> <br>echo 0 &gt; gpio960\/value<\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"807\" height=\"180\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2025\/02\/image-26.png\" alt=\"\" class=\"wp-image-9493\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2025\/02\/image-26.png 807w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2025\/02\/image-26-300x67.png 300w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2025\/02\/image-26-768x171.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>\u5982\u679c\u987a\u5229\u7684\u8bdd\uff0cLED\u706f\u7684\u72b6\u6001\u5c06\u968f\u7740\u6211\u4eec\u63a7\u5236GPIO960(EMIO0)\u7684\u6539\u53d8\u800c\u53d8\u5316\uff0c\u8bc1\u660eLED\u63a7\u5236\u6210\u529f<\/p>\n\n\n\n<p><strong>\u5907\u6ce8\uff1a \u8fd9\u91cc Smart ZYNQ \u7684EMIO0 \u5bf9\u5e94\u7684\u662f \u4e3b\u677f\u4e0a\u7684 LED1(\u4e1d\u5370\u53f7) \uff0c\u800c Lemon ZYNQ \u7684EMIO0 \u5bf9\u5e94\u7684\u662f\u4e3b\u677f\u4e0a\u7684LED0(\u4e1d\u5370\u53f7)<\/strong>\uff0c<strong>Ebaz4205Z\u8f6c\u63a5\u677f\u7684EMIO0\u5bf9\u5e94LED1(\u4e1d\u5370\u53f7)<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e94\u3001GPIO\u529f\u80fd\u9a8c\u8bc1\u4e8c \u6309\u952e\u8bfb\u53d6<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u8fd9\u91cc\u9700\u8981\u6ce8\u610f\u4e24\u4e2a\u5730\u65b9\uff1a\n<ul class=\"wp-block-list\">\n<li>Smart ZYNQ :  \u4e24\u4e2a\u6309\u952e\u5bf9\u5e94   <strong>EMIO3 ~  EMIO2<\/strong> ,\u5e76\u4e14\u662f\u6309\u4e0b\u540e<strong>\u4f4e\u7535\u5e73<\/strong><\/li>\n\n\n\n<li>Lemon ZYNQ \uff1a\u56db\u4e2a\u6309\u952e\u5bf9\u5e94 <strong>EMIO7 ~  EMIO4<\/strong> ,\u5e76\u4e14\u662f\u6309\u4e0b\u540e<strong>\u9ad8\u7535\u5e73<\/strong><\/li>\n\n\n\n<li>Ebaz4205 + \u8f6c\u63a5\u677f \uff1a\u4e94\u4e2a\u6309\u952e\u5bf9\u5e94 <strong>EMIO7 ~  EMIO3<\/strong> ,\u5e76\u4e14\u662f\u6309\u4e0b\u540e<strong><strong>\u4f4e\u7535\u5e73<\/strong><\/strong><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p><strong>gpiochip906\u7684\u8d77\u59cb\u7f16\u53f7\u662f 906&nbsp;<\/strong>\uff0c\u800cEMIO0\u5bf9\u5e94\u7684\u662f54(\u7f16\u53f70-53\u5c5e\u4e8eMIO)\uff0c \u56e0\u4e3a\u6211\u4eec\u7684\u6309\u952e\u5bf9\u5e94Linux \u7cfb\u7edf\u7684GPIO\u7f16\u53f7\u662f\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Smart ZYNQ : <strong>KEY1<\/strong>:GPIO962(906+54+2),<strong>KEY2<\/strong>:GPIO963 (906+54+3)<\/li>\n\n\n\n<li>Lemon ZYNQ \uff1a<strong>BTN0<\/strong>:GPIO964(906+54+4), ~ <strong>BTN3<\/strong>:GPIO967(906+54+7)<\/li>\n\n\n\n<li>Ebaz4205+\u8f6c\u63a5\u677f \uff1a<strong>KEY1<\/strong>:GPIO963(906+54+3) ~ <strong>KEY5<\/strong>:GPIO967(906+54+7)<\/li>\n\n\n\n<li>\u672c\u6b21\u5b9e\u9a8c\u4ec5\u7528\u5230\u4e00\u4e2a\u6309\u952e\uff0c\u5373Smart ZYNQ\u7684 KEY1(GPIO962), \u6216Lemon ZYNQ\u7684 BTN0(GPIO964), Ebaz4205+\u8f6c\u63a5\u677fKEY1(GPIO963)<strong>\u6ce8\u610f \u51e0\u79cd\u7c7b\u578b\u7684\u677f\u5b50\u6309\u952e\u6309\u4e0b\u7684\u7535\u5e73\u662f\u4e0d\u540c\u7684<\/strong><\/li>\n<\/ul>\n\n\n\n<p>a\uff09\u8fdb\u5165 \/sys\/class\/gpio\/ \u76ee\u5f55<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">cd \/sys\/class\/gpio\/<\/pre>\n\n\n\n<p>b) \u6839\u636e\u4e0d\u540c\u7684\u4e3b\u677f\u7c7b\u578b \u8f93\u5165\u4e0b\u5217\u6307\u4ee4\u8f93\u5c06GPIO962\uff08Smart ZYNQ\uff09\u6216GPIO964(Lemon ZYNQ) \u6216 GPIO963\uff08Ebaz 4205 + \u8f6c\u63a5\u677f\uff09\u8282\u70b9\uff08\u5373KEY1\uff09\u5bfc\u5165\u7528\u6237\u7a7a\u95f4<strong>\uff08\u6839\u636e\u4e0d\u540c\u578b\u53f7\u4e3b\u677f\u9009\u62e9\u4e0d\u540c\u7684\u547d\u4ee4\uff09<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\/\/ Smart ZYNQ<\/strong> <br>echo 962 &gt; export<br><br><strong>\/\/Lemon ZYNQ<\/strong><br>echo 964 &gt; export<br><br><strong>\/\/Ebaz 4205 +\u8f6c\u63a5\u677f<\/strong><br>echo 963 &gt; export<\/pre>\n\n\n\n<p>c) \u6211\u4eec\u4e5f\u53ef\u4ee5\u901a\u8fc7\u4e0b\u5217\u547d\u4ee4\u67e5\u770b\u5f53\u524d\u7684\u8f93\u5165\u8f93\u51fa\u72b6\u6001<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\/\/ Smart ZYNQ<\/strong> <br>cat gpio962\/direction<br><br><strong>\/\/Lemon ZYNQ<\/strong><br>cat gpio964\/direction<br><br><strong>\/\/Ebaz 4205 +\u8f6c\u63a5\u677f<\/strong><br>cat gpio963\/direction<\/pre>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230\u8fd9\u91cc GPIO962\u9ed8\u8ba4\u5c31\u662f\u8f93\u5165\u72b6\u6001\u4e86(\u8fd9\u91cc\u8fd4\u56de\u7684\u662fin)<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"195\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2025\/02\/image-27.png\" alt=\"\" class=\"wp-image-9505\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2025\/02\/image-27.png 750w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2025\/02\/image-27-300x78.png 300w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/figure>\n\n\n\n<p>d) \u5982\u679c\u8f93\u5165\u8f93\u51fa\u72b6\u6001\u662fout \uff0c\u90a3\u6211\u4eec\u8fd9\u91cc\u9700\u8981\u7528\u4e0b\u5217\u547d\u4ee4\u5c06\u6a21\u5f0f\u4fee\u6539\u6210in<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\/\/ Smart ZYNQ<\/strong> <br>echo in &gt; gpio962\/direction<br><br><strong>\/\/Lemon ZYNQ<\/strong><br>echo in &gt; gpio964\/direction<br><br><strong>\/\/Ebaz 4205 +\u8f6c\u63a5\u677f<\/strong><br>echo in &gt; gpio963\/direction<\/pre>\n\n\n\n<p>e )\u4e4b\u540e\u6211\u4eec\u901a\u8fc7\u4e0b\u5217\u6307\u4ee4\u6765\u67e5\u770b\u5f53\u524d\u7684\u6309\u952e\u503c\uff08\u8f93\u5165\u6307\u4ee4\u524d\uff0c\u6211\u4eec\u9700\u8981\u63d0\u524d\u6309\u4e0b\u6216\u8005\u677e\u5f00\u6309\u952e\uff09<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\/\/ Smart ZYNQ<\/strong> <br>cat gpio962\/value<br><br><strong>\/\/Lemon ZYNQ<\/strong><br>cat gpio964\/value<br><br><strong>\/\/Ebaz 4205 +\u8f6c\u63a5\u677f<\/strong><br>cat gpio963\/value<\/pre>\n\n\n\n<p>\u5982\u4e0b\u56fe\u6240\u793a(\u6b64\u5904\u4ee5Smart ZYNQ\u4e3a\u4f8b\uff0c<strong> Lemon ZYNQ \u7684\u7535\u5e73\u76f8\u53cd<\/strong>)\uff0c\u5f53KEY1 (\u5373EMIO56 GPIO962) \u6309\u677e\u5f00\u65f6\uff0c\u8fd4\u56de\u7684value\u503c\u662f1\uff0c \u5f53KEY1 \u6309\u4e0b\u65f6\u8fd4\u56de\u503c\u662f0\u3002<strong>\uff08\u5982\u679c\u662fLemon ZYNQ,\u5219 \u6309\u952e\u677e\u5f00\u662f0\uff0c\u6309\u952e\u6309\u4e0b\u8fd4\u56de0\uff0c Ebaz4205+\u8f6c\u63a5\u677f\u4e0eSmart ZYNQ\u76f8\u540c\uff09<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"727\" height=\"133\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2025\/02\/image-28.png\" alt=\"\" class=\"wp-image-9506\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2025\/02\/image-28.png 727w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2025\/02\/image-28-300x55.png 300w\" sizes=\"auto, (max-width: 727px) 100vw, 727px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>\u4ee5\u4e0a\u662fPETALINUX\u7684GPIO \u8f93\u5165\u8f93\u51fa\u6d4b\u8bd5\u8fc7\u7a0b<\/p>\n\n\n\n<p><strong>\u5173\u4e8e sysfs\uff1asysfs(\u865a\u62df\u6587\u4ef6\u7cfb\u7edf)\uff0csysfs\u7684\u4f5c\u7528\u662f\u5c06\u6ce8\u518c\u8fdb\u7cfb\u7edf\u4e2d\u7684\u8bbe\u5907\u3001\u603b\u7ebf\u548c\u9a71\u52a8\u7ec4\u7ec7\u6210\u4e00\u4e2a\u4e2a\u5206\u7ea7\u7684\u6587\u4ef6\uff0c\u5e76\u76f4\u89c2\u5730\u5c06\u9a71\u52a8\u548c\u8bbe\u5907\u7684\u5c42\u6b21\u7ed3\u6784\u4ee5\u6587\u4ef6\u7684\u5f62\u5f0f\u5c55\u793a\u5728\u7528\u6237\u7a7a\u95f4\uff0c\u901a\u8fc7\u64cd\u4f5c\u8fd9\u4e9b\u6587\u4ef6\uff0c\u7cfb\u7edf\u5411\u7528\u6237\u7a7a\u95f4\u5bfc\u51fa\u5185\u6838\u6570\u636e\u7ed3\u6784\u4ee5\u53ca\u4ed6\u4eec\u7684\u5c5e\u6027\uff0c\u8fd9\u6837\u4e00\u6765\u7528\u6237\u7a7a\u95f4\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539sysfs\u7684\u6587\u4ef6\u5c5e\u6027\u6765\u4fee\u6539\u8bbe\u5907\u7684\u5c5e\u6027\u503c\uff0c\u8fdb\u800c\u6539\u53d8\u8bbe\u5907\u7684\u5de5\u4f5c\u72b6\u6001<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u5c06\u5728Xillinux\u4e0b\u5b9e\u73b0 GPIO\u7684\u8f93\u5165\u8f93\u51fa\u529f\u80fd\u3002\u5176\u4e2d\u8f93\u51fa\u529f\u80fd\u5c06\u7528LED\u706f\u6765\u6f14\u793a\uff0c\u8f93\u5165\u529f\u80fd\u7528\u677f\u5b50\u4e0a\u7684\u6309\u952e\u6765\u6f14\u793a<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,10],"tags":[],"class_list":["post-9464","post","type-post","status-publish","format-standard","hentry","category-smart-zynq-spsl","category-smart-zynq-board"],"views":1336,"_links":{"self":[{"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/posts\/9464","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/comments?post=9464"}],"version-history":[{"count":36,"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/posts\/9464\/revisions"}],"predecessor-version":[{"id":9988,"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/posts\/9464\/revisions\/9988"}],"wp:attachment":[{"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/media?parent=9464"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/categories?post=9464"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/tags?post=9464"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}