Nios II之LED實驗(SDRAM+EPCS4配置)————基於DE0開發板
看了很多書,查了很多網上資料,看了黑金FPGA的視頻,終於實現了LED的實驗,感覺不錯!特發此博文
基本的不做黑金視頻教程的一樣,這里不多說,不過我要說明一個問題,就是EPCS4的配置,網上說了(包括Altera公司的解釋),其CycloneIII和CycloneII的EPCS配飾不一樣的。CycloneII是會在quartusII軟件里自動分配的,而CycloneIII是要自己手動配置的,具體的配置方法如下,(在我的Quartus II 8.1 Web Edition里成功!)
生成的kernel和cycloneII的有點不同,就是多了epcs的四個接口:
一開始還真是不知道該如何來分配器引腳,找了很久,終於找到:
In Cyclone® III devices, the EPCS controller does not automatically assign its output pins to the dedicated configuration pins on the FPGA. Instead, the output pins are exported to the top level design, giving users the flexibility to connect to any EPCS devices.
Therefore, in order to use the EPCS Configuration Controller the pins must be assigned manually, and the following settings must be made the Quartus® II software:
Choose Settings from the Assignments menu
Click Device and Pin Options from the Device category
Click Dual-Purpose Pins and then make the following changes:
Data[0] -> Use as regular I/O
Data[1] -> Use as regularr I/O
DCLK -> Use as regular I/O
FLASH_nCE/nCS0 -> Use as regular I/O
You must check the device Pin-Out file for the Cyclone III device which you are using to make the following pins assignments:
data0_to_the_epcs_controller -> DATA0
sdo_from the_epcs_controller -> DATA1,ASDO
dclk_from_epcs_controller -> DCLK
sce_from_the_epcs_controller -> FLASH_nCE
這樣在我的開發板的原理圖里找到了這四個引腳,然后在kernel里重新命名:
然后在tcl腳本文件里的四個引腳如下(具體的用法參見NiosII那些事兒):
#data0_to_the_epcs_controller -> DATA0 #sdo_from the_epcs_controller -> DATA1,ASDO #dclk_from_epcs_controller -> DCLK #sce_from_the_epcs_controller -> FLASH_nCE #EPCS PINS# set_location_assignment PIN_K1 -to DATA0 set_location_assignment PIN_K2 -to DCLK set_location_assignment PIN_E2 -to SCE set_location_assignment PIN_D1 -to SDO
然后還需要在quartusII軟件里設置一些選項:
打開assignments->device->device and pin options,在一下兩個選項開里修開,結果如下:
保存並編譯,這樣快接近成功了!
然后在NiosII-IDE8.1中的tools->quartusII programmer->在hardware setup里選擇usb-blaster,add file添加.sof文件,start。。。,咦。。。沒有翻反應啊。。。嘿嘿!在NiosII-IDE里右鍵工程文件->run as->hardware:
這樣就在開發板上有流水燈的效果了!!