Table of contents
No headers The CF component is in the later Quartus SOPC builder. But the standard example designs do not include it.
You may look at Compact Flash support for Nios II 5.0 . And add it to the example designs.
Regenerate in SOPC and compile again.
The CF controller component should be named as "cf", otherwise you have to modify linux-2.6/arch/nios2/kernel/config.c .
Use the new sof and ptf, do vendor_hwselect and menuconfig for the kernel, select scsi disk and pata platform driver, and we want FAT support in this example,
SCSI device support --->
[*] SCSI disk support
[*] Serial ATA (prod) and Parallel ATA (experimental) drivers -->
[ ] SATA Port Multiplier support <== unselect
[*] ATA SFF support
[*] Generic platform device PATA support
File systems -->
DOS/FAT/NT Filesystems --->
[*] MSDOS fs support
[*] VFAT (Windows-95) fs support
(437) Default codepage for FAT
(iso8859-1) Default iocharset for FAT
Native Language Support -->
(iso8859-1) Default NLS Option
[*] Codepage 437 (United States, Canada)
[*] NLS ISO 8859-1 (Latin 1; Western European Languages)
Rebuild the kernel image for initramfs, boot nios2 uClinux, and it should detected the cf drive. assume part1 on the CF, /dev/sda1, is preformated FAT,
scsi0 : pata_platform
ata1: PATA max PIO0 mmio cmd 0x1000000 ctl 0x1000038 irq 7
ata1.00: CFA: Flash Card, 2N3-0925, max PIO2
ata1.00: 503808 sectors, multi 0: LBA
ata1.00: configured for PIO
ata1.00: configured for PIO
ata1: EH complete
scsi 0:0:0:0: Direct-Access ATA Flash Card 2N3- PQ: 0 ANSI: 5
sd 0:0:0:0: [sda] 503808 512-byte hardware sectors (258 MB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
sd 0:0:0:0: [sda] 503808 512-byte hardware sectors (258 MB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
sda: sda1
sd 0:0:0:0: [sda] Attached SCSI removable disk
mount -t vfat /dev/sda1 /mnt
Or if the windows formats the CF without part,
mount -t vfat /dev/sda /mnt
after you finish the access, you must umount to flush the disk cache, or the data might lose.
umount /mnt
If you want to connect to IDE HDD or CD/DVDRW interface, fewer signals are required than CF. If you use Altera dev board, you may find some 40 pins headers which can be used to connect to IDE drives. You need to add CF component in SOPC builder, assign the pins, and regenerate sof.
.addr_from_the_cf_0 (da),
.cs_n_from_the_cf_0 (cs),
.data_cf_to_and_from_the_cf_0 (dd),
.detect_n_to_the_cf_0 (1'b0),
.intrq_to_the_cf_0 (intrq),
.iord_n_from_the_cf_0 (dior),
.iordy_to_the_cf_0 (iordy),
.iowr_n_from_the_cf_0 (diow),
.reset_n_cf_from_the_cf_0 (reset)