Author
Topic: UART conections (Read 1264 times)

hey guys I wanted to add UART function to my Atmega8 form the $50 robot, but I was wondering If i could, open a usb and connect the usb's tx and rx directly to my atmega8...But I saw the UART tutorial and there was this CP2102, but for what use this thing? Cant i just go form my usb to the atmega8?

hey, thanks but what about using a usb cable used for cellphones... I mean, cellphones have microcontrollers of some sort so wouldnt that usb have a thing for communicating the computer with the cellphone? ?and sorry for my english, I am from Puerto Rico...

hey guys I wanted to add UART function to my Atmega8 form the $50 robot, but I was wondering If i could, open a usb and connect the usb's tx and rx directly to my atmega8...But I saw the UART tutorial and there was this CP2102, but for what use this thing? Cant i just go form my usb to the atmega8?

The USB has data (+) and data (-)... which one is RX and TX???

The Atmega8 does not support USB. The TX/RX on the Atmega8 speak "UART" protocol. Meanwhile, the D+ and D- on a USB port speak "USB NRZ" protocol. They are not compatible.There is a version of the Atmega8 called the Atmega8u2 which does support USB, but unfortunately, it's not available in DIP package, only in surface-mount package, so it's going to be very hard to work with if you don't know how to do reflow soldering in an oven.

First look up UART, asynchronous serial, RS232 and USB in Wiki to learn about these.Second, there are a few Async Serial (UART) to USB adapters. These use a chip that converts between the two protocols and are fairly easy to use.Adafruit and SparkFun both sell them that go for your USB port directly to your Atmega UART pins.

Other adapters go from USB to RS232 which then means you need an RS232 to TTL level translation chip, like a MAX232.

RS232 is a high-voltage dual-voltage signaling scheme (typically -12V for 1 and +12V for 0.)The USB adapter shown is to TTL levels (which means 5V) where +5V is 1 and 0V is 0.The TTL version is what you need for any on-board UART connections. The Max232 chip is only needed if you actually need to talk to RS232 specific equipment through RS232 connectors (typically DB-25, or DB-9 form factor.)It is a little confusing that, sometimes, people will say "RS232" when they really mean "asynchronous serial." The key in the product listing is that it says "TTL" in the title. (There is no such thing as "RS232 TTL" but there is "TTL-level asynchronous serial.") Additionally, generating RS232 signals from an USB bus powered device is somewhat complex, and requires more hardware than can be seen on that dongle, and would also significantly increase the price.

Haha, but the one you gave me is from USB to rs232 right? So I would need for example a max232?

nope. virtually all these little pcb dongles are active low signal which is what the mcu needs. although commonly called "ttl" or "5v", this is a big mistake because level has nothing to do with it. original rs232 worked fine with ttl/5v. it is polarity that matters and creates 99% of the confusion for those starting out.

old pc rs232 was active high (+9v, +12v, etc) but modern serial is overwhelmingly reversed to active low (0v). voltage never really matters. its polarity and baud that count.

old pc rs232 was active high (+9v, +12v, etc) but modern serial is overwhelmingly reversed to active low (0v).

What's extra confusing is that what you call "active" here is actually the "0" value for a bit. The TTL asynchronous serial devices all pull the line up to 5V while idle. Then, the "start bit" is a zero, so it will pull the line low to indicate the byte that's coming, then the logic level is normal (5V == 1, 0V == 0) for each bit, then the stop bit is high, which returns the line to "idle" 5V state.

Meanwhile, RS232 defines the negative voltage as the "1" state, and the positive voltage as the "0" state. What you call "active" would be less confusingly called "logical 0" IMO.

in electrical engineering active low refers to input and output pin voltage and has nothing to do with binary software states. if it performs a function when 0v or negative its "active low". otherwise "active high". if those terms bother you then "idle high" and "idle low" are acceptable, but less common, alternatives. "logical 0" or "logical 1" is more appropriate for describing boolean operations and other internal software states. in any case with modern pc async and nearly all mcu uarts active low IS logic zero.

its true that polarity results in some confusion for beginners but nowhere near as bad as referring to "level" (ttl or otherwise) which has little to do with most serial problems.