On 23/12/2010 00:03, Philip Pemberton wrote: > Quick question -- what's the fastest anyone's managed to transfer data > from a PIC18F85J50 to or from a PC, using USB? > > After a heck of a lot of protocol tweaks and the addition of > double-buffering (which netted me another 20 kbytes/sec), I'm up to a > shade under 220 kbytes/sec. Is this about right for a chip with the PLL > on and a core clock of 48MHz? > > The data is being sourced from the Parallel Master Port -- data either > goes from USB to PMP, or the other way. > > The source code is online at http://hg.discferret.com/firmware/ for the > curious. This includes a patch to the Microchip USB Stack which adds a > 'special' string descriptor that reads the device serial number from the > end of the bootloader block of the Flash. > > Thanks, It's only USB 1.1 not USB 2.0 USB speeds are fantasy. Nothing gets close to supposed speed. PIC 18F uses 24MHz USB clock =3D 12MHz peak data rate of USB 1.1 There is CRC overhead on every packet It's half duplex 220kByte/s is about 1.7Mbps Not bad really. maybe you might get 4 to=20 6Mbps on USB 1.1 if really clever. Only one data connection, so any data=20 transfer can only use a proportion of the speed with protocol overhead,=20 TX/RX change over and CRC etc. << USB 1.1 has a theoretical throughput of 12 Mbps, or 1.5 MB/sec . In=20 practice, the fastest you're likely to see is less than 8 Mbps [but it's=20 half duplex]. This discrepancy arises because the USB controller=20 reserves a portion of the bandwidth for non-data use and because USB=20 uses bit stuffing, a technique that mixes filler bits with the actual=20 data to simplify the system. >> I've also seen "real world" speeds for USB 1.1 of 5.4Mbits/s average=20 throughput (about 6.1Mbits/s peak) quoted. Also the CPU is 12MIPS peak with 48MHz clock. i.e. if you doing 6=20 instructions per byte transferred =3D 2Mbps. So other than streaming Parallel port mode you are not going to get =20 anywhere near full 1.1 speed. So 220k bytes /sec doesn't sound too bad. --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .