一乐电子

 找回密码
 请使用微信账号登录和注册会员

QQ登录

只需一步,快速开始

微信扫码登录

手机号码,快捷登录

手机号码,快捷登录

搜索
查看: 14792|回复: 0

Compact flash with nios II

[复制链接]
发表于 2008-12-14 21:31 | 显示全部楼层 |阅读模式
Readme - Compact flash monitor/debug demonstration
. z! V3 e1 ]$ C; wGENERAL DESCRIPTION:
* P0 L; S. n8 h1 I, O/ U/ f& ]0 bThis distribution contains hardware and software examples suitable for% l: g7 V9 }  a' v5 i; z
operation of the the Compact Flash interface (True IDE mode) peripheral . S, m/ O$ G1 h4 O
included in the Nios II 5.0 development kit. This peripheral's register
  @% e- z4 H; @9 C8 b% r& Kmap is equivalent to the compact flash interface previously posted to the
0 O* }# c: W* Owww.niosforum.com "Tested IP" area by Microtronix.
+ q! D& M3 ?7 o; M: R/ bHARDWARE EXAMPLE DESIGNS
  n7 g% g7 q" x2 c+ hIncluded with this distribution are several hardware example designs 1 G. N+ _6 S: P- [
illustrating how to connect Compact Flash pins to the I/O exported from! v/ \. l3 Y! z" a# U
the peripheral. The examples supplied are pre-built and tested on the( G1 s# ~: b" N7 E& S* i6 p) `
following development boards:
. q$ U+ I; E! ]% v0 h - Nios Development Board, Cyclone Edition (EP1C20)
7 ?' m0 F7 V+ A* |3 Z4 W( N, t! _ - Nios Development Board, Cyclone II Edition (EP2C35)
0 N, ~1 r5 Z" F$ b/ m, ^) S' O - Nios Development Board, Stratix Edition (EP1S40)
9 E( h0 c  H& o3 Z0 d0 E - Nios Development Board, Stratix II ES Edition (EP2S60ES)& ~& i& X" W+ e' {$ V

: G+ F( g  U' k, B# d  ~2 j, QFor users of the Nios Development Board, Stratix Edition (EP1S10 or EP1S10ES
! _  i1 n5 s+ D) S; hAltera devices), it is suggested that you start with the EP1S40 example design
7 Y) @; ]6 P* v1 s9 S! yand change SOPC Builder board component & Quartus device assignment, and then
+ J# N/ h* c( G2 h6 R6 h6 q- \re-compile the design. Do not remove I/O assignments; the I/O assignments for 4 F4 x+ J5 T; M6 e/ c
these three development boards are identical.
' P' {" I( z2 C8 R; a; lIn addition, the the Quartus project setting (.qsf) files included with each of8 `( a% v$ k; \
the above hardware examples includes pin-assignments for Compact Flash that you
3 @- u! Q/ p1 ?$ K. v* `1 S. `may easily copy to your own custom design that uses Compact Flash.5 B% U3 ^+ R+ }# f
Note: Hardware example designs in Nios II 5.0 included these same pin
2 E: k8 G9 P) \9 e! n2 Oassignments in each design., E, I& I. E9 x6 ?/ L
SOFTWARE EXAMPLES
- T6 p% M4 B5 lThe software included in this package allows rudimentary IDE access to
7 |2 c/ Y! Q7 K7 OCompact Flash, including debug routines, hot-swap capability, and 8 ]5 f" N8 e; N
the ability to read/write compact flash in either LBA or CHS addressing
: B! F' I0 R+ T$ `# g# y" _modes. No file system support is provided, though this example would
! }4 t* e0 m. o) x) @serve as a fine starting-point for a higher-level file-system interface.
4 e  C: i9 L. _+ F) x1 {! yAdditional software support for the Compact Flash interface is included- b% ?3 K  \  M' {3 ?1 r9 o7 b
in the eCOS release for Nios II 5.0, and Micrium MicroC/FS file system,
$ n8 l( Z8 i+ j* z/ g, F( Uboth of which have been tested with the Compact Flash interface
, d  N; q5 u: g( \$ {( |$ A) Eperipheral. These software interfaces do NOT require the software included, W1 J) w4 ^- j) j8 C
with distribution, but may be used with the hardware example designs  Z5 {7 h; x: [3 ^1 G" u" J
included with this distribution.
# \/ {; {  y- O3 s; T1 w9 \/ CTo build the software example design, open the Nios II IDE, create a new Nios * I7 G+ x0 `; {  y2 e
II C/C++ application (it is suggested that you start with a template such as 0 c3 v( }$ X2 U1 Y- v( U
"Hello World" or "Blank Project"), then, copy the source-files to the newly ' b$ K/ C* x# d% U) ]: d# j9 L8 o
created project directory and "refresh" the project contents in the IDE (F5).. x+ q  |, J/ z) X) q. i
Following this, you may build the application. The main() routine is located
7 R( d7 |1 I% Uin file cf_test.c
% J" j# g9 Z9 X1 @% l/ wNote: If you start with hello world, be sure to remove hello_world.c to prevent0 |' {9 j) c" ^  {* r
conflicts during compilation.7 {, B& {9 ?4 B5 R
REQUIREMENTS:) f; j3 {% ?1 s; Q) P" `
The example software requires an altera_avalon_cf peripheral named "cf" % y2 m- r8 D# Z, |  j$ s% R
instantiated in your SOPC Builder design. In addition, the default LCD 4 [( J7 E3 H; J% o" @
interface that is included in "standard" and "full_featured" Nios II example * K9 l) o  X/ J+ y
designs may not be used, as it shares pins with the compact flash socket.
% L( X, w9 z+ ?/ t% Z. H8 lThe hardware example designs included with this distribution conform to the  t/ ?" S5 m" M. o7 Q: q- X. g
above requirements.$ b1 R$ e9 K  R; W+ W8 ?3 D: m
KNOWN ISSUES & WORKAROUNDS:
- _! L( U# q$ PEvery effort has been made to make both the Compact Flash interface peripheral
1 ]! v" m1 K$ `; I+ s+ `) `- Xand software examples perform without flaws. However, certain known issues' T3 H  B+ [  R$ N7 T  e
may prevent Compact Flash card access. - b8 M5 Z1 k, m; [: i- I& \
The following are relevant excerpts from the Nios II 5.0 errata discussing
: A- t3 I3 s6 N: mCompact Flash:
% x: R  I$ r- v8 W; U* L - Intermittent failures while accessing Compact Flash card6 `. `& Z8 U( w8 G8 P' Z, t9 E
; r1 q: m4 E- U! f
    Nios II 5.0 includes a Compact Flash controller peripheral suitable for ( x0 C8 Z( b2 J
    interfacing to Compact Flash cards in True IDE mode on Nios development
+ ]! f0 Q/ [# Z5 X    boards. In order for True IDE mode to operate, Compact Flash cards require 6 j3 a* S; |: e1 K; T+ F
    that the "ATASEL_N" input be driven to ground during power-up.! p. d. O! _( \! n  A1 f/ a
    The Compact Flash controller peripheral includes a configurable power
0 c! h, o- R* L) X    register used to power-cycle Compact Flash cards in Nios II software
7 a% ]( ], T/ h- ]5 m    through a MOSFET on the Nios development boards. However, in certain 9 z0 ?3 N1 e+ [2 T6 y- q% h
    development boards, power to the Compact Flash card will not be turned , M: H4 C, r2 M$ O; S
    off completely during this power-cycle operation. Because of this, the
2 J" |- s% z  J0 L( h: z* A    "ATASEL_N" pin may not be sampled during the power-cycle operation after
8 y# r4 Z& ?/ y7 `! C  I    FPGA configuration when this pin is driven to ground. Instead, "ATASEL_N"
5 y! l1 n. |" r, L# T    may be sampled by the Compact Flash card when power is first applied to
. A  l+ }$ x1 i0 {3 Z    the development board, when I/O are not yet driven by the FPGA (before 8 l: A  c- Q8 _. D
    FPGA configuration).
. o; D5 r* N; [: h( a9 w  _    Workaround:  If you encounter errors with Compact Flash when using the
3 C; \* P3 S5 w' ^    Nios development boards, please try one of the following workarounds:
9 k' _8 x$ g4 G* [        * Try a different Compact Flash card -- Certain cards are more
* _( T: o% H, H5 S& S          susceptible to the power-cycling issue than others.
8 B3 N0 U' Q, u! b1 u7 c) ~        * Modify the Nios development board -- This is recommended for
. ~" ?* ?4 o: S' Z$ v! W          users who are familiar and comfortable with board-level
* N4 P7 ?  S4 x0 b          modifications. Disconnect pin 9 (ATASEL_N) on the Compact Flash
( }. L) `6 L% |( U' k          socket on your Nios Development Board and tie this pin to ground. 5 l3 q# F: q2 e' A
          Note that the Compact Flash socket uses a staggered numbering on
: ]8 t2 w& h" ]. Q  B          the pins (starting from pin 1: 1, 26, 2, 27, ...); please refer 5 G; q+ v4 \1 h0 d
          to the Compact Flash Association specification for right-angle
/ w5 V# O; v" ]# l          surface-mount connectors for exact specifications on this connector.   F" ]1 G! k  P/ ^. B' F: l7 p, D
          Caution: This will permanently enable True-IDE mode operation.9 y. b8 Y6 z# i* R% }
- Compact Flash card and LCD screen do not work concurrently# L" s: _# q/ a/ P
    If there is a Compact Flash card inserted in the development board, the , O  x) T3 |+ M9 t$ h# \( s+ N- `
    LCD and other devices connected to the PROTO1 header might not work./ L6 z' T+ t! s: r1 C6 A0 {
    Workaround: Remove the Compact Flash card to ensure proper operation of ' p6 v6 o" c/ ]4 o4 ]
    the PROTO1 header, or vice versa.* ?2 C, G$ U" ^$ q  O
& w  F* r7 c' m% i% B5 c

" {, [2 ?4 D& c% y2 b% `( T4 l在网上找到一个相当不错的CF控制器有兴趣可以研究一下

cf5_0.zip

1.53 MB, 下载次数: 697, 下载积分: 一乐金币 -1

本版积分规则

QQ|一淘宝店|手机版|商店|一乐电子 ( 粤ICP备09076165号 ) 公安备案粤公网安备 44522102000183号

GMT+8, 2025-10-28 12:44 , Processed in 0.030559 second(s), 21 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表