1
\$\begingroup\$

I want to build a USB Programmer currently for AT89C51. I am stuck on how to make it communicate with PC. In RS232, the RxD TxD pins are straight forward, we just need to use Logic Level Converter to interface with MC. What about USB. Are Data+ Data- lines equal to RxD TxD? Can I connect these USB Data lines to MC directly? They don't need any Logic Level Converters. Right?

I saw some USB to RS232 converters. Why they exist? I thought USB interfacing was more easy, not really!

So how would i send data from PC to my Programmer through USB port? Please Help & Thank you

\$\endgroup\$
  • 1
    \$\begingroup\$ USB interfacing is hard as $#!+. \$\endgroup\$ – Ignacio Vazquez-Abrams Dec 4 '13 at 10:48
  • 2
    \$\begingroup\$ If you know how to program using RS232, then try to use simple USB-to-UART converters from FTDI or equivalent. They will have reference schematics and firmware...almost everything is there..."atmel.in/Images/DOC0287.PDF" has figure 3 details programming circuit details. "atmel.in/Images/doc7764.pdf" see 2nd section InSystem Programming using FLIP software freely available from atmel website. \$\endgroup\$ – user19579 Dec 4 '13 at 10:52
  • 4
    \$\begingroup\$ USB is (or is supposed to be) simple for the end user. Definitely not for the implementor! \$\endgroup\$ – Wouter van Ooijen Dec 4 '13 at 10:55
  • \$\begingroup\$ No, you don't normally need any active converter between a USB device's D+/D- pins and the bus. Depending on the design of the chip's onboard interface, robustness, etc sometimes series resistors or an integrated filter device may be advisable. But direct connection is likely to work at least on a prototype. \$\endgroup\$ – Chris Stratton Dec 4 '13 at 18:21
3
\$\begingroup\$

USB cannot be used as simply as a serial port. There are many layers of software protocol that must be supported.

Some microcontrollers have some USB support built-in. Even so, I suspect that using USB for serial communications is not as simple as you might think.

See also
USB / Serial converter without FTDI Chip
http://www.fourwalledcubicle.com/LUFA.php

\$\endgroup\$
  • \$\begingroup\$ So i need to use USB-to-TTL converters or a USB-to-RS232 cable right? \$\endgroup\$ – dimSutar Dec 4 '13 at 10:52
  • \$\begingroup\$ @dimSutar: Yes. That is probably what most people do. \$\endgroup\$ – RedGrittyBrick Dec 4 '13 at 10:54
1
\$\begingroup\$

USB is quite a complex protocol so that's the reason off-the-shelf USB to RS232 adapters exist. If you wanted a chipset solution something like the FTDI FT232H chip might be a good solution. As you want TTL levels you can get products like a FTDI Cable 5V VCC-3.3V I/O cable that would probably be the easiest although not cheapest solution:

USB serial cable

Some microcontrollers have USB hardware built-in and software stacks provided by the vendor that can make things a bit easier. But the AT89C51 doesn't have USB support and while implementing it is software might not be technically impossible (it has been done on some controllers) the results are usually somewhat non-compliant and wouldn't leave you with much code space for anything else.

\$\endgroup\$
1
\$\begingroup\$

If you consider what USB does you will realise it can't be a simple UART like interface. The D+ and D- lines are both bidirectional so there is no equivalent to the RXD and TXD lines of RS232. Instead communications happen in one direction at a time and D+ and D- form a differential signal.

There is a complex software protocol involved with all communications being of a call and response type with one device acting as a host (the PC) and others as devices which only talk when asked to. If you would like more details see www.usb.org.

The USB to RS232 devices you have seen all contain a microprocessor. In the case of FTDI devices it's all programmed for you, and you can't change it. In the case of other processors you have to write your own code; though there are several examples available for the most popular processors.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.