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

How to use the CF in EP2C35(DEV kit)

Altera_Forum
Honored Contributor II
2,095 Views

Dear Hippo 

Thank you for your help ,now I have run the linux in my board . Now I want to use the CF card in my board. can you tell me how to do it .  

My board is the NIOSII EP2C35( altera DEV KIT ) .
0 Kudos
8 Replies
Altera_Forum
Honored Contributor II
919 Views

Hi Alex, 

 

You need to download the CF examples, 

http://forum.niosforum.com/downloads/cflash/cf5_0.zip (http://forum.niosforum.com/downloads/cflash/cf5_0.zip

 

Use the 2C35's sof and ptf in the examples design. 

In kernel config, select drivers->ata->altera CF
0 Kudos
Altera_Forum
Honored Contributor II
919 Views

Dear HIppo  

Now I have select drivers->ata->altera CF in kernel config, so I get The  

Next Information when the system boot.  

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

smc_probe: 85000 Khz Nios 

SMSC LAN91C111 Driver (v2.1), (Linux Kernel 2.6) 

eth0: SMC91C11xFD(rev:1) at 0x81000300 IRQ:6 MEMSIZE:8192b NOWAIT:0 ADDR: 00:07: 

ed:0f:61:8e 

smc_probe: 85000 Khz Nios 

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 

hda: Hitachi XXM2.3.0, CFA DISK drive 

ide0 at 0x81011000-0x81011007,0x81011038 on irq 7 

NET: Registered protocol family 2 

IP: routing cache hash table of 512 buckets, 4Kbytes 

TCP established hash table entries: 2048 (order: 2, 16384 bytes) 

TCP bind hash table entries: 2048 (order: 1, 8192 bytes) 

TCP: Hash tables configured (established 2048 bind 2048) 

NET: Registered protocol family 1 

Freeing unused kernel memory: 2036k freed (0x4160000 - 0x435c000) 

init started:  BusyBox v1.1.1-pre0 (2006.03.06-16:49+0000) multi-call binary 

 

 

BusyBox v1.1.1-pre0 (2006.03.06-16:49+0000) Built-in shell (msh) 

Enter &#39;help&#39; for a list of built-in commands. 

# [/b] 

--- Quote End ---  

 

the kerner have check the CF card .  

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

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

CF: ctl=1 

hda: Hitachi XXM2.3.0, CFA DISK drive 

ide0 at 0x81011000-0x81011007,0x81011038 on irq 7[/b] 

--- Quote End ---  

 

Now I shoud mount it  

but i don&#39;t know which node is the CF card. 

first i have select the VFAT in the kernel config 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

# cat /proc/filesystems 

nodev sysfs 

nodev rootfs 

nodev bdev 

nodev proc 

nodev sockfs 

nodev pipefs 

nodev futexfs 

nodev tmpfs 

nodev ramfs 

        vfat 

nodev autofs[/b] 

--- Quote End ---  

 

but i find i got the next error 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

# mount -t vfat /dev/hda /mnt 

mount: Mounting /dev/hda on /mnt failed: No such device or address# [/b] 

--- Quote End ---  

 

pls help me ! thanks!
0 Kudos
Altera_Forum
Honored Contributor II
919 Views

Did you format the CF card on XP? 

Try on nios2 linux, "fdisk /dev/hda".
0 Kudos
Altera_Forum
Honored Contributor II
919 Views

Do you have this in kernel config? 

<*> Include IDE/ATA-2 DISK support (NEW)
0 Kudos
Altera_Forum
Honored Contributor II
919 Views

Thanks hippo , now I have find i miss the  

<*> Include IDE/ATA-2 DISK support (NEW)  

now I config it i find the next information 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

hda: Hitachi XXM2.3.0, CFA DISK drive 

ide0 at 0x81011000-0x81011007,0x81011038 on irq 7 

hda: max request size: 128KiB 

hda: 31488 sectors (16 MB) w/1KiB Cache, CHS=246/4/32 

hda: hda1[/b] 

--- Quote End ---  

 

now I can find the hda1. 

beacuse the size of my CF card is small ,16M byte, I have format it in my pc . 

the fs format is FAT12 .  

 

when i mount the disk , i got the next inforamtion 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

mount -t vfat  /dev/hda1 /mnt 

hda: hda1 

FAT: codepage cp437 not found 

mount: Mounting /dev/hda1 on /mnt failed: Invalid argument[/b] 

--- Quote End ---  

 

 

 

now i have resolve the problem  

beacuse I have select the language support  

I select the native language support in menuconfig
0 Kudos
Altera_Forum
Honored Contributor II
919 Views

Hi ALL 

 

Now , I have mount the CF card into the linux . but i find when i create a file in the CF card , when i power off ,and then reboot the system and mount the CF card .but i can&#39;t the file . i want to know , does the fat system of linux have some problem???
0 Kudos
Altera_Forum
Honored Contributor II
919 Views

Check your mounts with "cat /etc/mtab", or "df" . 

 

You have to do "umount /mnt" or "shutdown" before power off. 

You can also use "sync" to flush disk cache after write files.
0 Kudos
Altera_Forum
Honored Contributor II
919 Views

Hippo thank you very much . i have write and read a file in CF card. 

the case is over?? 

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif  

I summary it  

if you want to use the CF card in nios2.  

 

1. You need to download the CF examples, 

http://forum.niosforum.com/downloads/cflash/cf5_0.zip (http://forum.niosforum.com/downloads/cflash/cf5_0.zip

 

Use the 2C35&#39;s sof and ptf in the examples design. 

In kernel config, select drivers->ata->altera CF 

<*> Include IDE/ATA-2 DISK support (NEW)  

 

select the native language support in menuconfig  

 

2. Mount it  

mount -t vfat /dev/hda1 /mnt 

3. when you write a file in card of cf ,you should make sure to be saved. 

so you to do "umount /mnt 

 

Beacuse I have only 2 month to learn the linux . hippo give me more help . thank you very much .
0 Kudos
Reply