Using USB instead of RS232 on embeded project

I am developing a product that requires a serial port to transfer a few bytes of data to a host pc on a repetitive basis. Currently using

115kbaud on an RS232 port on my board and that works fine. A little slower is ok too. Some feedback has indicated that a USB port would be an attractive alternative. Someone commented that a "chip" for USB is about the same expense as RS232. I have zero experience with USB and I have no idea what to look for or if it is even practical. The product is a battery charger and is just transferring battery current/voltage values to a host pc for analysis and graphing so speed is not a problem. All I need to do is just transfer a few bytes back and forth from the host PC. The processor is a Cygnal C8051F310. Any recommendations or advice on how to do this would be appreciated.

Thanks, Art

Reply to
Art K6KFH
Loading thread data ...

Cygnal makes a couple of USB chips. The C8051F320 is an 8051 derivative with USB. They also make an RS232 to USB converter to convert legacy RS232 applications to USB which might be an easier way to go. Writing USB drivers is a non trivial task...

Bob

Reply to
Bob Stephens

Take a look at

formatting link
This is a single chip solution that requires no driver writing and know serious knowledge of USB. The chip accepts a serial signal on one end (TX,RX, handshake) and USB on the other end. FTDI supplies you with free drivers that create a virtual com port on your PC. You port your current serial design to USB in less than an hour.

Meindert

Reply to
Meindert Sprang

You might want to take a look at

formatting link
Regards, johannes

Reply to
johannes m.r.

Dontronics.com has some products. I've used the usbmicro. Its not "the price of a serial chip", but its really easy to use. You buy the chip, and download the DLL's and code examples. I've been communication with the chip directly from Microsoft Access.

Reply to
Mike Turco

I know you're a Forth fan, so I can't resist suggesting you look at:

formatting link
which uses a single chip 60MHz ARM (128k Flash, 64k RAM) with an FTDI USB chip glued on the side. I can recommend the FTDI chips, they are ease to design with and all the host drivers are free of charge.

Stephen

-- Stephen Pelc, snipped-for-privacy@INVALID.mpeltd.demon.co.uk MicroProcessor Engineering Ltd - More Real, Less Time

133 Hill Lane, Southampton SO15 5AF, England tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691 web:
formatting link
- free VFX Forth downloads
Reply to
Stephen Pelc

Art,

If you already have it going why change?

Moving to USB is not a simple step and by the sound of it would achieve little. You interface does not sound complex or requiring a lot of speed. Even

115Kbd sounds like an overkill, but I guess that depends on how often you require samples. USB is good if you need to transfer a significant amount of data. Also the support within your embedded system is much greater for USB than for RS232. The learning curve for USB is not trivial either, but is good fun if you like the challenge. Give yourself a min of 6 months. The initial learning curve is steep but after that, most learning is by experience. If your concern for RS232 ports becoming obsolete in some PC's then a simple USB to RS232 converter will be fine, providing you do not require special timings or protocol settings. As with most USB configurations timing can be an issue as you cannot guarantee delivery time of a message.

If you do intend going down the USB path I would suggest 2 books as a requirement.

(1) - USB Complete by Jan Axelson (ISBN-096508195-8) (2) - USB Design by Example by John Hyde (ISBN-9702846-5-9)

Some good web sites to visit are

formatting link
formatting link

A must have tool is at

formatting link

regards PhilW

Reply to
Phil W

Art K6KFH wrote in news: snipped-for-privacy@4ax.com:

USB is probably the direction that all new development should go. There are many USB-capable microcontrollers out there, and a lot of them are 8051- based so your existing code should even be portable.

If you stick with a controller that has a USB state machine, so that you don't have to implement the actual twiddling of the data lines, then USB is not difficult but it is tedious. The nice thing about it is that nearly all of the USB-specific firmware you write will be reusable in other applications. Most of the work is simply handling the identification and configuration requests. Your application-specific code will only touch a couple areas of the USB implementation.

It's not hobbyist-friendly. There are thousands of USB firmware implementations out there, all written independently by developers and secreted away behind copyrights. If someone put professional quality generic USB firmware out there for popular microcontrollers under the GPL, it would be a pretty big boost for hobbyist use of USB. I already can't distribute mine; that's the problem, hardly anyone does it until they're paid to.

