Forum Discussion
Altera_Forum
Honored Contributor
20 years agoUSB device!
I have a usb flash disk, I want to using it on my board, I choose USB Mass storage and SCSI disk and ISA116X driver support in menuconfig. Start uClinux on NIOS II SDK shell, using dmesg, I got these message:
# dmesg Linux version 2.6.11-uc0 ([email protected]) (gcc version 3.4.6)# 11 Sa t Apr 15 17:52:30 CST 2006 uClinux/Nios II Altera Nios II support © 2004 Microtronix Datacom Ltd. setup_arch: No persistant network settings signature at 008F0000 On node 0 totalpages: 2048 DMA zone: 2048 pages, LIFO batch:1 Normal zone: 0 pages, LIFO batch:1 HighMem zone: 0 pages, LIFO batch:1 Built 1 zonelists Kernel command line: PID hash table entries: 64 (order: 6, 1024 bytes) Dentry cache hash table entries: 2048 (order: 1, 8192 bytes) Inode-cache hash table entries: 1024 (order: 0, 4096 bytes) Memory available: 6188k/8192k RAM, 0k/0k ROM (1334k kernel code, 551k data) Calibrating delay loop... 24.72 BogoMIPS (lpj=123648) Mount-cache hash table entries: 512 (order: 0, 4096 bytes) NET: Registered protocol family 16 SCSI subsystem initialized usbcore: registered new driver usbfs usbcore: registered new driver hub Serial: JTAG UART driver $Revision: 1.4 $ ttyJ0 at MMIO 0x81004000 (irq = 1) is a jtag_uart io scheduler noop registered io scheduler deadline registered dmfe_probe:eth0, 50000 Khz Nios <DM9000> eth0 I/O: 80900090, VID: 90000a46 ADDR: 00:07:ed:00:00:00 dmfe_probe:eth1, 50000 Khz Nios Linux video capture interface: v1.00 116x: driver isp116x-hcd, 08 Apr 2005 116x: ISP116x Host Controller, irq 4 isp116x-hcd isp116x-hcd: new USB bus registered, assigned bus number 1 116x: Invalid chip ID 3630 isp116x-hcd isp116x-hcd: USB bus 1 deregistered 116x: init error, -19 Initializing USB Mass Storage driver... usbcore: registered new driver usb-storage USB Mass Storage support registered. NET: Registered protocol family 2 IP: routing cache hash table of 512 buckets, 4Kbytes TCP established hash table entries: 512 (order: 0, 4096 bytes) TCP bind hash table entries: 512 (order: -1, 2048 bytes) TCP: Hash tables configured (established 512 bind 512) NET: Registered protocol family 1 NET: Registered protocol family 17 Freeing unused kernel memory: 436k freed (0x15e000 - 0x1ca000)# I plug my usb flash disk in my board usb host port, there is no message appear! How could I to find the usb disk?43 Replies
- Altera_Forum
Honored Contributor
for kernel config,
drivers->scsi->scsi disk support drivers->usb->usb devices filesystem, usb mass storage . and you need vfat support as in CF drive. This is the log of my usb host on pci, <div class='quotetop'>QUOTE </div> --- Quote Start --- hub 8-0:1.0: USB hub found hub 8-0:1.0: 2 ports detected Initializing USB Mass Storage driver... scsi0 : SCSI emulation for USB Mass Storage devices usbcore: registered new driver usb-storage USB Mass Storage support registered. Freeing unused kernel memory: 372k freed (0x17e000 - 0x1da000) init started: BusyBox v1.2.0-pre0 (2006.04.26-14:48+0000) multi-call binary BusyBox v1.2.0-pre0 (2006.04.26-14:48+0000) Built-in shell (msh) Enter 'help' for a list of built-in commands. # Vendor: Multi Model: Flash Reader Rev: 1.00 Type: Direct-Access ANSI SCSI revision: 00 SCSI device sda: 1997312 512-byte hdwr sectors (1023 MB) sda: assuming Write Enabled sda: assuming drive cache: write through SCSI device sda: 1997312 512-byte hdwr sectors (1023 MB) sda: assuming Write Enabled sda: assuming drive cache: write through sda: sda1 Attached scsi removable disk sda at scsi0, channel 0, id 0, lun 0[/b] --- Quote End --- - Altera_Forum
Honored Contributor
--- Quote Start --- originally posted by goral@Apr 28 2006, 11:52 AM hi, hippo :this message i've got
<div class='quotetop'>quote
--- quote end ---
--- quote start ---
# fdisk -l /dev/sda
disk /dev/sda: 134 mb, 134070272 bytes
2 heads, 32 sectors/track, 4091 cylinders
units = cylinders of 64 * 512 = 32768 bytes
device boot start end blocks id system
/dev/sda1 1 4090 130864 4 fat16 <32m# mount -t vfat /dev/sda1 /mnt
mount: mounting /dev/sda1 on /mnt failed: no such device# --- Quote End --- After I try to operate like sda1 as sda: <div class='quotetop'>QUOTE </div> --- Quote Start --- # fdisk -l /dev/sda1 Disk /dev/sda1: 134 MB, 134004736 bytes 5 heads, 52 sectors/track, 1006 cylinders Units = cylinders of 260 * 512 = 133120 bytes Device Boot Start End Blocks Id System /dev/sda1p1 ? 6546149 12813521 814758329+ 74 Unknown Partition 1 has different physical/logical beginnings (non-Linux?): phys=(288, 110, 36) logical=(6546148, 2, 41) Partition 1 has different physical/logical endings: phys=(366, 104, 37) logical=(12813520, 1, 31) Partition 1 does not end on cylinder boundary. /dev/sda1p2 ? 5116094 7189079 269488144 65 Unknown Partition 2 has different physical/logical beginnings (non-Linux?): phys=(107, 121, 32) logical=(5116093, 0, 13) Partition 2 has different physical/logical endings: phys=(10, 121, 13) logical=(7189078, 3, 44) Partition 2 does not end on cylinder boundary. /dev/sda1p3 ? 2073037 7451356 699181456 53 Unknown Partition 3 has different physical/logical beginnings (non-Linux?): phys=(345, 32, 19) logical=(2073036, 0, 32) Partition 3 has different physical/logical endings: phys=(324, 77, 19) logical=(7451355, 0, 3) Partition 3 does not end on cylinder boundary. /dev/sda1p4 ? 15035072 15035323 32669+ bb Unknown Partition 4 has different physical/logical beginnings (non-Linux?): phys=(65, 1, 0) logical=(15035071, 2, 3) Partition 4 has different physical/logical endings: phys=(96, 0, 7) logical=(15035322, 3, 29) Partition 4 does not end on cylinder boundary. Partition table entries are not in disk order# [/b] --- Quote End --- Maybe the disk wasn't work? Could I try other device to replcae the usb flash disk to test the ISP1362? <div align='right'><{post_snapback}> (index.php?act=findpost&pid=14792)</div> [/b] --- Quote End --- From your result, the isp1362 should work. The usb disk is detected, and partition table is correct. did you enable vfat in kernel config as in step16 of the buildroot guide?
- Altera_Forum
Honored Contributor
Hi, hippo
Thank for your help, my usb flash disk was working now,, these is my message using on DE II board: <div class='quotetop'>QUOTE </div> --- Quote Start --- # usb 1-2: new full speed USB device using isp1362-hcd and address 2 usb 1-2: Product: USB Mass Storage usb 1-2: Manufacturer: USB Mass Storage usb 1-2: SerialNumber: ABCDEF123456789 usb 1-2: configuration# 1 chosen from 1 choice scsi0 : SCSI emulation for USB Mass Storage devices Vendor: USB-disk Model: FREEDIK-LWFORMAT Rev: 1.06 Type: Direct-Access ANSI SCSI revision: 00 SCSI device sda: 261856 512-byte hdwr sectors (134 MB) sda: Write Protect is off sda: assuming drive cache: write through SCSI device sda: 261856 512-byte hdwr sectors (134 MB) sda: Write Protect is off sda: assuming drive cache: write through sda:<7>usb-storage: queuecommand called sda1 sd 0:0:0:0: Attached scsi removable disk sda # mount -t vfat /dev/sda1 /mnt# cd /mnt# ls DE2_UserManual.pdf# [/b] --- Quote End --- I only changed two place in isp1362-hcd.c <div class='quotetop'>QUOTE </div> --- Quote Start --- static int isp1362_hc_reset(struct usb_hcd *hcd) { int ret = 0; struct isp1362_hcd *isp1362_hcd = hcd_to_isp1362_hcd(hcd); unsigned long t; unsigned long timeout = 20; unsigned long flags; int clkrdy = 0; ret = 1; INFO("%s:\n", __FUNCTION__); if (isp1362_hcd->board && isp1362_hcd->board->reset) { isp1362_hcd->board->reset(hcd->self.controller, 1); msleep(20); if (isp1362_hcd->board->clock) { isp1362_hcd->board->clock(hcd->self.controller, 1); } isp1362_hcd->board->reset(hcd->self.controller, 0); } else { isp1362_sw_reset(isp1362_hcd); } // chip has been reset. First we need to see a clock t = jiffies + msecs_to_jiffies(timeout); while (!clkrdy && time_before_eq(jiffies, t)) { spin_lock_irqsave(&isp1362_hcd->lock, flags); clkrdy = isp1362_read_reg16(isp1362_hcd, HCuPINT) & HCuPINT_CLKRDY; spin_unlock_irqrestore(&isp1362_hcd->lock, flags); if (!clkrdy) { msleep(4); } } spin_lock_irqsave(&isp1362_hcd->lock, flags); isp1362_write_reg16(isp1362_hcd, HCuPINT, HCuPINT_CLKRDY); spin_unlock_irqrestore(&isp1362_hcd->lock, flags); if (clkrdy) { ERR("Clock not ready after %lums\n", timeout); ret = -ENODEV; } return ret; }[/b] --- Quote End --- With best regards! - Altera_Forum
Honored Contributor
--- Quote Start --- originally posted by goral@Apr 28 2006, 02:07 PM hi, hippothank for your help, my usb flash disk was working now,, these is my message using on de ii board:
<div class='quotetop'>quote
--- quote end ---
--- quote start ---
# usb 1-2: new full speed usb device using isp1362-hcd and address 2
usb 1-2: product: usb mass storage
usb 1-2: manufacturer: usb mass storage
usb 1-2: serialnumber: abcdef123456789
usb 1-2: configuration# 1 chosen from 1 choice
scsi0 : scsi emulation for usb mass storage devices
vendor: usb-disk model: freedik-lwformat rev: 1.06
type: direct-access ansi scsi revision: 00
scsi device sda: 261856 512-byte hdwr sectors (134 mb)
sda: write protect is off
sda: assuming drive cache: write through
scsi device sda: 261856 512-byte hdwr sectors (134 mb)
sda: write protect is off
sda: assuming drive cache: write through
sda:<7>usb-storage: queuecommand called
sda1
sd 0:0:0:0: attached scsi removable disk sda
# mount -t vfat /dev/sda1 /mnt# cd /mnt# ls
de2_usermanual.pdf# --- Quote End --- I only changed two place in isp1362-hcd.c <div class='quotetop'>QUOTE </div> --- Quote Start --- static int isp1362_hc_reset(struct usb_hcd *hcd) { int ret = 0; struct isp1362_hcd *isp1362_hcd = hcd_to_isp1362_hcd(hcd); unsigned long t; unsigned long timeout = 20; unsigned long flags; int clkrdy = 0; ret = 1; INFO("%s:\n", __FUNCTION__); if (isp1362_hcd->board && isp1362_hcd->board->reset) { isp1362_hcd->board->reset(hcd->self.controller, 1); msleep(20); if (isp1362_hcd->board->clock) { isp1362_hcd->board->clock(hcd->self.controller, 1); } isp1362_hcd->board->reset(hcd->self.controller, 0); } else { isp1362_sw_reset(isp1362_hcd); } // chip has been reset. First we need to see a clock t = jiffies + msecs_to_jiffies(timeout); while (!clkrdy && time_before_eq(jiffies, t)) { spin_lock_irqsave(&isp1362_hcd->lock, flags); clkrdy = isp1362_read_reg16(isp1362_hcd, HCuPINT) & HCuPINT_CLKRDY; spin_unlock_irqrestore(&isp1362_hcd->lock, flags); if (!clkrdy) { msleep(4); } } spin_lock_irqsave(&isp1362_hcd->lock, flags); isp1362_write_reg16(isp1362_hcd, HCuPINT, HCuPINT_CLKRDY); spin_unlock_irqrestore(&isp1362_hcd->lock, flags); if (clkrdy) { ERR("Clock not ready after %lums\n", timeout); ret = -ENODEV; } return ret; }[/b] --- Quote End --- With best regards! <div align='right'><{post_snapback}> (index.php?act=findpost&pid=14801)</div> [/b] --- Quote End --- Thank you, too. So you just bypass the clock check?
- Altera_Forum
Honored Contributor
hi hippo & goral
I can see usb info( dev/sda1) from booting messages, and can't mount /dev/sda1 to /mnt . why ? http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif Is it not working ? ps: i have changed code in isp1362-hcd.c . uClinux/Nios II Altera Nios II support © 2004 Microtronix Datacom Ltd. setup_arch: No persistant network settings signature at 00BF0000 Built 1 zonelists Kernel command line: PID hash table entries: 64 (order: 6, 1024 bytes) Dentry cache hash table entries: 2048 (order: 1, 8192 bytes) Inode-cache hash table entries: 1024 (order: 0, 4096 bytes) Memory available: 5952k/8192k RAM, 0k/0k ROM (1591k kernel code, 555k data) Mount-cache hash table entries: 512 NET: Registered protocol family 16 SCSI subsystem initialized usbcore: registered new driver usbfs usbcore: registered new driver hub io scheduler noop registered io scheduler deadline registered (default) Serial: JTAG UART driver $Revision: 1.4 $ ttyJ0 at MMIO 0x80c81120 (irq = 1) is a jtag_uart dmfe_probe:eth0, 50000 Khz Nios <DM9000> eth0 I/O: 80c81130, VID: 90000a46 ADDR: 00:07:ed:00:00:00 dmfe_probe:eth1, 50000 Khz Nios usbmon: debugfs is not available driver isp1362-hcd, 2005-04-04 isp1362-hcd isp1362-hcd: ISP1362 Host Controller isp1362_hc_reset: isp1362-hcd isp1362-hcd: new USB bus registered, assigned bus number 1 isp1362-hcd isp1362-hcd: irq 4, io mem 0x80c810d0 isp1362_hc_start: isp1362-hcd isp1362-hcd: ISP1362 Memory usage: isp1362-hcd isp1362-hcd: ISTL: 2 * 256: 512 @ $0000:$0100 isp1362-hcd isp1362-hcd: INTL: 16 * ( 64+8): 1152 @ $0200 isp1362-hcd isp1362-hcd: ATL : 32 * ( 64+8): 2304 @ $0680 isp1362-hcd isp1362-hcd: USED/FREE: 3968 128 usb usb1: configuration# 1 chosen from 1 choice hub 1-0:1.0: USB hub found hub 1-0:1.0: 2 ports detected ISP1362 Host Controller, irq 4 Initializing USB Mass Storage driver... usbcore: registered new driver usb-storage USB Mass Storage support registered. NET: Registered protocol family 2 IP route cache hash table entries: 128 (order: -3, 512 bytes) TCP established hash table entries: 512 (order: -1, 2048 bytes) TCP bind hash table entries: 512 (order: -1, 2048 bytes) TCP: Hash tables configured (established 512 bind 512) TCP reno registered TCP bic registered NET: Registered protocol family 1 NET: Registered protocol family 10 IPv6 over IPv4 tunneling driver NET: Registered protocol family 17 Freeing unused kernel memory: 436k freed (0x1a0000 - 0x20c000) init started: BusyBox v1.1.1-pre0 (2006.04.20-12:52+0000) multi-call binary usb 1-2: new full speed USB device using isp1362-hcd and address 2 usb 1-2: configuration# 1 chosen from 1 choice scsi0 : SCSI emulation for USB Mass Storage devices BusyBox v1.1.1-pre0 (2006.04.20-12:52+0000) Built-in shell (msh) Enter 'help' for a list of built-in commands. # Vendor: USB 2.0 Model: Mobile Disk Rev: 2.00 Type: Direct-Access ANSI SCSI revision: 02 SCSI device sda: 256000 512-byte hdwr sectors (131 MB) sda: Write Protect is off sda: assuming drive cache: write through SCSI device sda: 256000 512-byte hdwr sectors (131 MB) sda: Write Protect is off sda: assuming drive cache: write through sda: sda1 sd 0:0:0:0: Attached scsi removable disk sda # fdisk -l /dev/sda Disk /dev/sda: 131 MB, 131072000 bytes 16 heads, 32 sectors/track, 500 cylinders Units = cylinders of 512 * 512 = 262144 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 499 127728 6 FAT16# mount -t vfat /dev/sda1 /mnt mount: Mounting /dev/sda1 on /mnt failed: No such device# thx in advance ! - Altera_Forum
Honored Contributor
Hi, hippo
I 'm a new user on linux about two months, so I haven't do more check about device driver, I checked some reg and then I contrast it as the ISP1362's datasheet, I changed it.Maybe there have antoher problem, when other probelm appearance, I'll search help and try to solve its. <div class='quotetop'>QUOTE </div> --- Quote Start --- So you just bypass the clock check?[/b] --- Quote End --- THX! - Altera_Forum
Honored Contributor
Hi, jay_1025:
<div class='quotetop'>QUOTE </div> --- Quote Start --- hi hippo & goral I can see usb info( dev/sda1) from booting messages, and can't mount /dev/sda1 to /mnt . why ? sad.gif Is it not working ? ps: i have changed code in isp1362-hcd.c . [/b] --- Quote End --- You may check your menuconfig like as hippo mentioned: <div class='quotetop'>QUOTE </div> --- Quote Start --- for kernel config, drivers->scsi->scsi disk support drivers->usb->usb devices filesystem, usb mass storage . and you need vfat support as in CF drive. [/b] --- Quote End --- After that, you could do like this: <div class='quotetop'>QUOTE </div> --- Quote Start --- 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) [/b] --- Quote End --- Maybe you can access your usb flash disk! Lucky! http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/biggrin.gif - Altera_Forum
Honored Contributor
hi qoral
thank you for your reply ! final step is very important ! http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif I can access usb flash disk(fat 16) on uClinux OS,and the reason that i can't mount usb flash is file system problem, before. Can i mount usb flash disk that file system is linux ? # fdisk -l /dev/sda Disk /dev/sda: 131 MB, 131072000 bytes 16 heads, 32 sectors/track, 500 cylinders Units = cylinders of 512 * 512 = 262144 bytes Device Boot Start End Blocks Id System /dev/sda1 1 500 127984 83 Linux# mount -t vfat /dev/sda1 /mnt mount: Mounting /dev/sda1 on /mnt failed: Invalid argument# usb 1-2: USB disconnect, address 2 usb 1-2: new full speed USB device using isp1362-hcd and address 3 usb 1-2: configuration# 1 chosen from 1 choice scsi1 : SCSI emulation for USB Mass Storage devices Vendor: USB 2.0 Model: Mobile Disk Rev: 2.00 Type: Direct-Access ANSI SCSI revision: 02 SCSI device sda: 256000 512-byte hdwr sectors (131 MB) sda: Write Protect is off sda: assuming drive cache: write through SCSI device sda: 256000 512-byte hdwr sectors (131 MB) sda: Write Protect is off sda: assuming drive cache: write through sda: sda1 sd 1:0:0:0: Attached scsi removable disk sda # fdisk -l /dev/sda Disk /dev/sda: 131 MB, 131072000 bytes 16 heads, 32 sectors/track, 500 cylinders Units = cylinders of 512 * 512 = 262144 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 499 127728 6 FAT16# mount -t vfat /dev/sda1 /mnt# cd /mnt# ls ?? S1????.doc nios2.ptf ??1.vsd S1??????0411.doc nios2_system.h ????10 app_self nios_1.ptf ????2.doc ice zImage Filesystem_1c20_usr jay_??# thx in advance ! - Altera_Forum
Honored Contributor
I'm glad to hear your success, Maybe you could try your thought, I didn't do that, I want to using the usb host port for my camera, If you interesting, we can help each other!
Are u want to try? - Altera_Forum
Honored Contributor
I am very happy with the success of you both. Help each other, please. http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif
If you want to mount Linux disk partition or others, you can enable them in kernel config, file system -> ext2 or ext3 or others . You should enable only the options which you will use. But don't enable too much, the kernel size will grow, take more memory and take longer time to boot.