Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12745 Discussions

Compact Flash Card problem

Altera_Forum
Honored Contributor II
2,230 Views

I am trying to implemnent the CF Card in my Nios system. 

But there is not any reference about it.  

Should I write a driver for it and prepare the subroutine? or there is already one? 

 

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/huh.gif Thanks a lot!!
0 Kudos
13 Replies
Altera_Forum
Honored Contributor II
1,010 Views

Microtronix has a compact flash component in the Tested IP section of this forum. I would give it a try before writing my own driver... 

 

Cheers, 

 

- slacker
0 Kudos
Altera_Forum
Honored Contributor II
1,010 Views

Also, there is a flash component in sopc builder , add it to the system, add a tristate bridge, then generate and re-compile in Quartus (adding pins to the bdf as needed). (or see another reference design to see how Altera did it).

0 Kudos
Altera_Forum
Honored Contributor II
1,010 Views

Thanks a lot!  

to kerri, where is the altera reference design of compact flash?
0 Kudos
Altera_Forum
Honored Contributor II
1,010 Views

ok, for Nios I it should be standard design, for Nios II it would be the full-featured. 

 

Kerri
0 Kudos
Altera_Forum
Honored Contributor II
1,010 Views

Hi kerri, 

 

Aren&#39;t those altera reference designs using only the on-board flash chip (AMD flash in StratixII Edition of NiosII DevKit)?  

Do they also include hardware/software for accessing the Compact Flash card? 

What is the exact name of the altera provided SOPC component that is described in altera web pages (NiosII peripherals) as Compact Flash Interface ? 

 

Thank you
0 Kudos
Altera_Forum
Honored Contributor II
1,010 Views

Hi, 

Has anybody here tried the compact flash component in the Tested IP section? 

Does it work on a cyclone dev kit? 

;O)
0 Kudos
Altera_Forum
Honored Contributor II
1,010 Views

In the source code for ideutils.c There is the following.... 

# define ctl_base (int*)CF_CTL_BASE# define ctl_irq (int)CF_CTL_IRQ# define ide_base (int*)CF_IDE_BASE# define ide_irq (int)CF_IDE_IRQ 

 

whereas in the documentation it says simple... 

# define ide_base <SOPC-name>_IDE_BASE# define ide_irq <SOPC-name>_IDE_IRQ# define ctl_base <SOPC-name>_CTL_BASE# define ctl_irq <SOPC-name>_CTL_IRQ 

 

why the (int*) cast?
0 Kudos
Altera_Forum
Honored Contributor II
1,010 Views

Is there a cut & strap recommended to ensure to get true-IDE mode on the nios cyclone dev-board?

0 Kudos
Altera_Forum
Honored Contributor II
1,010 Views

Hello Joe90 

 

I&#39;ve used the Microtronix CF component as they appear in this forum on a design that uses a CF running on the Nios Cyclone developement board. They work just fine and I also have FAT16 support. 

 

Regards 

Nir
0 Kudos
Altera_Forum
Honored Contributor II
1,010 Views

 

--- Quote Start ---  

originally posted by joe90@Dec 30 2004, 07:54 PM 

is there a cut & strap recommended to ensure to get true-ide mode on the nios cyclone dev-board? 

--- Quote End ---  

 

Does anyone have the the cut and strap fix of the dev board CF power circuit for true-ide mode? 

Thanks, 

Murph
0 Kudos
Altera_Forum
Honored Contributor II
1,010 Views

Hi all, 

 

I would like to share the CF data/address bus via a tristate bridge? 

 

But the option(s) do not appear on SOPC Builder to allow me to connect to the shared bus? 

 

Any ideas? 

 

Thanks! 

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/wink.gif
0 Kudos
Altera_Forum
Honored Contributor II
1,010 Views

To Kerri, Joe90 and Anagnost, 

-Have you been able to compile successfully the CFcomponent zip file&#39;s project "cf_ide_test"? 

