e-tipsmemo

ごった煮

EZ-USB FX2 Bulkloop ②

e-tipsmemo.hatenablog.com

の続き。


CPUのクロックを48MHzに設定
http://www.cypress.com/file/126446/download
p83にクロックツリーの・ようなものがある。

The slave FIFO interface can be clocked from either an
internal or an external source. The EZ-USB’s internal clock
source can be configured to run at either 30 or 48 MHz, and
it can optionally be output on the interface clock (IFCLK) pin.
If the EZ-USB is configured to use an external clock source,
the IFCLK pin can be driven at any frequency between 5
MHz and 48 MHz. On a hard reset, the EZ-USB defaults to
the internal source at 48 MHz, normal polarity, with the
IFCLK output disabled. See Figure 9-6

IFCONFIGの8bit目はリセット時に1なので以下のようなクロックとなる。外部のロジックはIFCLK(かIFCLKの反転したもの)と同期して動かす。
f:id:katakanan:20180114143435p:plain

f:id:katakanan:20180103104645p:plain
この設定のいずれかになるように設定する。バッファのサイズが足りない場合は無視される。
EPを設定する場合は使うものから設定する
Config 11ならEP2(enable, size:1024 :Buf:3)->EP8(enable, size:512, Buf:2)->EP4(disable)->EP6(disable)
各設定の間にはレジスタに値が設定されるまで待つためのクロックサイクルが必要なので
SYNCDELAYを入れる。

AUTOPTRとは

■Set APTRnINC=0 to freeze the address pointer, APTRnINC=1 to automatically increment it for every read or write of an XAUTODATn register. This bit defaults to ‘1’, enabling the auto increment feature.
■To enable the autopointer, set APTREN=1. Enabling the Autopointers has one side-effect: any code access (an instruction
fetch, for instance) from addresses 0xE67B and 0xE67C return the AUTODATA values, rather than the code-memory values at these two addresses. This introduces a two-byte ‘hole’ in the code memory.

XAUTODATnを読んでいくとアドレスをインクリメントしてくれる機能らしい。

SlaveFIFOで使うならクロックの設定とEPの設定以外変更の必要はなさそう。(EPの設定もデフォルトで十分かもしれない)