USB interface for micro controller projects - FT232/PIC/or wat????? - Page 1
Forum section: electronics / general

author: umeramir
author_rank: Newbie
timestamp: May 22, 2012, 03:27:39 pm
content: Gone are the days of good old computer serial port and its interfacing capability with with our microcontroller module by simply using simple MAX 232.Now we have USB on every PC. So how to interface our embedded systems with computer?? what are the choices we have??FT232 is all SMT. No DIP. Some times pain in A**.. Microchip gives a solution through PIC but not very much clear. What is the world of crazy USB drivers?Plus why a dedicated micro controller with CAPS etc when previously it was one chip solution?Is there any other DIP alternative for USB interfacing??Dave come to rescue please... If you have already then please guide me to it.Regards

author: 8086
author_rank: Super Contributor
timestamp: May 22, 2012, 03:30:35 pm
content: You can get FT232 on a breakout with 0.1" pins from ebay etc.

author: Short Circuit
author_rank: Frequent Contributor
timestamp: May 22, 2012, 05:13:22 pm
content: Pretty much everything that you could do over RS232, you can do over USB HID. No drivers needed, no stupid legacy COM ports. Better forget about the actually-no-so-good old RS232 and enjoy the benefits of modern P&P; just search your device by VID/PID and use it from your app. Never used PIC, but knowing Microchip a bit, I'm sure they have some good examples demonstrating HID function with their devices...

author: free_electron
author_rank: Super Contributor
timestamp: May 22, 2012, 06:53:03 pm
content: the problem with usb is the complexity in code it requires. in a uart you simply send a byte into the register, wait for a flag to clear and repeat ...usb is a tad more complex.HID does not require drivers but it is slow ...VCP does not require drivers is fast but requires software overhead on the microcontroller.FTDI solves this problem on both ends . tack it on and go.Now, i have used ftdi 245-style chips a number of times. By simply memory mapping these you don't have to doddle around with slow uart ( kinda dumb to take parallel data - serialize it to send to ftdi , that deserializes it in parallel data and then serially transports it over usb ... )The new H version of the ftdi chips allow you to go full throttle ! ( 480 Mb/s ) zero drivers needed. they provide OS driver and your application talks to it using the DCxx driver they provide. on your micro / fpga / whatever there is no driver required. it's a stream pipe. Doesn't get any simpler than that.I ihave made a number of 'real' usb devices ( PIC4550/2550 AVR90 , Cypress 8051 (68013 ) and an ARM7 based thingie). The 'hard' part is always the drivers for the OS and the software on the device.If you want to do it the easy way :Swordfish basic for PIC 18F series has a USB engine.Bascom AVR for AVR has a USB engine.ST has a usb library for KEIL and IAR on ARM 7 and Cortex.But the problem is always the driver on the OS side. ( unless you do 'HID' (yuck) or stick to VCP emulation ( overhead , overhead ))To use the real capabilities of USB is NOT easy.

author: Unknown
author_rank: Unknown
timestamp: May 22, 2012, 08:45:51 pm
content: Don't forget the need for a USB vendor ID. FTDI will give you one to use with their products so you can have drivers showing your own company name. This is not usually a concern for hobbyists, who often do the bad thing and pick some random vendor ID that will likely conflict with some other USB device in the world, just like those 'unique' ethernet MAC addresses in some Chinese devices. For large-scale manufacturing the USB forum fee is fairly modest. It's the people in between that are in trouble.Many vendors offer stacks for the uC side. Microchip does, but I believe their license isn't that nice (people are not allowed to redistribute it or some of that nonsense). There is a decent open-source one for AVR. I believe all of the major ARM Cortex manufacturers (including ST, NXP and TI) offer one. This does not take away all of the complexity, you still have to mess around with device descriptors and endpoints for example, but certainly helps. On the OS side, libusb (originally developed for Linux, now also available for Windows and Mac OS X) is probably the easiest. The advantage is that it moves all code to userspace. This makes it harder to screw up, and doesn't require one to jump through hoops for driver signing.No way that it's even close to the simplicity of talking to an FTDI chip via UART or parallel interfaces, however.

author: DavidDLC
author_rank: Frequent Contributor
timestamp: May 22, 2012, 09:14:19 pm
content: Quote from: umeramir on May 22, 2012, 03:27:39 pmErrr , I don't want to have my wireless mouse, my external hard drive, MIDI controller or Memory stick, etc. connected to a COM port anymore.Go for the FTDI breakout board solution, it is not that difficult to use, the API has the functions that automatically detect connected devices, so you don't have to look for it. And more flexible functions as well.