Reply to
dh

Well, because of laptops with no serial ports?

With the chips from FTDI is IS a simple step.

If you just want to replace a serial connection with USB, the FTDI chips let you do it within hours.

Meindert

Reply to
Meindert Sprang

Please don't stick with RS-232, you have to go USB.

Have a look at:

formatting link

for heaps of USB solutions, including the FTDI chips, and evaluation modules that will give you a kick start to your project.

3 years ago we sold a heap of PIC programmers that used either RS-232 or the parallel port. Today we only have USB, and they all use the FTDI chip.

Don...

--
Don McKenzie
E-Mail Contact Page:       http://www.e-dotcom.com/ecp.php?un=Dontronics
 Click to see the full signature
Reply to
Don McKenzie

I agree, Phil appears pessimistic. But there are solid reasons for keeping a product RS232, such as cost and interoperability (eg modems / printers / other dumb devices), not to mention "ain't broke". Companies like easysync.co.uk - using FTDI - are fixing the laptop problem, so why change unless it's a hard marketing requirement?

Cheers, Mike.

--
Mike Page BEng(Hons) MIEE           www.eclectic-web.co.uk
Quiet! Tony's battling the forces of conservatism, whoever we are.
Reply to
Mike Page

For quite a few applications where the RS232 connection is used infrequently (e.g. site visits to examine logs, update software), a special RS232 to USB cable keeps the design changes and field types to a minimum.

Not to mention, implementing RS232 on many devices is simple and cheap (cost and system overhead). Whereas an external RS232 to USB for many applications is all that is required, especially on lots of projects where the use is infrequent.

^^^^^^^^^^^^^^^^^^^^^^^^^^ Should read "follow the current desktop fad".

I wonder how many have had requests to wireless network their current projects because it would be nice, despite the overkill for many applications.

--
Paul Carpenter          | paul@pcserviceselectronics.co.uk
    PC Services
 Click to see the full signature
Reply to
Paul Carpenter

"Meindert Sprang" wrote in news: snipped-for-privacy@corp.supernews.com:

Not necessarily. We have a product that uses RS232 as a configuration and data collection port. We have a consderable investment in Palm OS software to do this configuration and data collection, but more and more Palm OS devices are being shipped with no RS232 available, instead using USB. We can't use USB to RS232 converters, because the Palm is a USB peripheral, not a USB controller. The FTDI chip is absolutely useless in this scenario. I'm still not sure what we will do when the serial ports on Palms finally go away.

Jeff.

Reply to
Jeffrey A. Wormsley

"Paul Carpenter" wrote

Finding laptops with a serial port has always been difficult, much less finding a laptop with two serial ports if that's what you need. Multiple serial ports have always been a problem with desktops, too, if you need more than the two that come with the machine. (I'm speaking of situations where people used to need multiple serial-based products on their machines in commercial and industrial applications, not hobbyist setups or VAR systems.)

Now, there is USB. Virtually all computers have it, and have had for at least a few years now. Need to hook up more stuff? No problem, get a hub. You can even pull power from the USB port, not much, but its there and a lot of times you can use it.

Hey, I miss serial communications too. It was easy to deal with, even in asm. USB definitely ads a level of complexity. But times have changed, and USB is superior to serial for many different types applications.

Overkill, by who's definition?

Mike

Reply to
Mike Turco

PCMCIA or USB to RS232 exist and have existed for some time.

Multiple port PCI cards and before that ISA cards have existed and are still available.

So am I, even years before the PC, industrial applications often had add in cards of multiple serial ports.

Now you are in the realms of long term support and conflicts beyond your control. Having seen too many badly written pieces of USB devices that mean you are potentially sharing a communications channel with soemthing beyond your control.

Let's see well known brand of scanners that added the following levels of software as their scanners kept up with the latest fad and they did a major kludge on their software. The device started as a SCSI device, became parallel port, then USB, so we ended up with the following drivers

