FPGAに書き込めた

前にブログで「FPGAに書き込めない」と言っていましたが無事書き込めました。

jnory.hatenablog.com

動いた #Lチカ #FPGA #ice40

 

LatticeにはDiamond Programmerというツールがありまして、それを使ってFPGAに書き込むのですが、どうしてもエラーになって動きませんでした。

ERROR - Programming failed.
ERROR - Failed to Open FTDI USB port. Make sure to select the right cable type.
If you have not installed the FTDI Windows USB Driver, follow the instructions in the Programmer Help topic:
"Installing/Uninstalling Parallel Port Driver and USB Driver".
If you have installed the driver, if you recently plugged in the cable, please wait a few seconds and try again.
This will give the operating system time to recognize the cable.

 解決策

ice40にはOpen Sourceの書き込みツールicestormがあります。それを1度使うとDiamond Programmerも動くようになりました。

http://www.clifford.at/icestorm/

手順

  1. icestormのインストール*1
  2. FPGAをPCにつなげます
  3. icecube2で生成したbinファイル(bitmapファイル)をiceprogコマンドで書き込みます
  4. Diamond Programmerを起動します
  5. Diamond ProgrammerからFPGAに書き込みます

1度iceprogコマンドで書き込みを行っていれば、後はDiamond Programmerから何度でも書き込めるようです。

なぜ?

iceprogコマンド実行前後でlsmodコマンドを実行し比較すると、lpモジュールがロードされていることがわかりました。詳しいことはよくわからないのですが、lpモジュールはparallel port driverだそうなので、driver周りのエラーだったと言うことが推測できます。

 

ただし、iceprogコマンドの代わりにmodprobeコマンドでlpモジュールをロードしてみてもエラーは解消しませんでした。なのでlpモジュールが直接の原因というわけではなさそうです。(結局わからない) 

*1: https://github.com/nesl/ice40_examples が参考になります