Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

getting started with USB

Status
Not open for further replies.

patroclus

New Member
Hello!
I've been using parallel port for my circuit's comunication to PC. Now I need more speed and I want to learn USB interfacing.
I heard of PIC 18F2550 from microchip, or Cypress FX2, for USB2.0 development... does anyone know about this??
Any advice?
I'm searchin an easy way :)
 
I use a FX2 chip at work, but I mostly use it as a fast data bridge - the only code I have running on it is stuff to initialize the hardware FIFO, and twiddle some I2C bits. The devel kit is pretty darned expensive and not that necessary - it's a very simple chip to setup, and I think all the software (evalutation version of the C compiler and the basic header files/USB protocol level stuff) is all on the Cypress website.

How much speed do you need?
 
Well, 12MBps should be OK, but I would ilke to get 480Mbps in a near future, for high speed transmition.

The problem is that all documentation I find is confusing..
As far as I manage to get :
- Cypress FX2 is a microcontroller that has an integrated USB transceiver and manages all USB low-level protocol.
- You need some sort of PC driver (in this topic, I'm pretty much lost. I only know there's something called HID that is mentioned in many sites).

But I would like to get some starting info, so I can go on.
 
patroclus said:
Well, 12MBps should be OK, but I would ilke to get 480Mbps in a near future, for high speed transmition.

What are you intending to use it for?, bear in mind USB speed is related to packet size - for high speed you need long continuous packets, and both ends of the link have to be designed to handle that.
 
High speed data transfer. My first project is just a data logger. A simple circuit samples some data lines, and sends data to PC using USB.
 
patroclus said:
High speed data transfer. My first project is just a data logger. A simple circuit samples some data lines, and sends data to PC using USB.

So there's no need for high speed then? - data loggers are normally just slow devices.
 
I know, but I will need high speed in a middle future (sampling rates of a few Mhz). I can start with USB 12Mbps, if I learn how to develop USB circuits
 
patroclus said:
I know, but I will need high speed in a middle future (sampling rates of a few Mhz). I can start with USB 12Mbps, if I learn how to develop USB circuits

You need to consider where you can generate data from that quickly, and how you can transfer it - and for that matter, how your PC software can deal with the amount of data generated?. PIC's (or AVR's) tend to become useless, because they can't handle the quantities of data, nor the speed required.

If you look at a digital camera, they come with USB interfaces, yet image transfer is still quite slow - certainly nowhere near what USB is capable of.
 
Have a look into a chipset from FTDI (d2xx series) they are fantastic little chips and they do all the nasty USB-stuff so the PC-end looks like a virtual-coms port and the hardware side looks like a standard Serial UART

why bother with the pain in the arse USB stuff when this chip family does it for you. You can get propper FTDI drivers for windows that gives you alot more control over the USB control BUT its still gets treated as serial port (just extra things like access to the very high speed and access to the EEPROM etc)
 
FTDI seems cool, but I preffer the USB-FIFO ones.
I'm not used to USART protocol.
And FIFO interface is really easy to get working... the only problem is 1Mb/s transfer rate, even if using USB2.0.
 
The FX2 is a 48MHz 8051 (apparently resembles some of Maxim's 8051 chips in timing) with 8KByes worth of FIFO grafted into it. It also has a 16 bit wide fifo interface that can run at 30+MHz.

HID refers to "Human Interface Devices" - protocol designed by the USB-IF committee to handle common computer peripherals. It usually doesn't deal with raw interfaces (i.e. what you'd want if you wanted to just pump data), so a custom driver is usually required. The FTDI and like chips provide a serial port interface, so that's why they use the HID, but as you've noticed, they have a max bandwidth limitation.

Drivers tend to be the ugly thing - I'm very comfortable using Linux, so using the "libusb" style interface, I've been able to dump out ~8MByte/sec data without having to do a kernel-mode driver. On the Windows side of things, I think Cypress has some third party drivers, but I haven't looked in depth at the stuff.

(Incidentally, this is using a relatively recent 2GHz AMD machine, 2KByte "bulk transfer" packets).
 
The FTDI chips also have a faster bitbang mode for parrallel data transfer to the chip if it's needed.

Like mentioned you'll need a pretty fast processor, like a dsPIC, ARM, or that 8051 variant just to collect and transmit the data at those speed, not taking into account much in the way of processing. I'm playing with an Atmel ARM7 chip right now that's pretty capable and has USB support, but I've been avoiding playing with the USB, because of the complexity. Otherwise I have had good success with the FTDI chips.
 
Actually, the manual for the FX2 specifically recommends that the 8051 stay *out* of the data transfer path. It's allowed to read and modify packets, but I've got a FPGA on the other end of the FIFO pumping data for the actual "heavy lifting".
 
The main problem about learning how to use USB is the lack os simple examples or tutorials.
I think I'll have to use the FIFO FTDI chips, as using a FX2 or PIC18F2550 has the driver side, and I'm totally lost on that. I'm a good programmer. But I'd have to learn how to program the FX2 chip, or PIC18F2550 (which will take a bit of time already) and then getting into the driver side, and I really don't know where to start.
 
patroclus said:
The main problem about learning how to use USB is the lack os simple examples or tutorials.
I think I'll have to use the FIFO FTDI chips, as using a FX2 or PIC18F2550 has the driver side, and I'm totally lost on that. I'm a good programmer. But I'd have to learn how to program the FX2 chip, or PIC18F2550 (which will take a bit of time already) and then getting into the driver side, and I really don't know where to start.

Well, that's probably the sane answer.

If you do want to follow up on the FX2 stuff, download the ~40MB devel tool package from Cypress, and look at the example programs that are in there. There's a windows application that Cypress bundles in their devel tools that lets you do some simple stuff - initialize a FX2 chip, twiddle some bits, send packets out, and receive them.

There is a really basic example "bulktest" (or something like that) that is a simple USB loopback device - it gets uploaded to the FX2 chip, and all it does is echo packets that are sent to the USB device. It's easy to modify that program to do something else (i.e. something useful) when packets get received.

There's also the hardware side of things - at 480Mbit, there really ought to have a custom board for the chip - or find some cheap eval board that someone's already tested.

On the Windows driver side, there might be a really simple dll/driver solution, I just haven't looked in to that stuff. Getting started using usb on the linux side is easy, mostly built-in, and free.
 
Sorry, I just read your answer. Forget about my question about PC software side, as you already answered here. I'll start looking at the examples and see if I get going..
 
Status
Not open for further replies.

Latest threads

Back
Top