SCSI pseudo device Ý --- Parallel port to SCSI driver Ý ------ USB to parallel driver Ý ---- various USB drivers to talk to the device

The customer sites I have been to where the systems had to have the multi interface devices connected by means other than USB, as the USB devices and their software interacted with each other causing crashes or other instability.

Most of the host side software, like most windows applications assumes it is the ONLY thing added to a virgin system.

Plug and play is NOT that, but load the software BEFORE connecting the device. Then make sure you have either shut the machine down or used "Safely remove Hardware", before disconnecting. The number of people who I have seen caught out by these is beyond belief.

Then the support nightmares of hardware or operating system upgrades and there is no longer support for devices. I have seen this already for USB devices, because the toy market called desktops/laptops assumes at the slightest problem everything is ditched for the new model.

USB is NOT mature on the software front for me to consider for many applications, either due to burst communications or random connections like once a month.

There are PC type applications where USB like interfacing would be a good idea (cameras, scanners, temporary media connections), but too much is done on it relying on using up the host resources to do what should be done in the device. Classic example being inkjet printers.

For PC applications not involving Games, typewriting, web browsing and other toy usages, USB adds too many non deterministic features to make it worthwhile.

There are many applications, where the environment will mean it is not practical. Excessive addition of cost and/or power consumption for the amount of benefit. Let alone the complexity of adding to quite a few applications a 16/32bit processor module to do the work of the wirless link on an application that is 4/8 bit in the first place.

If you want to have PC fad, make the system from a PC in the first place.

More often the things are added because they can or it is the latest fad e.g. Bluetooth, or internet access (e.g. washing machines, pens and toaster that have internet connections).

I have seen too many projects that used a PC that should have been a black box that was a 100baseT interface for the archiving of data, that have caused long term support and manufacturing problems due to inability to get the same PC three months later, let alone the software and interface cards issues.

--
Paul Carpenter          | paul@pcserviceselectronics.co.uk
    PC Services
 Click to see the full signature
Reply to
Paul Carpenter

For low-volume designers/manufacturers, a big reason to use FTDIChip is the ability to use their VID, which will save you $1500 the last time I checked:

formatting link

I have an article about using FTDI's USB UART here:

formatting link

Jan Axelson

formatting link

Reply to
jan Axelson

I have links to Linux USB info here, under Non-Windows hosts:

formatting link

and here:

formatting link

Jan Axelson

formatting link

Reply to
jan Axelson

AT43USB380 is a host.

Reply to
hamilton

Thanks to all who replied. I think I will give the Cygnal CP2101 some serious thought. It looks like it will do what I need and the price of the development board to try it is very reasonable.

Regards,

Art

Reply to
Art K6KFH

hamilton wrote in news:4155a596 snipped-for-privacy@omega.dimensional.com:

Yes, but how do you write software on both ends? Remember, the Palm software is written to be a master on a serial bus. There is no code to be a slave on the USB bus (those functions on the PalmPC end were taken care of by hotsync). On the other end, how does an 8-bit embedded device run such a host mode USB controller, when it expects to be the slave on a serial bus?

You see what I mean now when I say transparent USB/serial converters don't cover all classes of serial to USB switchovers?

Any intermediate device to do the conversion that I can dream up will be in such low volumes it would cost more than the Palm or the embedded device. Adding USB host capabilities to the embedded device, again at relatively low volumes (less than 10,000 a year, I think) would increase the device cost by nearly 100%, unacceptable in a very cost sensitive market.

Most Palm's seem to come with card slots now (used to be CF, but I think they are now SmartMedia) and people have added peripherals to those slots like 802.11b cards and the like, but even an RS-232 peripheral for one of those slots wouldn't be acceptable, as the cable connection would be so flimsy as to be useless.

IR still exists, but there are several problems there as well, such as problems with multiple peripherals in range, as well as the rewrite of s/w on both ends to support it. With Bluetooth/802.11b gaining in popularity, I fear about the time I made the switch to IR, it would be dropped as well.

Anyway, sorry to vent, but this is an issue that's been bugging me for a while.

Jeff.

Reply to
Jeffrey A. Wormsley

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.