I tried it for 1S40fullfeatured using NIOSII V1.01 but got compile errors (see below); did you have to modify any code (eg# define CF_IDE_BASE , "cf",....) and which version of NIOSII you used? maybe V1.01 is too new?) 

 

-besides this test, does ALtera have any other test to verify the inserted CFcard works or not? 

The "board_diag" project in the installation only test the onboard flash chip, not the CFcard 

Thanks # #################################################### 

 

Error *** [obj/ideutils.o] Error 1 cf_ide_test_0_1s40  

Error # error This IDE utility requires a CompactFlash Interface component named "cf" ideutils.c cf_ide_test_0_1s40 line 16 

Error altera_avalon_cf_regs.h: No such file or directory ideutils.c cf_ide_test_0_1s40 line 29 

Error error: `CF_IDE_BASE&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 78 

Error error: (Each undeclared identifier is reported only once ideutils.c cf_ide_test_0_1s40 line 78 

Warning implicit declaration of function `IORD_ALTERA_AVALON_CF_IDE_STATUS&#39; ideutils.c cf_ide_test_0_1s40 line 78 

Error error: `CF_CTL_BASE&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 86 

Warning implicit declaration of function `IORD_ALTERA_AVALON_CF_CTL_STATUS&#39; ideutils.c cf_ide_test_0_1s40 line 86 

Error error: `ALTERA_AVALON_CF_CTL_STATUS_PRESENT_MSK&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 87 

Error error: `CF_IDE_BASE&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 120 

Warning implicit declaration of function `IORD_ALTERA_AVALON_CF_IDE_ALTERNATE_STATUS&#39; ideutils.c cf_ide_test_0_1s40 line 120 

Error error: `CF_IDE_BASE&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 150 

Warning implicit declaration of function `IORD_ALTERA_AVALON_CF_IDE_ERROR&#39; ideutils.c cf_ide_test_0_1s40 line 165 

Error error: `CF_IDE_BASE&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 195 

Error error: `CF_IDE_BASE&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 216 

Error error: `CF_IDE_BASE&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 237 

Error error: `CF_IDE_BASE&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 257 

Error error: `CF_IDE_BASE&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 289 

Warning implicit declaration of function `IOWR_ALTERA_AVALON_CF_IDE_DEVICE_HEAD&#39; ideutils.c cf_ide_test_0_1s40 line 289 

Warning implicit declaration of function `IOWR_ALTERA_AVALON_CF_IDE_DEVICE_CONTROL&#39; ideutils.c cf_ide_test_0_1s40 line 293 

Warning implicit declaration of function `IORD_ALTERA_AVALON_CF_IDE_SECTOR_COUNT&#39; ideutils.c cf_ide_test_0_1s40 line 378 

Warning implicit declaration of function `IORD_ALTERA_AVALON_CF_IDE_SECTOR_NUMBER&#39; ideutils.c cf_ide_test_0_1s40 line 379 

Warning implicit declaration of function `IORD_ALTERA_AVALON_CF_IDE_CYLINDER_LOW&#39; ideutils.c cf_ide_test_0_1s40 line 380 

Warning implicit declaration of function `IORD_ALTERA_AVALON_CF_IDE_CYLINDER_HIGH&#39; ideutils.c cf_ide_test_0_1s40 line 381 

Warning implicit declaration of function `IORD_ALTERA_AVALON_CF_IDE_DEVICE_HEAD&#39; ideutils.c cf_ide_test_0_1s40 line 382 

Error error: `CF_IDE_BASE&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 415 

Error error: `CF_IDE_BASE&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 495 

Warning implicit declaration of function `IORD_ALTERA_AVALON_CF_IDE_DATA&#39; ideutils.c cf_ide_test_0_1s40 line 513 

Error error: `CF_IDE_BASE&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 556 

Warning implicit declaration of function `IOWR_ALTERA_AVALON_CF_IDE_SECTOR_COUNT&#39; ideutils.c cf_ide_test_0_1s40 line 556 

Warning implicit declaration of function `IOWR_ALTERA_AVALON_CF_IDE_SECTOR_NUMBER&#39; ideutils.c cf_ide_test_0_1s40 line 557 

Warning implicit declaration of function `IOWR_ALTERA_AVALON_CF_IDE_CYLINDER_LOW&#39; ideutils.c cf_ide_test_0_1s40 line 558 

Warning implicit declaration of function `IOWR_ALTERA_AVALON_CF_IDE_CYLINDER_HIGH&#39; ideutils.c cf_ide_test_0_1s40 line 559 

Warning implicit declaration of function `IOWR_ALTERA_AVALON_CF_IDE_COMMAND&#39; ideutils.c cf_ide_test_0_1s40 line 566 

Error error: `CF_IDE_BASE&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 591 

Error error: `CF_IDE_BASE&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 632 

Warning implicit declaration of function `IOWR_ALTERA_AVALON_CF_IDE_DATA&#39; ideutils.c cf_ide_test_0_1s40 line 670 

Error error: `CF_IDE_BASE&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 810 

Error error: `CF_IDE_BASE&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 970 

Error error: `CF_IDE_BASE&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 1080 

Error error: `CF_CTL_BASE&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 1216 

Error error: `ALTERA_AVALON_CF_CTL_STATUS_PRESENT_MSK&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 1217 

Error error: `CF_IDE_BASE&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 1242 

Error error: `ALTERA_AVALON_CF_CTL_STATUS_POWER_MSK&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 1943 

Error error: `CF_CTL_BASE&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 1943 

Warning implicit declaration of function `IOWR_ALTERA_AVALON_CF_CTL_CONTROL&#39; ideutils.c cf_ide_test_0_1s40 line 1943 

Error error: `CF_IDE_BASE&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 1954 

Error error: `CF_CTL_IRQ&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 1977 

Error error: `ALTERA_AVALON_CF_CTL_STATUS_IRQ_EN_MSK&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 1979 

Error error: `CF_IDE_IRQ&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 1982 

Error error: `ALTERA_AVALON_CF_IDE_CTL_IRQ_EN_MSK&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 1983 

Warning implicit declaration of function `IOWR_ALTERA_AVALON_CF_IDE_CTL&#39; ideutils.c cf_ide_test_0_1s40 line 1983 

Error error: `CF_CTL_BASE&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 1999 

Error error: `CF_IDE_IRQ&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 2002 

Error error: `CF_CTL_IRQ&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 2003
0 Kudos
Altera_Forum
Honored Contributor II
1,010 Views

 

--- Quote Start ---  

originally posted by niosfan@Jan 6 2005, 04:25 PM 

to kerri, joe90 and anagnost, 

-have you been able to compile successfully the cfcomponent zip file&#39;s project "cf_ide_test"? 

i tried it  for 1s40fullfeatured  using niosii v1.01 but got  compile errors (see below);  did you have to modify any code (eg# define  cf_ide_base  ,  "cf",....)  and which version of niosii you used? maybe v1.01 is too new?) 

 

-besides this test, does altera have any other test to verify the inserted cfcard works or not? 

the "board_diag" project in the installation  only test the onboard flash chip, not the cfcard 

thanks # #################################################### 

 

error  *** [obj/ideutils.o] error 1 cf_ide_test_0_1s40   

error  # error this ide utility requires a compactflash interface component named "cf" ideutils.c cf_ide_test_0_1s40 line 16 

error  altera_avalon_cf_regs.h: no such file or directory ideutils.c cf_ide_test_0_1s40 line 29 

error  error: `cf_ide_base&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 78 

error  error: (each undeclared identifier is reported only once ideutils.c cf_ide_test_0_1s40 line 78 

warning  implicit declaration of function `iord_altera_avalon_cf_ide_status&#39; ideutils.c cf_ide_test_0_1s40 line 78 

error  error: `cf_ctl_base&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 86 

warning  implicit declaration of function `iord_altera_avalon_cf_ctl_status&#39; ideutils.c cf_ide_test_0_1s40 line 86 

error  error: `altera_avalon_cf_ctl_status_present_msk&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 87 

error  error: `cf_ide_base&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 120 

warning  implicit declaration of function `iord_altera_avalon_cf_ide_alternate_status&#39; ideutils.c cf_ide_test_0_1s40 line 120 

error  error: `cf_ide_base&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 150 

warning  implicit declaration of function `iord_altera_avalon_cf_ide_error&#39; ideutils.c cf_ide_test_0_1s40 line 165 

error  error: `cf_ide_base&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 195 

error  error: `cf_ide_base&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 216 

error  error: `cf_ide_base&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 237 

error  error: `cf_ide_base&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 257 

error  error: `cf_ide_base&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 289 

warning  implicit declaration of function `iowr_altera_avalon_cf_ide_device_head&#39; ideutils.c cf_ide_test_0_1s40 line 289 

warning  implicit declaration of function `iowr_altera_avalon_cf_ide_device_control&#39; ideutils.c cf_ide_test_0_1s40 line 293 

warning  implicit declaration of function `iord_altera_avalon_cf_ide_sector_count&#39; ideutils.c cf_ide_test_0_1s40 line 378 

warning  implicit declaration of function `iord_altera_avalon_cf_ide_sector_number&#39; ideutils.c cf_ide_test_0_1s40 line 379 

warning  implicit declaration of function `iord_altera_avalon_cf_ide_cylinder_low&#39; ideutils.c cf_ide_test_0_1s40 line 380 

warning  implicit declaration of function `iord_altera_avalon_cf_ide_cylinder_high&#39; ideutils.c cf_ide_test_0_1s40 line 381 

warning  implicit declaration of function `iord_altera_avalon_cf_ide_device_head&#39; ideutils.c cf_ide_test_0_1s40 line 382 

error  error: `cf_ide_base&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 415 

error  error: `cf_ide_base&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 495 

warning  implicit declaration of function `iord_altera_avalon_cf_ide_data&#39; ideutils.c cf_ide_test_0_1s40 line 513 

error  error: `cf_ide_base&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 556 

warning  implicit declaration of function `iowr_altera_avalon_cf_ide_sector_count&#39; ideutils.c cf_ide_test_0_1s40 line 556 

warning  implicit declaration of function `iowr_altera_avalon_cf_ide_sector_number&#39; ideutils.c cf_ide_test_0_1s40 line 557 

warning  implicit declaration of function `iowr_altera_avalon_cf_ide_cylinder_low&#39; ideutils.c cf_ide_test_0_1s40 line 558 

warning  implicit declaration of function `iowr_altera_avalon_cf_ide_cylinder_high&#39; ideutils.c cf_ide_test_0_1s40 line 559 

warning  implicit declaration of function `iowr_altera_avalon_cf_ide_command&#39; ideutils.c cf_ide_test_0_1s40 line 566 

error  error: `cf_ide_base&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 591 

error  error: `cf_ide_base&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 632 

warning  implicit declaration of function `iowr_altera_avalon_cf_ide_data&#39; ideutils.c cf_ide_test_0_1s40 line 670 

error  error: `cf_ide_base&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 810 

error  error: `cf_ide_base&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 970 

error  error: `cf_ide_base&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 1080 

error  error: `cf_ctl_base&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 1216 

error  error: `altera_avalon_cf_ctl_status_present_msk&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 1217 

error  error: `cf_ide_base&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 1242 

error  error: `altera_avalon_cf_ctl_status_power_msk&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 1943 

error  error: `cf_ctl_base&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 1943 

warning  implicit declaration of function `iowr_altera_avalon_cf_ctl_control&#39; ideutils.c cf_ide_test_0_1s40 line 1943 

error  error: `cf_ide_base&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 1954 

error  error: `cf_ctl_irq&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 1977 

error  error: `altera_avalon_cf_ctl_status_irq_en_msk&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 1979 

error  error: `cf_ide_irq&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 1982 

error  error: `altera_avalon_cf_ide_ctl_irq_en_msk&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 1983 

warning  implicit declaration of function `iowr_altera_avalon_cf_ide_ctl&#39; ideutils.c cf_ide_test_0_1s40 line 1983 

error  error: `cf_ctl_base&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 1999 

error  error: `cf_ide_irq&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 2002 

error  error: `cf_ctl_irq&#39; undeclared (first use in this function) ideutils.c cf_ide_test_0_1s40 line 2003 

--- Quote End ---  

 

hi  

you have to change the name  

for example  

you compactflash card name is cf_0 

you should change "cf_ide_irq" to "cf_0_ide_irq"
0 Kudos
Reply