author: free_electron
author_rank: Super Contributor
timestamp: May 22, 2012, 10:37:15 pm
content: Quote from: alm on May 22, 2012, 08:45:51 pmah yes, i forgot to mention that little anoyying aspect too.. cough .. 1500$ ...And don't dare use someone elses VID or PID or you unleash the unholy pits of hell on your computer.the VID PID pair is how the operating system knows what driver to load. give the wrong VID PID and all hell breaks loose... use someone elses VID PID and the os will load something that is not made for your product.

author: Bored@Work
author_rank: Super Contributor
timestamp: May 22, 2012, 10:49:02 pm
content: Quote from: free_electron on May 22, 2012, 10:37:15 pmNo, it is only one possible way. Many standard devices, e.g. mouse, keyboard, mass storage, aren't identified by the VID/PID, but by the USB class information.Which mechanism is used depends on the operating system. E.g. Windows 98 didn't even come with a mass storage driver. Vendors of usb hard disks and memory sticks had to provide their own drivers. And they got the drivers registered in Windows so the VID/PID was used, or the manufacturer and/or product ID.Later Windows versions, however, come with a mass storage driver. And the driver is registered in Windows so as to load for every device that identifies itself as a mass storage device. VID/PID, manufacturer ID or product ID are largely ignored. Unless there is a special driver registered or the particular device is blacklisted, because Microsoft has determined it is incompatible.

author: Psi
author_rank: Super Contributor
timestamp: May 22, 2012, 11:51:35 pm
content: If you go for an FT chip, there are a few kinds, the most typical FT232RL is quite expensive compared to some of the cut down basic versions like FT230XI think they lack some of the extra pins like CTS, RTS and hardware xor or something.So still perfectly good for typical micro projects were all you need is RX and TX.

author: 8086
author_rank: Super Contributor
timestamp: May 23, 2012, 12:47:40 am
content: Quote from: Psi on May 22, 2012, 11:51:35 pmI had not heard of the FT230X, looks pretty nice! Thanks for the tip

author: oPossum
author_rank: Super Contributor
timestamp: May 23, 2012, 01:00:36 am
content: The FT231X is the new equivalent of the FT232R. The other new X series chips have less I/O and a smaller package. All of the X series are less than half the price of the R series.The new X series has 5V tolerant inputs, but can not output 5V like the R series. They also default to D2XX drivers, so you have to program them with FT Prog to use the VCP driver.

author: Galenbo
author_rank: Super Contributor
timestamp: May 23, 2012, 10:32:43 am
content: Quote from: umeramir on May 22, 2012, 03:27:39 pmIt is true when you're speaking about a Facebookscreen, aka Notebook/Laptop/Portable/Tablet.Many current Real-PC motherboards still have a RS232 com header inside, you just need a 5€ connector.ASUS P8H77-V LE.

author: McMonster
author_rank: Frequent Contributor
timestamp: May 23, 2012, 10:59:52 am
content: Quote from: Galenbo on May 23, 2012, 10:32:43 amThis reminds me of last year's total lab upgrade at work, where we really need at least one RS-232 in all machines. We've ordered 60 new PCs, unpacked them and... no DB9 connectors. I'd love to see a picture of our faces at that moment. Fortunately we haven't made a mistake, just the supplier didn't mention we need to get connectors separately to plug into motherboards.Laptopts with RS-232 still exist, but they're usually expensive (for the hardware inside) business lines of machines. I've once tried to get such a laptop, but I was driven away by the prices and availability.Let's just be happy for all the cheap FTDI and Prolific chips' based USB to RS-232/UART converters.EDIT:And thank you for mentioning FT230/FT231 chips, I knew there has to be an alternative, but I've only seen FT232s stuffed into every stupid AVR LED blinker.

author: T4P
author_rank: Super Contributor
timestamp: May 23, 2012, 02:22:31 pm
content: ... Er guys i use a USB>Serial thingy with a AnalogDevices chip in it, it works fine for me as long as i select the right port in device management... i did that with my UT61E

author: codeboy2k
author_rank: Super Contributor
timestamp: May 24, 2012, 06:57:15 am
content: For laptops without serial ports, I use a USB->serial adapter, works great under Windows or Linux. Yes, we still need serial ports occasionally for our kind or work.As far as the OP's question goes, if you have any control over the choice of micro, choose one with an embedded USB. There are plenty available now. It also frees up your serial port to do something else, if you need it (or you can use it as a debug port).If all you need is 8-bit micro, then perhaps a two chip solution may be cheaper than the more powerful 32-bit chips with built-in USB, but be sure to consider all the factors. Sometimes the more expensive single chip solution is actually cheaper overall, because it may have more peripherals built-in or may need fewer external components than the older 8-bit chip.

author: T4P
author_rank: Super Contributor
timestamp: May 24, 2012, 09:14:48 am
content: Something like the Cortex-M series that comes with USB.So far according to ST, might change for the others but i suppose all comes with USB