Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
21 years ago

how to use CF card in uclinux?

I use cyclone board and the system detected CF card, but have error.

so I can't format CF card use command: fdisk /dev/hda

help me!

thanks a lot.

16 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I use stratix board,when i first use CF card,the massage i received from the shell is:

    CF: ctl=1

    while i reboot ,we get the massage as following:

    CF: ctl=11

    please tell me why? and i can not find the document i have created in CF card before.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by xlking@Dec 16 2004, 04:18 AM

    i use cyclone board and the system detected cf card, but have error.

    so i can't format cf card use command: fdisk /dev/hda

    help me!

    thanks a lot.

    --- Quote End ---

    Let's assume for a moment that it's a problem with uClinux rather than with your Nios project.

    If uClinux recognized the cf card and was able to tell you the brand name and size, then it is able to read the card. # hda: SanDisk SDCFB-8, CFA DISK drive

    ide0 at 0x80900800-0x80900807,0x80900838 on irq 8

    hda: max request size: 128KiB

    hda: 15680 sectors (8 MB) w/1KiB Cache, CHS=245/2/32

    hda: hda1

    I had the same error:

    Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2

    ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx

    CF: ctl=1

    Unable to initialize compact flash card. Please re-insert

    Using anticipatory io scheduler

    uClinux may be trying to read the cf configuration before the card is ready. There is a note in the documentation somewhere saying not to boot with the cf installed. Try installing the cf after the system has initialized and you've logged in.

    I assume that you were able to mount the cf.# mount /dev/hda1 /mnt/ide0 -n

    It might get hosed if you don't unmount before removing it.# umount /dev/hda1

    fdisk: fdisk makes all documents go away.

    If the cf filesystem gets messed up, you may want to reformat it in your computer instead. I use the soyo bayone xp internal 9 in 1 card reader (http://www.amazon.com/exec/obidos/asin/b00024paou/pendulumresource). Dazzle also makes several nice external USB card readers.

    There is a caveat in the documentation somewhere against writing to the cf. I was able to write to it, though.

    I hope that helps.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    I tried compiling the "cf_ide_test" project in the downloaded CDcomponent.zip but got lots of compiling errors; I do NOT need to install Linux , do I ???

    Have you been able to compile CFcomponent successfully ?

    I tried it for 1S40fullfeatured using NIOSII V1.01 but

    got compile errors (see below); did you have to modify

    any code (eg how did you# define CF_IDE_BASE , "cf",.... and the file altera_avalon_cf_regs.h is installed but the compile didn't see it)

    and which version of NIOSII you used? maybe V1.01 is too

    new?)

    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' 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' ideutils.c

    cf_ide_test_0_1s40 line 78

    Error error: `CF_CTL_BASE' 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' ideutils.c

    cf_ide_test_0_1s40 line 86

    Error error: `ALTERA_AVALON_CF_CTL_STATUS_PRESENT_MSK'

    undeclared (first use in this function) ideutils.c

    cf_ide_test_0_1s40 line 87

    Error error: `CF_IDE_BASE' 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'

    ideutils.c cf_ide_test_0_1s40 line 120

    Error error: `CF_IDE_BASE' 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' ideutils.c

    cf_ide_test_0_1s40 line 165

    Error error: `CF_IDE_BASE' undeclared (first use in

    this function) ideutils.c cf_ide_test_0_1s40 line 195

    Error error: `CF_IDE_BASE' undeclared (first use in

    this function) ideutils.c cf_ide_test_0_1s40 line 216

    Error error: `CF_IDE_BASE' undeclared (first use in

    this function) ideutils.c cf_ide_test_0_1s40 line 237

    Error error: `CF_IDE_BASE' undeclared (first use in

    this function) ideutils.c cf_ide_test_0_1s40 line 257

    Error error: `CF_IDE_BASE' 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' ideutils.c

    cf_ide_test_0_1s40 line 289

    Warning implicit declaration of function

    `IOWR_ALTERA_AVALON_CF_IDE_DEVICE_CONTROL' ideutils.c

    cf_ide_test_0_1s40 line 293

    Warning implicit declaration of function

    `IORD_ALTERA_AVALON_CF_IDE_SECTOR_COUNT' ideutils.c

    cf_ide_test_0_1s40 line 378

    Warning implicit declaration of function

    `IORD_ALTERA_AVALON_CF_IDE_SECTOR_NUMBER' ideutils.c

    cf_ide_test_0_1s40 line 379

    Warning implicit declaration of function

    `IORD_ALTERA_AVALON_CF_IDE_CYLINDER_LOW' ideutils.c

    cf_ide_test_0_1s40 line 380

    Warning implicit declaration of function

    `IORD_ALTERA_AVALON_CF_IDE_CYLINDER_HIGH' ideutils.c

    cf_ide_test_0_1s40 line 381

    Warning implicit declaration of function

    `IORD_ALTERA_AVALON_CF_IDE_DEVICE_HEAD' ideutils.c

    cf_ide_test_0_1s40 line 382

    Error error: `CF_IDE_BASE' undeclared (first use in

    this function) ideutils.c cf_ide_test_0_1s40 line 415

    Error error: `CF_IDE_BASE' 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' ideutils.c

    cf_ide_test_0_1s40 line 513

    Error error: `CF_IDE_BASE' 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' ideutils.c

    cf_ide_test_0_1s40 line 556

    Warning implicit declaration of function

    `IOWR_ALTERA_AVALON_CF_IDE_SECTOR_NUMBER' ideutils.c

    cf_ide_test_0_1s40 line 557

    Warning implicit declaration of function

    `IOWR_ALTERA_AVALON_CF_IDE_CYLINDER_LOW' ideutils.c

    cf_ide_test_0_1s40 line 558

    Warning implicit declaration of function

    `IOWR_ALTERA_AVALON_CF_IDE_CYLINDER_HIGH' ideutils.c

    cf_ide_test_0_1s40 line 559

    Warning implicit declaration of function

    `IOWR_ALTERA_AVALON_CF_IDE_COMMAND' ideutils.c

    cf_ide_test_0_1s40 line 566

    Error error: `CF_IDE_BASE' undeclared (first use in

    this function) ideutils.c cf_ide_test_0_1s40 line 591

    Error error: `CF_IDE_BASE' 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' ideutils.c

    cf_ide_test_0_1s40 line 670

    Error error: `CF_IDE_BASE' undeclared (first use in

    this function) ideutils.c cf_ide_test_0_1s40 line 810

    Error error: `CF_IDE_BASE' undeclared (first use in

    this function) ideutils.c cf_ide_test_0_1s40 line 970

    Error error: `CF_IDE_BASE' undeclared (first use in

    this function) ideutils.c cf_ide_test_0_1s40 line 1080

    Error error: `CF_CTL_BASE' undeclared (first use in

    this function) ideutils.c cf_ide_test_0_1s40 line 1216

    Error error: `ALTERA_AVALON_CF_CTL_STATUS_PRESENT_MSK'

    undeclared (first use in this function) ideutils.c

    cf_ide_test_0_1s40 line 1217

    Error error: `CF_IDE_BASE' undeclared (first use in

    this function) ideutils.c cf_ide_test_0_1s40 line 1242

    Error error: `ALTERA_AVALON_CF_CTL_STATUS_POWER_MSK'

    undeclared (first use in this function) ideutils.c

    cf_ide_test_0_1s40 line 1943

    Error error: `CF_CTL_BASE' 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' ideutils.c

    cf_ide_test_0_1s40 line 1943

    Error error: `CF_IDE_BASE' undeclared (first use in

    this function) ideutils.c cf_ide_test_0_1s40 line 1954

    Error error: `CF_CTL_IRQ' 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'

    undeclared (first use in this function) ideutils.c

    cf_ide_test_0_1s40 line 1979

    Error error: `CF_IDE_IRQ' 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'

    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' ideutils.c

    cf_ide_test_0_1s40 line 1983

    Error error: `CF_CTL_BASE' undeclared (first use in

    this function) ideutils.c cf_ide_test_0_1s40 line 1999

    Error error: `CF_IDE_IRQ' undeclared (first use in

    this function) ideutils.c cf_ide_test_0_1s40 line 2002

    Error error: `CF_CTL_IRQ' undeclared (first use in

    this function) ideutils.c cf_ide_test_0_1s40 line 2003
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by niosfan@Jan 7 2005, 12:37 PM

    hi,

    i tried compiling the "cf_ide_test" project in the downloaded cdcomponent.zip but got lots of compiling errors; i do not need to install linux , do i ???

    have you been able to compile cfcomponent successfully ?

    i tried it for 1s40fullfeatured using niosii v1.01 but

    got compile errors (see below); did you have to modify

    any code (eg how did you# define cf_ide_base , "cf",.... and the file altera_avalon_cf_regs.h is installed but the compile didn't see it)

    and which version of niosii you used? maybe v1.01 is too

    new?)

    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

    <snip>

    --- Quote End ---

    Nope, I didn&#39;t try to compile the project that came with the cf_component. I believe I used linux.ptf for my development board. I don&#39;t know what you&#39;d use for an S40 development board.

    Look for the# defines here.

    C:\ALTERA\kits\nios2\components\altera_avalon_cf\inc

    Opinions now, since I don&#39;t have the answer:

    Linux has support for the cf&#39;s VFAT filesystem. Your software must support VFAT - not just the IDE interface, but a real live PC-readable filesystem - to use the cf card properly.

    Make sense?

    Unfortunately, the kernal and filesystem projects I created in November no longer work. http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/ohmy.gif How distressing. I&#39;ll be coming back to it next week, I hope.

    Maybe one of the experts can get more detailed info for you.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi dennis

    can you give me the pins alloction of the CF in the stratix 10E board.

    Thank you !
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    To Dennis and Ken,

    Could you help with this problem symptom I faced when trying your CF_component zip files (after modifying pinout to work with my ALtera Stratix2 2s60ES board and recompile in Quartus to get my working linux.sof; note my software doesn&#39;t have Linux kernel, just your ideutils.c, idemon.c files):

    -1)(in function IDE_inititalize) these 10 writes/verfies using this command are successful :

    IOWR_ALTERA_AVALON_CF_IDE_SECTOR_NUMBER(ide_base, ucWrite);

    -2)the insertion and removal interrupts of the CFcard seem to work OK and reliably

    -3)but , in your file ideutils.c function "IDE_identifyDevice" , when reading CF register "alternate status register" to poll for DRDY line to be High , this line never goes High which caused the function call "IDE_identifyDevice" to fail. Does this indicate a hardware (eg pinout or CFcard itself) or software problem?

    Thanks for your help!!!

    Note: 2 related symptoms are:

    a) in step 1, the 10 writes/verifies ALSO PASSed even if I DELETED (in function "IDE_initialize") the command to turn ON the MOSFET power to CF :

    IOWR_ALTERA_AVALON_CF_CTL_CONTROL(ctl_base, ALTERA_AVALON_CF_CTL_STATUS_POWER_MSK);

    Why is this possible? Do you expect CFcard to work without this Power_on command?

    http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/cool.gif when first run the software(before any write) , DRDY is actually High , but then any write command to CF (eg write to SECTOR_NUMBER register as in step#1) would cause DRDY to stuck low forever