{"id":2596,"date":"2023-01-19T13:52:09","date_gmt":"2023-01-19T05:52:09","guid":{"rendered":"http:\/\/www.hellofpga.com\/?p=2596"},"modified":"2023-04-23T10:57:47","modified_gmt":"2023-04-23T02:57:47","slug":"smart-zynq_lcd","status":"publish","type":"post","link":"http:\/\/www.hellofpga.com\/index.php\/2023\/01\/19\/smart-zynq_lcd\/","title":{"rendered":"Smart ZYNQ\u677f \u5de5\u7a0b\u4e8c\u5341\u516d \u7528zynq\u7684PS\u7684\u786c\u4ef6SPI\u8d44\u6e90\u9a71\u52a8\u5f69\u8272LCD"},"content":{"rendered":"\n<p>Smart ZYNQ\u4e3b\u677f\u4e0a\u81ea\u5e26\u4e00\u57571.47\u5bf8\u5f69\u8272\u663e\u793a\u5c4f\uff0c\u5206\u8fa8\u7387\u662f320X172\uff0c\u672c\u6587\u5c06\u901a\u8fc7ZYNQ\u7684PS\u8d44\u6e90\u53bb\u70b9\u4eae\u8fd9\u4e2a\u6db2\u6676\u5c4f\u5e55\uff0c\u5e76\u663e\u793a\u5f69\u8272\u6761\u7eb9<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1.\u786c\u4ef6\u4ecb\u7ecd<\/h2>\n\n\n\n<p>LCD \u63a5\u53e3\u5982\u4e0b\u56fe\u6240\u793a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-87.png\" alt=\"\" class=\"wp-image-2607\" width=\"503\" height=\"271\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-87.png 1024w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-87-300x162.png 300w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-87-768x414.png 768w\" sizes=\"auto, (max-width: 503px) 100vw, 503px\" \/><\/figure>\n\n\n\n<p>LCD_BLK\uff1aLCD\u80cc\u5149\uff08\u9ed8\u8ba4\u5e38\u4eae\uff09<\/p>\n\n\n\n<p>SPI \u4fe1\u53f7\uff1a CS \u7247\u9009\u4fe1\u53f7 SCL \u65f6\u949f SDA \u6570\u636e<\/p>\n\n\n\n<p>DC \uff1a\u6570\u636e\/\u547d\u4ee4 \u4fe1\u53f7<\/p>\n\n\n\n<p>RES \uff1a \u5c4f\u5e55\u590d\u4f4d \u4fe1\u53f7<\/p>\n\n\n\n<p>\u7ba1\u811a\u5b9a\u4e49\uff1aCS H18 ,D\/C J15 ,SCL H17 ,SDA F16 ,RES G14  ,LCD_BLK MIO27(LCD_BLK\u9ed8\u8ba4\u4e0d\u53bb\u63a7\u5236 \u80cc\u5149\u4e5f\u4f1a\u9ed8\u8ba4\u5e38\u4eae\u8f93\u51fa)<\/p>\n\n\n\n<p>\u9664\u4e86BLK\u80cc\u5149\u63a7\u5236\u4fe1\u53f7\u63a5\u5728PS\u7aef\uff0c\u5176\u4f59\u4fe1\u53f7\u90fd\u662f\u63a5\u5728ZYNQ\u7684PL\u7aef\uff08BLK\u4fe1\u53f7\u786c\u4ef6\u7535\u8def\u4e0a\u9ed8\u8ba4\u4f7f\u80fd\uff0cPS\u4e0d\u914d\u7f6eBLK\u7684\u60c5\u51b5\u4e0b ZYNQ\u7684\u5c4f\u5e55\u80cc\u5149\u4ecd\u7136\u5e38\u4eae\uff09<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>\u5f69\u8272\u6db2\u6676\u5c4f\u8d44\u6599\uff08\u5382\u5bb6\u63d0\u4f9b\u7684\u8d44\u6599\uff09 \u5e97\u94fa \u4e2d\u666f\u56ed\u7535\u5b50<\/strong><\/p>\n\n\n\n<p>\u94fe\u63a5\uff1ahttps:\/\/pan.baidu.com\/s\/110uz88iQMA7wl9vdqG9R9A&nbsp; &nbsp; \u63d0\u53d6\u7801\uff1a8888&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2.\u9a71\u52a8\u601d\u8def<\/h2>\n\n\n\n<p>\u5c4f\u5e55\u672c\u8eab\u662f\u8fde\u63a5\u5230ZYNQ\u7684PL\u8d44\u6e90\u4e0a\uff0c\u70b9\u4eae\u5c4f\u5e55\u53ef\u4ee5\u7528\u7eaffpga\u53bb\u9a71\u52a8SPI\u7684\u65b9\u5f0f\u70b9\u4eae\uff0c\u4e5f\u53ef\u4ee5\u7528PS\u8d44\u6e90\u53bb\u70b9\u4eae\uff0c\u4e3a\u4e86\u65b9\u4fbf\u6f14\u793a\uff0c\u8fd9\u91cc\u91c7\u7528PS\u8d44\u6e90\u53bb\u5b9e\u73b0<\/p>\n\n\n\n<p>\u901a\u8fc7EMIO\u7684\u65b9\u5f0f \u5c06PS\u90e8\u5206\u786c\u4ef6SPI\u8d44\u6e90\u6620\u5c04\u5230 ZYNQ\u7684PL\u53e3\u4e0a\u53bb\u70b9\u4eae\u5c4f\u5e55<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3.\u521b\u5efa\u5de5\u7a0b<\/h2>\n\n\n\n<p>1\uff09\u65b0\u5efa\u4e00\u4e2a\u9879\u76ee\uff0c\u82af\u7247\u578b\u53f7\u9009\u62e9\u6309\u4e0b\u9762\u9009\u62e9\uff08<strong>\u677f\u5b50\u751f\u4ea7\u4e86\u591a\u4e2a\u82af\u7247\u578b\u53f7<\/strong>\uff0c<strong>\u8bf7\u6839\u636e\u81ea\u5df1\u677f\u5b50\u7684\u578b\u53f7\u6765\u8fdb\u884c\u9009\u62e9<\/strong>\uff09<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>XA7Z020 (\u76f4\u63a5\u9009\u62e9<strong>xc7z020CLG400-1<\/strong>\uff0c\u56e0\u4e3a\u7cfb\u7edf\u8bc6\u522b\u5230\u7684\u662fxc7z020-1)<\/li>\n\n\n\n<li>XC7Z010-1 (xc7z010CLG400-1)&nbsp;<strong>\uff087010 \u82af\u7247\uff09<\/strong><\/li>\n\n\n\n<li>XC7Z020-1 (xc7z020CLG400-1)&nbsp;<strong>\u540e\u7eed\u751f\u4ea7<\/strong><\/li>\n\n\n\n<li>XC7Z020-2 (xc7z020CLG400-2)&nbsp;<strong>\u540e\u7eed\u751f\u4ea7<\/strong><\/li>\n<\/ul>\n\n\n\n<p><strong>\u5907\u6ce8<\/strong>&nbsp;\uff087020 \u8f66\u89c4\u7ea7\u7248\u5728vivado2018.3\u8bc6\u522b\u51fa\u7684\u662fXC7Z020\uff0c<strong>\u5982\u679c\u5de5\u7a0b\u9009\u62e9xa7z020 ,\u5728SDK\u73af\u5883\u4e0b\u6709\u65f6\u5019\u4f1a\u5f39\u51fa\u8b66\u544a<\/strong>\uff0c\u6240\u4ee5\u8fd9\u91cc\u76f4\u63a5\u9009\u62e9XC7Z020CLG400-1\uff09<\/p>\n\n\n\n<p>2) \u521b\u5efa\u4e00\u4e2aBLOCK\u8bbe\u8ba1\uff0c\u5e76\u6dfb\u52a0ZYNQ7 PROCESSING SYSTEM\u6a21\u5757\uff0c\u8f6f\u4ef6\u81ea\u52a8\u751f\u6210\u4e86\u4e00\u4e2a zynq\u7684block \u5982\u4e0b\u56fe\u6240\u793a\uff0c\u63a5\u4e0b\u6765\u8981\u505a\u4e00\u4e9b\u76f8\u5e94\u7684\u8bbe\u7f6e\uff0c\u53cc\u51fb\u4e0b\u56fe\u4e2d\u7684ZYNQ\u6838<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-3.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>3\uff09\u5728ZYNQ\u4e2d\u8bbe\u7f6e\u65f6\u949f\u529f\u80fd\uff1a<\/p>\n\n\n\n<p>\u627e\u5230 \u8bbe\u7f6e\u9879\u76ee\u4e2d\u7684 Clock Configuration \u9009\u9879\uff0c \u5728PL Fabric Clocks \u8bbe\u7f6e\u81ea\u5df1\u9700\u8981\u7684\u65f6\u949f\u9891\u7387\uff0c\u8fd9\u91cc\u4e00\u5171\u67094\u79cd\u9891\u7387\u53ef\u4ee5\u8bbe\u7f6e \u7c7b\u4f3c\u4e8e\u6211\u4eec\u7684PLL\u529f\u80fd\u3002\u8fd9\u91cc\u6211\u4eec\u8bbe\u7f6e50M\u65f6\u949f<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"960\" height=\"583\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-50.png\" alt=\"\" class=\"wp-image-264\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-50.png 960w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-50-300x182.png 300w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-50-768x466.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>4\uff09\u5728zynq\u4e2d\u8bbe\u7f6eDDR\u529f\u80fd\uff1a<\/p>\n\n\n\n<p>\u4f9d\u6b21\u5728\u5f39\u7a97\u91cc\u627e\u5230DDR Configuration\u2192DDR Controller Configuration\u2192DDR3\uff0c\u5728Memory Part\u4e0b\u62c9\u83dc\u5355\u4e2d\u6839\u636e\u81ea\u5df1\u677f\u5b50\u4e0a\u7684DDR\u6765\u9009\u62e9\u76f8\u5e94\u7684DDR3\uff0c\u672c\u5b9e\u9a8c\u6240\u7528\u5230\u578b\u53f7\uff1aMT41K256M16RE-125\uff0c\u6570\u636e\u4f4d\u5bbd\u9009\u62e916bit \u6700\u540e\u70b9\u51fb\u201cOK\u201d,\u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"788\" height=\"453\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-70.png\" alt=\"\" class=\"wp-image-2527\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-70.png 788w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-70-300x172.png 300w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-70-768x442.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>5)\u5728ZYNQ\u4e2d\u914d\u7f6eSPI\u529f\u80fd<\/p>\n\n\n\n<p>\u56e0\u4e3a\u5c4f\u5e55\u7684\u63a5\u53e3\u662f\u8fde\u63a5\u5230ZYNQ\u7684PL\u53e3\u4e0a\uff0c\u6240\u4ee5\u8fd9\u91cc\u6211\u4eec\u8c03\u7528EMIO\u7684SPI\u529f\u80fd\uff08\u5373\u4f7f\u7528PS\u7684SPI\u529f\u80fd\uff0c\u4f46\u662f\u5185\u90e8\u8fde\u63a5\u6620\u5c04\u5230PL\u7684GPIO\u53e3\u4e0a\uff09<\/p>\n\n\n\n<p>&nbsp;MIO Configuration\u2192SPI 0\u52fe\u4e0a \u5e76\u9009\u62e9EMIO<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"787\" height=\"564\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-60.png\" alt=\"\" class=\"wp-image-313\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-60.png 787w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-60-300x215.png 300w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-60-768x550.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>6\uff09\u7531\u4e8e\u5c4f\u5e55\u7684\u9a71\u52a8\u9664\u4e86SPI\u5916\uff0c\u8fd8\u9700\u89812\u4e2a\u989d\u5916\u7684GPIO\u53e3\u6765\u5206\u522b\u63a7\u5236\u590d\u4f4dRES\u548c D\/C\u4fe1\u53f7\uff0c\u6240\u4ee5\u8fd9\u91cc\u589e\u52a0\u4e24\u4e2aGPIO\u53e3\uff0c\u8fd9\u91ccGPIO\u8d44\u6e90\u9009\u62e9EMIO GPIO \u4f4d\u5bbdWidth\u9009\u62e92\uff08\u56e0\u4e3a\u662f2\u4e2aIO\u53e3\uff09<\/p>\n\n\n\n<p>5\uff09\u5b8c\u6210\u4e0a\u8ff0\u64cd\u4f5c\u540e\uff0c \u70b9\u51fb\u201cRun Block Automation\u201d\u5982\u4e0b\u56fe\u6240\u793a\u3002\u5728\u5f39\u51fa\u7684\u9009\u9879\u4e2d\u4fdd\u6301\u9ed8\u8ba4\uff0c\u70b9\u51fb\u201cOK\u201d\uff0c\u5373\u53ef\u5b8c\u6210\u5bf9ZYNQ7 Processing System\u7684\u914d\u7f6e\uff0c\u5e76\u7528\u9f20\u6807\u8fde\u63a5FCLK_CLK\u548c M_AXI_GP0_ACLK\uff0c\u5f97\u5230\u4e0b\u56fe<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"577\" height=\"265\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-64.png\" alt=\"\" class=\"wp-image-318\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-64.png 577w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-64-300x138.png 300w\" sizes=\"auto, (max-width: 577px) 100vw, 577px\" \/><\/figure>\n\n\n\n<p>\u5728\u4e0a\u56fe\u4e2d\u5206\u522b\u70b9\u51fbIO\u53e3\u8fdb\u884c\u4ee5\u4e0b\u64cd\u4f5c\uff1a<\/p>\n\n\n\n<p>\u53f3\u952eGPIO_0\u9009\u62e9Make External<\/p>\n\n\n\n<p>\u53f3\u952eSPI_0 \u9009\u62e9Make External<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"385\" height=\"350\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-65.png\" alt=\"\" class=\"wp-image-319\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-65.png 385w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-65-300x273.png 300w\" sizes=\"auto, (max-width: 385px) 100vw, 385px\" \/><\/figure>\n\n\n\n<p>6\uff09source\u2192Design Source \uff0c\u53f3\u952e\u6211\u4eec\u521b\u5efa\u7684BLOCK\u5de5\u7a0b\uff0c\u70b9\u51fbcreate HDL wrapper\uff0c\u6253\u5305BLOCK\u6587\u4ef6\u5e76\u751f\u6210.v\u4ee3\u7801<\/p>\n\n\n\n<p>\u8fd9\u65f6\u5019\u6211\u4eec\u53ef\u4ee5\u770b\u5230\u8f6f\u4ef6\u7684TOP\u5c42 \u7684verilog\u6587\u4ef6,\u6253\u5f00\u540e\u89c2\u5bdf\u7ba1\u811a\u4fe1\u53f7,\u5982\u4e0b\u56fe<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"257\" height=\"244\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-66.png\" alt=\"\" class=\"wp-image-320\"\/><figcaption class=\"wp-element-caption\">]<\/figcaption><\/figure>\n\n\n\n<p>\u5708\u5185\u7684\u51e0\u4e2a\u7ba1\u811a\u662f\u6211\u4eec\u4e4b\u524d\u5b9a\u4e49\u7684SPI \u7ba1\u811a,\u548cGPIO\u7ba1\u811a, \u5176\u4e2d<\/p>\n\n\n\n<p>\u5176\u4e2dspi_0_io0\u4e3a SPI\u7684MOSI\u4fe1\u53f7, spi_0_io1_io \u4e3aMISO\u4fe1\u53f7 ,SCK \u4e3aSPI\u65f6\u949f\u4fe1\u53f7, SS,SS1,SS2\u5206\u522b\u4e3a\u4e09\u7ec4SPI \u7684CS\u4fe1\u53f7<\/p>\n\n\n\n<p>GPIO_0_0\u4e3a\u521a\u624d\u5b9a\u4e49\u7684\u4e09\u4e2aGPIO (\u63a7\u5236\u5c4f\u5e55\u7684\u80cc\u5149, \u590d\u4f4d \u548cD\/C\u7528)<\/p>\n\n\n\n<p>7) \u56e0\u4e3a\u6211\u4eec\u7684\u5c4f\u5e55\u53ea\u7528\u5230\u4e86\u4e00\u7ec4CS \uff0c\u6240\u4ee5\u6211\u4eec\u5220\u9664\u591a\u4f59\u7684CS<\/p>\n\n\n\n<p>\u5c4f\u5e55\u5b9e\u9645\u53ea\u7528\u5230\u4e86 SPI\u7684\u6570\u636eSDA\u548c\u65f6\u949fSCL\u548cCS\u4e09\u4e2a\u4fe1\u53f7, \u6240\u4ee5SPI \u6211\u4eec\u53ea\u9700\u8981\u5f15\u51fa MOSI (SDA) \u548c SCK(SCL)\uff0c\u548cCS(SS)\u5373\u53ef<\/p>\n\n\n\n<p>\u5220\u9664\u5982\u4e0b\u6846\u56fe\u4e2d\u7684\u4fe1\u53f7\u7684\u4f4d\u7f6e<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"339\" height=\"177\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/04\/image-2.png\" alt=\"\" class=\"wp-image-629\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/04\/image-2.png 339w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/04\/image-2-300x157.png 300w\" sizes=\"auto, (max-width: 339px) 100vw, 339px\" \/><\/figure>\n\n\n\n<p>\u540c\u6837\u4e5f\u9700\u8981\u5220\u9664\u5185\u90e8 buf(\u5426\u5219 \u5916\u90e8\u7ba1\u811a\u4e0d\u8c03\u7528\u4f1a\u62a5\u9519)<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"323\" height=\"347\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/04\/image-4.png\" alt=\"\" class=\"wp-image-631\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/04\/image-4.png 323w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/04\/image-4-279x300.png 279w\" sizes=\"auto, (max-width: 323px) 100vw, 323px\" \/><\/figure>\n\n\n\n<p>8) \u70b9\u51fb\u7eff\u8272\u7bad\u5934RUN \u5bf9\u4ee3\u7801\u8fdb\u884c\u7f16\u8bd1<\/p>\n\n\n\n<p>9) \u70b9\u51fbRTL \u4e2d\u7684SCHEMATIC , \u5e76\u9009\u62e9\u53f3\u8fb9\u51fa\u73b0\u7684 IO Ports \u6765\u589e\u52a0SPI\u7684\u7ba1\u811a\u5b9a\u4e49(\u8fd9\u4e00\u6b65\u4e5f\u53ef\u4ee5\u5728\u7ea6\u675f\u6587\u4ef6\u4e2d\u5b9a\u4e49, \u53ef\u770b\u4e4b\u524d\u7684\u4f8b\u5b50)<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"411\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-69-1024x411.png\" alt=\"\" class=\"wp-image-324\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-69-1024x411.png 1024w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-69-300x120.png 300w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-69-768x308.png 768w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-69.png 1436w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>\u4fee\u6539GPIO \u7ba1\u811a\u5b9a\u4e49 \u548cSPI\u7ba1\u811a\u5b9a\u4e49,\u5982\u4e0b\u56fe\u6240\u793a ,\u4fee\u6539\u540e\u4fdd\u5b58(\u5982\u5f39\u51fa \u7a97\u53e3\u9700\u8981,\u5219\u5728\u7a97\u53e3\u4e2d\u8f93\u5165\u7ea6\u675f\u6587\u4ef6\u540d,\u7136\u540e\u4fdd\u5b58)<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"536\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-84-1024x536.png\" alt=\"\" class=\"wp-image-2598\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-84-1024x536.png 1024w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-84-300x157.png 300w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-84-768x402.png 768w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-84.png 1461w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>CS H18      D\/C J15      SCL H17    SDA F16     RES G14<\/p>\n\n\n\n<p>10) \u751f\u6210bit\u6587\u4ef6 :\u6309\u4e0bGenerate Bitstream \u5b8c\u6210\u7efc\u5408\u4ee5\u53ca\u751f\u6210bit\u6587\u4ef6<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"303\" height=\"203\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-18.png\" alt=\"\" class=\"wp-image-204\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-18.png 303w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-18-300x201.png 300w\" sizes=\"auto, (max-width: 303px) 100vw, 303px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">5.SDK\u7a0b\u5e8f\u7f16\u5199<\/h2>\n\n\n\n<p>1\uff09File\u2192Export\u2192Export hardware\u2026\uff0c\u5728\u5f39\u51fa\u7684\u5bf9\u8bdd\u6846\u4e2d\u52fe\u9009\u201cinclude bitstream\u201d\uff0c\u70b9\u51fb\u201cOK\u201d\u786e\u8ba4\uff0c\u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"462\" height=\"541\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-20.png\" alt=\"\" class=\"wp-image-207\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-20.png 462w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-20-256x300.png 256w\" sizes=\"auto, (max-width: 462px) 100vw, 462px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"332\" height=\"252\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-24.png\" alt=\"\" class=\"wp-image-211\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-24.png 332w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-24-300x228.png 300w\" sizes=\"auto, (max-width: 332px) 100vw, 332px\" \/><\/figure>\n\n\n\n<p>2\uff09File\u2192Lauch SDK\uff0c\u5728\u5f39\u51fa\u7684\u5bf9\u8bdd\u6846\u4e2d\uff0c\u4fdd\u5b58\u9ed8\u8ba4\uff0c\u70b9\u51fb\u201cOK\u201d\uff0c\u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"361\" height=\"285\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-21.png\" alt=\"\" class=\"wp-image-212\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-21.png 361w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-21-300x237.png 300w\" sizes=\"auto, (max-width: 361px) 100vw, 361px\" \/><\/figure>\n\n\n\n<p>\u7cfb\u7edf\u5c06\u81ea\u52a8\u6253\u5f00SDK\u5f00\u53d1\u73af\u5883<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"998\" height=\"748\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-22.png\" alt=\"\" class=\"wp-image-213\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-22.png 998w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-22-300x225.png 300w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-22-768x576.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>3\uff09\u65b0\u5efa\u4e00\u4e2a\u5de5\u7a0b file\u2192new\u2192Application Project\uff0c\u6765\u65b0\u5efa\u4e00\u4e2a\u201cApplication Project\u201d\uff0c\u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"546\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-23.png\" alt=\"\" class=\"wp-image-214\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-23.png 624w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-23-300x263.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p>4\uff09\u5728\u65b0\u5efa\u5de5\u7a0b\u540d\u4e2d\u8f93\u5165\u81ea\u5df1\u7684\u5de5\u7a0b\u540d\u79f0\uff0c\u70b9\u51fbNEXT<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"502\" height=\"251\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-75.png\" alt=\"\" class=\"wp-image-332\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-75.png 502w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-75-300x150.png 300w\" sizes=\"auto, (max-width: 502px) 100vw, 502px\" \/><\/figure>\n\n\n\n<p>5)\u9009\u62e9\u4e00\u4e2a\u7a7a\u5de5\u7a0b,\u70b9\u51fb\u5b8c\u6210<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"421\" height=\"194\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-73.png\" alt=\"\" class=\"wp-image-330\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-73.png 421w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-73-300x138.png 300w\" sizes=\"auto, (max-width: 421px) 100vw, 421px\" \/><\/figure>\n\n\n\n<p>6) \u5728\u7a7a\u5de5\u7a0b\u4e2d\u521b\u5efa\u6211\u4eec\u81ea\u5df1\u7684\u4ee3\u7801<\/p>\n\n\n\n<p>\u5c55\u5f00\u6211\u4eec\u521b\u5efa\u7684\u5de5\u7a0b,\u5728src\u76ee\u5f55\u4e0a\u53f3\u952e\uff0c\u9009\u62e9New-&gt;Source File\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"362\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-76.png\" alt=\"\" class=\"wp-image-333\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-76.png 640w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-76-300x170.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n\n\n\n<p>\u5728\u5f39\u51fa\u7684\u7a97\u53e3\u4e2d\u521b\u5efa\u4e00\u4e2amain.c\u6587\u4ef6<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"528\" height=\"422\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-77.png\" alt=\"\" class=\"wp-image-334\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-77.png 528w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-77-300x240.png 300w\" sizes=\"auto, (max-width: 528px) 100vw, 528px\" \/><\/figure>\n\n\n\n<p>6\uff09\u4e66\u5199\u81ea\u5df1\u7684\u4ee3\u7801<\/p>\n\n\n\n<p>6.1<strong>\u5c0f\u8d34\u58eb\uff1a<\/strong><\/p>\n\n\n\n<p>\u5728\u521d\u6b21\u5199PS\u90e8\u5206\u7684\u4ee3\u7801\u65f6\uff0c\u5982GPIO\u4ee3\u7801 \u548cSPI\u4ee3\u7801\uff0c\u4e0d\u77e5\u9053\u600e\u4e48\u5199\u7684\u60c5\u51b5\u4e0b\uff0c\u5176\u5b9e\u53ef\u4ee5\u901a\u8fc7\u6253\u5f00 BSP\u5de5\u7a0b\u4e0b\u7684 system.mss\u6587\u4ef6\uff0c \u7136\u540e\u5728\u53f3\u8fb9\u5bfc\u5165\u9700\u8981\u7684\u53c2\u8003\u4f8b\u7a0b\uff0c \u7136\u540e\u5c06\u4f8b\u7a0b\u4e2d\u81ea\u5df1\u9700\u8981\u7684\u90e8\u5206\uff08\u5982GPIO\u521d\u59cb\u5316\uff0c\u6216\u8005SPI\u7684\u5199\u548c\u8bfb\u4ee3\u7801COPY\u5230\u81ea\u5df1\u5de5\u7a0b\u7684main\u51fd\u6570\u4e2d\uff09<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"528\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-78-1024x528.png\" alt=\"\" class=\"wp-image-341\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-78-1024x528.png 1024w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-78-300x155.png 300w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-78-768x396.png 768w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-78.png 1149w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>6.2\u5b9a\u4e49GPIO\u90e8\u5206<\/p>\n\n\n\n<p>\u4e0b\u9762\u8fdb\u5165\u6b63\u9898\uff0c \u6211\u4eec\u8981\u70b9\u4eae\u5c4f\u5e55\uff0c \u5c4f\u5e55\u8fd9\u91cc\u7528\u4e863\u4e2aGPIO \u90fd\u662f\u7528\u4e86ZYNQ PS\u7aef\u7684EMIO\u8d44\u6e90\uff0c EMIO\u7684GPIO\u8d44\u6e90\u662f\u4ece54\u5f00\u59cb\u7684\uff0c \u6240\u4ee5\u6211\u4eec\u6839\u636eFPGA\u7ba1\u811a\u7ea6\u675f\u4e2d\u7684 GPIO 0-3 \u5206\u522b\u5bf9\u5e94 EMIO\u768454-55-56\uff0c\u5982\u4e0b\u56fe\u5bf9GPIO\u8fdb\u884c\u5b9a\u4e49<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#define EMIO_LCD_CD  \t54\n#define EMIO_LCD_RES \t55<\/pre>\n\n\n\n<p>\u63a5\u4e0b\u6765 \u7b80\u5355\u4ecb\u7ecd\u4e0bGPIO\u7684\u8c03\u7528<\/p>\n\n\n\n<p>a. GPIO\u7684\u521d\u59cb\u5316<\/p>\n\n\n\n<p>\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u9700\u8981\u5148\u5b9a\u4e49\u4e00\u4e2aXgpioPs \u7684\u7ed3\u6784\u4f53\u6307\u9488\uff0c \u8fd9\u4e2a\u6307\u9488\u7684\u5185\u5bb9\u5305\u62ecgpio\u5206\u914d\u7684ID\u548c\u57fa\u5730\u5740\uff0c\u8fd9\u4e9b\u4fe1\u606f\u901a\u5e38\u5728xparameter.h\u5934\u6587\u4ef6\u4e2d\uff0c \u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528XGpioPs_LookupConfig\u51fd\u6570\uff0c\u5b83\u80fd\u591f\u5728\u914d\u7f6e\u4fe1\u606f\u4e2d\u627e\u5230\u5bf9\u5e94ID\u7684\u914d\u7f6e\u4fe1\u606f<\/p>\n\n\n\n<p>ConfigPtr=XGpioPs_LookupConfig(GPIO_DEVICE_ID); \u5c31\u76f8\u5f53\u4e8e\u628a\u83b7\u5f97\u5230\u7684\u4fe1\u606f\u8d4b\u4e88\u7ed9\u4e4b\u524d\u5b9a\u4e49\u7684ConfigPtr\u7ed3\u6784\u4f53<\/p>\n\n\n\n<p>\u6700\u7ec8\u518d\u7528 XGpioPs_CfgInitialize \u51fd\u6570\u6765\u521d\u59cb\u5316GPIO<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">void Lcd_Gpio_Init(void){\n\tXGpioPs_Config *ConfigPtr;\n\n\tConfigPtr = XGpioPs_LookupConfig(GPIO_DEVICE_ID);\n\tXGpioPs_CfgInitialize(&amp;Gpio, ConfigPtr,ConfigPtr-&gt;BaseAddr);\n\n\tXGpioPs_SetDirectionPin(&amp;Gpio, EMIO_LCD_CD, 1);\n\tXGpioPs_SetOutputEnablePin(&amp;Gpio, EMIO_LCD_CD, 1);\n\n\tXGpioPs_SetDirectionPin(&amp;Gpio, EMIO_LCD_RES, 1);\n\tXGpioPs_SetOutputEnablePin(&amp;Gpio, EMIO_LCD_RES, 1);\n\n\tXGpioPs_WritePin(&amp;Gpio, EMIO_LCD_CD, 0);\n\tXGpioPs_WritePin(&amp;Gpio, EMIO_LCD_RES, 0);\n}<\/pre>\n\n\n\n<p>b.GPIO\u7684\u4f7f\u7528 \uff08EMIO_LCD_RES\u4e3a\u4e4b\u524d\u5b9a\u4e49\u7684 EMIO 54 \u7684\u7ba1\u811a\uff09<\/p>\n\n\n\n<p>XGpioPs_SetDirectionPin(&amp;Gpio, EMIO_LCD_RES, 1);\/\/\u8bbe\u7f6e\u6210\u8f93\u51fa\u6a21\u5f0f<br>XGpioPs_SetOutputEnablePin(&amp;Gpio, EMIO_LCD_RES, 1);\/\/\u6253\u5f00\u8f93\u51fa\u4f7f\u80fd<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>XGpioPs_WritePin(&amp;Gpio, EMIO_LCD_RES, 0);\/\/ 0\u7f6e\u4f4e\nXGpioPs_WritePin(&amp;Gpio, EMIO_LCD_RES, 1);\/\/ 1\u62c9\u9ad8\n\n<\/code><\/pre>\n\n\n\n<p>6.3 SPI\u90e8\u5206\u7684\u5b9a\u4e49 \uff0c\u548cGPIO\u7c7b\u4f3c SPI\u4e5f\u6709\u521d\u59cb\u5316\u548c\u4f7f\u7528\u4e24\u90e8\u5206<\/p>\n\n\n\n<p>a.SPI\u7684\u521d\u59cb\u5316 \u548cGPIO\u7c7b\u4f3c\uff0c\u4e5f\u662f\u5b9a\u4e49\u4e86\u4e00\u4e2a\u7ed3\u6784\u4f53\uff0c\u4e5f\u540c\u6837\u901a\u8fc7 LookupConfig \u6765\u83b7\u5f97\u5bf9\u5e94\u7684\u786c\u4ef6\u914d\u7f6e\u4fe1\u606f\uff0c \u6700\u7ec8\u7528 XSpiPs_CfgInitialize\u6765\u5b8c\u6210\u521d\u59cb\u5316\uff0c\u503c\u5f97\u6ce8\u610f\u7684\u662f\u7a0b\u5e8f\u5f53\u4e2d XSpiPs_SetClkPrescaler \u51fd\u6570\u662f\u7528\u6765\u4e3aSPI\u529f\u80fd\u63d0\u4f9b\u4e3b\u65f6\u949f\u7684\u5206\u9891\u7528\u7684\uff0c\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u9700\u8981\u7684\u901f\u7387\u9009\u62e9\u5206\u9891\u53c2\u6570<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">void Lcd_Spi_Init(){\n   XSpiPs_Config *SpiConfig;\n   SpiConfig = XSpiPs_LookupConfig(SPI_DEVICE_ID);\n   XSpiPs_CfgInitialize(&amp;SpiInstance, SpiConfig,\n\t\t\tSpiConfig-&gt;BaseAddress);\n\n   XSpiPs_SetOptions(&amp;SpiInstance, XSPIPS_MASTER_OPTION |\n\t\t\t\t   XSPIPS_FORCE_SSELECT_OPTION);\n   XSpiPs_SetClkPrescaler(&amp;SpiInstance,XSPIPS_CLK_PRESCALE_128);\n}<\/pre>\n\n\n\n<p>b.\u4f20\u8f93 \u4f20\u8f93\u662f\u7528 XSpiPs_PolledTransfer \u51fd\u6570\u8fdb\u884c\u7684\uff0c \u5176\u4e2d SendBufPtr \u662f\u53d1\u9001\u7684\u6570\u636e\uff0c RecvBufPtr \u662f\u63a5\u53d7\u7684\u6570\u636e\uff0c ByteCount \u53ef\u4ee5\u5b9a\u4e49\u6211\u4eec\u7684SPI \u662f8\u4f4d 16\u4f4d\u6216\u800532\u4f4d\uff0c\u4e0b\u9762\u662f\u8fd9\u4e2a\u51fd\u6570\u7684\u5b9a\u4e49<\/p>\n\n\n\n<p>s32 XSpiPs_PolledTransfer(XSpiPs *InstancePtr, u8 *SendBufPtr,<br>u8 *RecvBufPtr, u32 ByteCount)<\/p>\n\n\n\n<p>7\uff09\u4e0a\u9762\u7b80\u5355\u4ecb\u7ecd\u4e86PS\u90e8\u5206\u7684GPIO\u548c\uff0cSPI\u529f\u80fd\uff0c\u63a5\u4e0b\u6765\u5728main.c\u4e2d \u5b8c\u5584\u5c4f\u5e55\u7684\u4ee3\u7801\uff0c \u5c06\u4e0b\u9762\u7684\u5b8c\u6574\u4ee3\u7801\u590d\u5236\u5230\u5de5\u7a0b\u4e2d<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#include \"xparameters.h\"\n#include \"xgpiops.h\"\n#include \"xstatus.h\"\n#include \"xplatform_info.h\"\n#include \"xspips.h\"\n\n#include &lt;xil_printf.h&gt;\n\n#define WHITE         \t 0xFFFF\n#define BLACK         \t 0x0000\n#define BLUE         \t 0x001F\n#define BRED             0XF81F\n#define GRED \t\t \t 0XFFE0\n#define GBLUE\t\t \t 0X07FF\n#define RED           \t 0xF800\n#define MAGENTA       \t 0xF81F\n#define GREEN         \t 0x07E0\n#define CYAN          \t 0x7FFF\n#define YELLOW        \t 0xFFE0\n#define BROWN \t         0XBC40\n#define BRRED \t\t \t 0XFC07\n#define GRAY  \t\t \t 0X8430\n\n#define EMIO_LCD_CD  \t54\n#define EMIO_LCD_RES \t55\n\n\n#define GPIO_DEVICE_ID  \tXPAR_XGPIOPS_0_DEVICE_ID\n#define SPI_DEVICE_ID\t\tXPAR_XSPIPS_0_DEVICE_ID\n\nXGpioPs Gpio;\t\/* The driver instance for GPIO Device. *\/\nstatic XSpiPs SpiInstance;\n\n\nvoid Lcd_Gpio_Init(void){\n\tXGpioPs_Config *ConfigPtr;\n\n\tConfigPtr = XGpioPs_LookupConfig(GPIO_DEVICE_ID);\n\tXGpioPs_CfgInitialize(&amp;Gpio, ConfigPtr,ConfigPtr-&gt;BaseAddr);\n\n\tXGpioPs_SetDirectionPin(&amp;Gpio, EMIO_LCD_CD, 1);\n\tXGpioPs_SetOutputEnablePin(&amp;Gpio, EMIO_LCD_CD, 1);\n\n\tXGpioPs_SetDirectionPin(&amp;Gpio, EMIO_LCD_RES, 1);\n\tXGpioPs_SetOutputEnablePin(&amp;Gpio, EMIO_LCD_RES, 1);\n\n\tXGpioPs_WritePin(&amp;Gpio, EMIO_LCD_CD, 0);\n\tXGpioPs_WritePin(&amp;Gpio, EMIO_LCD_RES, 0);\n}\n\n\nvoid Lcd_Spi_Init(){\n\tXSpiPs_Config *SpiConfig;\n\n\tSpiConfig = XSpiPs_LookupConfig(SPI_DEVICE_ID);\n\tXSpiPs_CfgInitialize(&amp;SpiInstance, SpiConfig,\n\t\t\tSpiConfig-&gt;BaseAddress);\n\n\tXSpiPs_SetOptions(&amp;SpiInstance, XSPIPS_MASTER_OPTION |\n\t\t\t\t   XSPIPS_FORCE_SSELECT_OPTION);\n\tXSpiPs_SetClkPrescaler(&amp;SpiInstance, XSPIPS_CLK_PRESCALE_64);\n}\n\n\nvoid delay(unsigned char i){\n\tvolatile int Delay;\n\tvolatile int k;\n\tfor(k=0;k&lt;i;k++)\n\tfor (Delay = 0; Delay &lt; 10000; Delay++);\n}\n\nvoid LCD_WR_DATA8(u8 dat){\n\tXGpioPs_WritePin(&amp;Gpio, EMIO_LCD_CD, 1);\n\tXSpiPs_PolledTransfer(&amp;SpiInstance, &amp;dat, NULL, 1);\n}\n\nvoid LCD_WR_REG(u8 dat){\n\tXGpioPs_WritePin(&amp;Gpio, EMIO_LCD_CD, 0);\n\tXSpiPs_PolledTransfer(&amp;SpiInstance, &amp;dat, NULL, 1);\n}\n\n\n\n#define USE_HORIZONTAL 2\n\nvoid Lcd_Init(void){\n\tXGpioPs_WritePin(&amp;Gpio, EMIO_LCD_RES, 0);\n\tdelay(10);\n\tXGpioPs_WritePin(&amp;Gpio, EMIO_LCD_RES, 1);\n\tdelay(20);\n\tLCD_WR_REG(0x11);\n\tdelay(20);\n\tLCD_WR_REG(0x36);\n\tif(USE_HORIZONTAL==0)LCD_WR_DATA8(0x00);\n\telse if(USE_HORIZONTAL==1)LCD_WR_DATA8(0xC0);\n\telse if(USE_HORIZONTAL==2)LCD_WR_DATA8(0x70);\n\telse LCD_WR_DATA8(0xA0);\n\n\tLCD_WR_REG(0x3A);\n\tLCD_WR_DATA8(0x05);\n\n\tLCD_WR_REG(0xB2);\n\tLCD_WR_DATA8(0x0C);\n\tLCD_WR_DATA8(0x0C);\n\tLCD_WR_DATA8(0x00);\n\tLCD_WR_DATA8(0x33);\n\tLCD_WR_DATA8(0x33);\n\n\tLCD_WR_REG(0xB7);\n\tLCD_WR_DATA8(0x35);\n\n\tLCD_WR_REG(0xBB);\n\tLCD_WR_DATA8(0x35);\n\n\tLCD_WR_REG(0xC0);\n\tLCD_WR_DATA8(0x2C);\n\n\tLCD_WR_REG(0xC2);\n\tLCD_WR_DATA8(0x01);\n\n\tLCD_WR_REG(0xC3);\n\tLCD_WR_DATA8(0x13);\n\n\tLCD_WR_REG(0xC4);\n\tLCD_WR_DATA8(0x20);\n\n\tLCD_WR_REG(0xC6);\n\tLCD_WR_DATA8(0x0F);\n\n\tLCD_WR_REG(0xD0);\n\tLCD_WR_DATA8(0xA4);\n\tLCD_WR_DATA8(0xA1);\n\n\tLCD_WR_REG(0xD6);\n\tLCD_WR_DATA8(0xA1);\n\n\tLCD_WR_REG(0xE0);\n\tLCD_WR_DATA8(0xF0);\n\tLCD_WR_DATA8(0x00);\n\tLCD_WR_DATA8(0x04);\n\tLCD_WR_DATA8(0x04);\n\tLCD_WR_DATA8(0x04);\n\tLCD_WR_DATA8(0x05);\n\tLCD_WR_DATA8(0x29);\n\tLCD_WR_DATA8(0x33);\n\tLCD_WR_DATA8(0x3E);\n\tLCD_WR_DATA8(0x38);\n\tLCD_WR_DATA8(0x12);\n\tLCD_WR_DATA8(0x12);\n\tLCD_WR_DATA8(0x28);\n\tLCD_WR_DATA8(0x30);\n\n\tLCD_WR_REG(0xE1);\n\tLCD_WR_DATA8(0xF0);\n\tLCD_WR_DATA8(0x07);\n\tLCD_WR_DATA8(0x0A);\n\tLCD_WR_DATA8(0x0D);\n\tLCD_WR_DATA8(0x0B);\n\tLCD_WR_DATA8(0x07);\n\tLCD_WR_DATA8(0x28);\n\tLCD_WR_DATA8(0x33);\n\tLCD_WR_DATA8(0x3E);\n\tLCD_WR_DATA8(0x36);\n\tLCD_WR_DATA8(0x14);\n\tLCD_WR_DATA8(0x14);\n\tLCD_WR_DATA8(0x29);\n\tLCD_WR_DATA8(0x32);\n\n\tLCD_WR_REG(0x21);\n\n\tLCD_WR_REG(0x11);\n\tdelay(50);\n\tLCD_WR_REG(0x29);\n}\n\n\n\n\n void LCD_WR_DATA(u16 dat)\n{\n\tu8 spi_dat[2];\n\tXGpioPs_WritePin(&amp;Gpio, EMIO_LCD_CD, 1);\n    spi_dat[0]=dat&gt;&gt;8;\n    spi_dat[1]=dat;\n    XSpiPs_PolledTransfer(&amp;SpiInstance, spi_dat, NULL, 2);\n}\n\nvoid Address_set(unsigned int x1,unsigned int y1,unsigned int x2,unsigned int y2)\n{\n\tLCD_WR_REG(0x2a);\n\tLCD_WR_DATA(x1);\n\tLCD_WR_DATA(x2);\n\tLCD_WR_REG(0x2b);\n\tLCD_WR_DATA(y1+34);\n\tLCD_WR_DATA(y2+34);\n\tLCD_WR_REG(0x2c);\n}\n\n\n\nvoid LCD_Test()\n{\n    unsigned int i,j;\n    Address_set(0,0,320-1,172-1);\n\n    for(i=0;i&lt;172;i++){\n\n    \tif(i&gt;=0&amp;&amp;i&lt;43)\n    \t\tfor (j=0;j&lt;320;j++)LCD_WR_DATA(WHITE);\n\n    \telse if(i&gt;=43&amp;&amp;i&lt;86)\n    \t\tfor (j=0;j&lt;320;j++)LCD_WR_DATA(RED);\n\n    \telse if(i&gt;=86&amp;&amp;i&lt;129)\n    \t\tfor (j=0;j&lt;320;j++)LCD_WR_DATA(GREEN);\n\n    \telse if(i&gt;=129&amp;&amp;i&lt;172)\n    \t\tfor (j=0;j&lt;320;j++)LCD_WR_DATA(BLUE);\n    }\n}\n\n\nint main(void)\n{\n\tLcd_Gpio_Init();\n\tLcd_Spi_Init();\n\n\tLcd_Init();\n\tLCD_Test();\n\n\twhile(1){\n\t};\n\n\treturn XST_SUCCESS;\n} \n<\/pre>\n\n\n\n<p>8\uff09\u7528\u4e4b\u524d\u751f\u6210\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\u5bf9FPGA\u8fdb\u884c\u7f16\u7a0b\uff0c<code>Xilinx Tools<\/code>&nbsp;-&gt;&nbsp;<code>Program FPGA<\/code>&nbsp;\u7136\u540e\u70b9\u51fb \u201cProgram\u201d<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"307\" height=\"252\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-57.png\" alt=\"\" class=\"wp-image-293\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-57.png 307w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-57-300x246.png 300w\" sizes=\"auto, (max-width: 307px) 100vw, 307px\" \/><\/figure>\n\n\n\n<p>9\uff09\u5f53FPGA\u7f16\u7a0b\u6210\u529f\u540e\uff0c\u6211\u4eec\u9700\u8981\u521d\u59cb\u5316zynq\u4e2d\u7684\u5904\u7406\u5668\uff0c\u53f3\u952e\u70b9\u51fb\u521a\u624d\u521b\u5efa\u7684\u7a7a\u5de5\u7a0b\uff0c\u9009\u62e9<code>Run As<\/code>&nbsp;-&gt;&nbsp;<code>Launch on Hardware (System Debugger)<\/code>&nbsp;\u6216\u8005 Launch on Hardware (GDB).<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"703\" height=\"501\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-79.png\" alt=\"\" class=\"wp-image-347\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-79.png 703w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-79-300x214.png 300w\" sizes=\"auto, (max-width: 703px) 100vw, 703px\" \/><\/figure>\n\n\n\n<p>\u7ecf\u8fc7\u4e0a\u8ff0\u64cd\u4f5c\uff0c\u5c4f\u5e55\u5c31\u88ab\u6210\u529f\u70b9\u4eae\u4e86\uff0c \u6b63\u5e38\u663e\u793a 4\u8272\u5f69\u6761\u7eb9\uff0c\u5982\u4e0b\u56fe\u6240\u793a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"480\" height=\"744\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-88.png\" alt=\"\" class=\"wp-image-2612\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-88.png 480w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-88-194x300.png 194w\" sizes=\"auto, (max-width: 480px) 100vw, 480px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u4ee3\u7801\u89e3\u91ca<\/h2>\n\n\n\n<p>\u4ee5\u4e0a\u662f\u5b8c\u6574\u7684\u5de5\u7a0b\u56fe\u6587\u521b\u5efa\u8fc7\u7a0b\uff0c \u9664\u4e86\u4e0a\u9762\u63d0\u5230\u7684GPIO\u548c SPI\u90e8\u5206\u7684\u4ee3\u7801\u5916\uff0c\u4e0b\u9762\u7b80\u5355\u4ecb\u7ecd\u4e0b \u5de5\u7a0b\u4e2d\u7684\u5176\u4f59\u7684\u4e00\u4e9b\u51fd\u6570\u4ee3\u7801<\/p>\n\n\n\n<p>1\uff09\u5173\u4e8e\u989c\u8272<\/p>\n\n\n\n<p>\u5c4f\u5e55\u672c\u8eab\u662f16\u8272 \u4e5f\u5c31\u662fRGB565\u7684\u989c\u8272\u9a71\u52a8\u65b9\u5f0f \uff0c\u6240\u4ee5\u8fd9\u91cc\u53ef\u4ee5\u7528 16\u5b57\u8282\u6765\u5b9a\u4e49\u4e0d\u540c\u7684\u989c\u8272\uff0c\u5982\u7a0b\u5e8f\u4e2d\u7684\u7ea2\u7eff\u84dd\u767d\uff0c\u4ee5\u53ca\u4e0b\u9762\u6807\u6ce8\u7684\u5176\u4ed6\u989c\u8272\uff0c \u5f53\u7136\u4e5f\u53ef\u4ee5\u6839\u636eRGB\u7684\u989c\u8272\u7ec4\u5408\u6765\u5408\u6210\u81ea\u5df1\u9700\u8981\u7684\u989c\u8272<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#define WHITE         \t 0xFFFF\n#define BLACK         \t 0x0000\n#define BLUE         \t 0x001F\n#define BRED             0XF81F\n#define GRED \t\t 0XFFE0\n#define GBLUE\t\t 0X07FF\n#define RED           \t 0xF800\n#define MAGENTA       \t 0xF81F\n#define GREEN         \t 0x07E0\n#define CYAN          \t 0x7FFF\n#define YELLOW        \t 0xFFE0\n#define BROWN \t         0XBC40\n#define BRRED \t\t 0XFC07\n#define GRAY  \t\t 0X8430<\/pre>\n\n\n\n<p id=\"block-406e7490-888d-46bd-9c00-0bb3cd759e6e\">2)\u5173\u4e8e\u5f69\u8272\u6761\u7eb9 \uff0c\u5982\u4e0b\u4ee3\u7801\uff0c0-42\u884c\u663e\u793a\u767d\u8272\uff0c43-85\u663e\u793a\u7ea2\u8272\uff0c86-128\u663e\u793a\u7eff\u8272\uff0c129-172\u663e\u793a\u84dd\u8272<\/p>\n\n\n\n<p>Address_set(0,0,320-1,172-1); \u76f8\u5f53\u4e8e\u662f\u5b9a\u4e49\u4e00\u5757\u77e9\u5f62\u533a\u57df\uff0c0\uff0c0\uff0c320\uff0c172\u5206\u522b\u662f\u8fd9\u4e2a\u77e9\u5f62\u7684\u56db\u4e2a\u5750\u6807\u70b9\uff08\u8fd9\u91cc\u6db5\u76d6\u4e86\u6574\u4e2a\u5c4f\u5e55\u7684\u7a7a\u95f4\uff0c\u4e5f\u53ef\u4ee5\u81ea\u5b9a\u4e49\u90e8\u5206\u533a\u57df\uff0c\u8be6\u7ec6\u770b\u5c4f\u5e55\u624b\u518c\uff09<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">void LCD_Test()\n{\n    unsigned int i,j;\n    Address_set(0,0,320-1,172-1);\n\n    for(i=0;i&lt;172;i++){\n\n    \tif(i&gt;=0&amp;&amp;i&lt;43)\n    \t\tfor (j=0;j&lt;320;j++)LCD_WR_DATA(WHITE);\n\n    \telse if(i&gt;=43&amp;&amp;i&lt;86)\n    \t\tfor (j=0;j&lt;320;j++)LCD_WR_DATA(RED);\n\n    \telse if(i&gt;=86&amp;&amp;i&lt;129)\n    \t\tfor (j=0;j&lt;320;j++)LCD_WR_DATA(GREEN);\n\n    \telse if(i&gt;=129&amp;&amp;i&lt;172)\n    \t\tfor (j=0;j&lt;320;j++)LCD_WR_DATA(BLUE);\n    }\n}<\/pre>\n\n\n\n<p>\u6700\u540e\u4ecb\u7ecdmain \u51fd\u6570\uff0c\u5176\u5b9e\u7279\u522b\u7b80\u5355\uff0c\u5305\u62ecGPIO\u7684\u521d\u59cb\u5316\uff0cSPI\u7684\u521d\u59cb\u5316\uff0c \u4ee5\u53ca\u5c4f\u5e55\u7684\u521d\u59cb\u5316\uff08\u5c4f\u5e55\u5185\u90e8\u5bc4\u5b58\u5668\u7684\u914d\u7f6e \u914d\u7f6e\u4fe1\u606f\u7531\u5382\u5bb6\u76f4\u63a5\u63d0\u4f9b\uff09\uff0c\u4ee5\u53ca\u5c4f\u5e55\u6d4b\u8bd5\u51fd\u6570\u7684\u8c03\u7528<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">int main(void)\n{\n\tLcd_Gpio_Init();\n\tLcd_Spi_Init();\n\n\tLcd_Init();\n\tLCD_Test();\n\n\twhile(1);\n\n\treturn XST_SUCCESS;\n}<\/pre>\n\n\n\n<p>\u4ee5\u4e0b\u9644\u4ef6\u4e3a \u672c\u9875\u5185\u5bb9\u7684\u5b8c\u6574\u5de5\u7a0b<\/p>\n\n\n\n<div class=\"wp-block-file\"><a id=\"wp-block-file--media-c1ba929a-9c7b-4eeb-83e7-6b025bc4db96\" href=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/26_PS_LCD_TEST_XC7Z010_1.zip\">26_PS_LCD_TEST_XC7Z010_1<\/a><a href=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/26_PS_LCD_TEST_XC7Z010_1.zip\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-c1ba929a-9c7b-4eeb-83e7-6b025bc4db96\">\u4e0b\u8f7d<\/a><\/div>\n\n\n\n<div class=\"wp-block-file\"><a id=\"wp-block-file--media-0ee0d37a-d346-4604-ac12-6e0e65db8b70\" href=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/26_PS_LCD_TEST_XC7Z020_1.zip\">26_PS_LCD_TEST_XC7Z020_1<\/a><a href=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/26_PS_LCD_TEST_XC7Z020_1.zip\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-0ee0d37a-d346-4604-ac12-6e0e65db8b70\">\u4e0b\u8f7d<\/a><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>\u53e6\u5916\u5c4f\u5e55\u53ef\u4ee5\u6839\u636e\u9700\u6c42\u8bbe\u7f6e\u6210\u6a2a\u5c4f\u548c\u7ad6\u5c4f\u6a21\u5f0f<\/strong><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u5199\u5728\u6700\u540e\u5173\u4e8e\u80cc\u5149\u90e8\u5206:<\/p>\n\n\n\n<p>\u677f\u5b50\u4e0aPL\u90e8\u5206\u7684BANK34\u548cBANK35\u6240\u6709IO\u90fd\u7528\u5b8c\u4e86\uff0c\u6240\u4ee5\u677f\u5b50\u8bbe\u8ba1\u7684\u65f6\u5019 \u80cc\u5149\u5355\u72ec\u7531MIO\u63a7\u5236\uff0c\u800c\u4e0d\u662fPL\u63a7\u5236\uff0c \u6b63\u5e38\u8c03\u8bd5\u7684\u65f6\u5019 LCD\u80cc\u5149\u9ed8\u8ba4\u6253\u5f00\uff08\u5373\u4ec5\u4ec5\u7528PL\u5bf9\u5e94\u811a\u5c31\u80fd\u5b9e\u73b0\u6574\u4e2aLCD\u7684\u70b9\u5c4f\u64cd\u4f5c\uff0c\u5373\u80cc\u5149\u811a\u4e0d\u9700\u8981\u7ba1\u5b83\uff09\uff0c\u5f53\u6709\u4f4e\u529f\u8017\u8981\u6c42\uff0c\u6216\u4e0a\u7535\u9700\u8981\u5173\u95edLCD\u518d\u6253\u5f00\u7684\u8981\u6c42\u65f6\uff0c\u53ef\u4ee5\u5728PS\u4e0a\u5c06\u80cc\u5149\u5bf9\u5e94\u7684MIO\u5f15\u811a\u62c9\u4f4e\uff0c\u8fd9\u6837LCD\u5c4f\u5e55\u5c31\u4e0d\u518d\u53d1\u5149\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-85-1024x552.png\" alt=\"\" class=\"wp-image-2603\" width=\"438\" height=\"236\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-85-1024x552.png 1024w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-85-300x162.png 300w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-85-768x414.png 768w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-85.png 1151w\" sizes=\"auto, (max-width: 438px) 100vw, 438px\" \/><\/figure>\n\n\n\n<p>LCD_BLK\u5bf9\u5e94\u7684\u7ba1\u811a\u662fMIO27<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"631\" height=\"160\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-86.png\" alt=\"\" class=\"wp-image-2604\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-86.png 631w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2023\/01\/image-86-300x76.png 300w\" sizes=\"auto, (max-width: 631px) 100vw, 631px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Smart ZYNQ\u4e3b\u677f\u4e0a\u81ea\u5e26\u4e00\u57571.47\u5bf8\u5f69\u8272\u663e\u793a\u5c4f\uff0c\u5206\u8fa8\u7387\u662f320X172\uff0c\u672c\u6587\u5c06\u901a\u8fc7ZYNQ\u7684PS\u8d44\u6e90\u53bb\u70b9\u4eae\u8fd9\u4e2a\u6db2\u6676\u5c4f\u5e55\uff0c\u5e76\u663e\u793a\u5f69\u8272\u6761\u7eb9<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-2596","post","type-post","status-publish","format-standard","hentry","category-smart-zynq-board"],"views":1018,"_links":{"self":[{"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/posts\/2596","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=2596"}],"version-history":[{"count":17,"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/posts\/2596\/revisions"}],"predecessor-version":[{"id":3766,"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/posts\/2596\/revisions\/3766"}],"wp:attachment":[{"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/media?parent=2596"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/categories?post=2596"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/tags?post=2596"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}