Pages: [1] 2   Go Down
Author Topic: ATtiny85 w/ tiny-core and serial write  (Read 1376 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 117
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

As per this post here, the tiny-core has a softserial (write only) capability.

My development laptop, has no serial port, but I do have a PL2303 based USB-Serial converter (like this one on ebay). Can I use it to interface with my "ATtiny on breadboard" ? On the breadboard, do I need additional circuitry (level-changing), to enable serial communication ?
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 150
Posts: 5635
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

As per this post here, the tiny-core has a softserial (write only) capability.

My development laptop, has no serial port, but I do have a PL2303 based USB-Serial converter (like this one on ebay). Can I use it to interface with my "ATtiny on breadboard" ? On the breadboard, do I need additional circuitry (level-changing), to enable serial communication ?

It will take you about 30 seconds to find out...

Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

texas
Offline Offline
God Member
*****
Karma: 27
Posts: 862
old, but not dead
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, you will need something like a MAX232 on the breadboard or some other circuitry to adapt the signal.  You not only need voltage level conversion, but also to invert the polarity.
Logged

Experience, it's what you get when you were expecting something else.

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 150
Posts: 5635
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, you will need something like a MAX232 on the breadboard or some other circuitry to adapt the signal.  You not only need voltage level conversion, but also to invert the polarity.

Most of those cables work at 5V so there's no need for any conversion.

If in doubt, use a multimeter.
Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

texas
Offline Offline
God Member
*****
Karma: 27
Posts: 862
old, but not dead
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

While some of those cables will work with 0 and +5V, the specification calls for +12V and -12V (more or less, 10 to 18 I think).  Since there is a 9-pin serial connector on the end of the cable the OP linked to, that pretty much guarantees the 12V signalling so there will most certainly need to be a polarity conversion before connecting it to the micro pins.

Best thing is to either:
1) get something like one of these:
http://www.adafruit.com/products/70
http://www.adafruit.com/products/284
http://www.adafruit.com/products/954

2) put in a MAX232 on the breadboard

I have one of these, works great:
http://www.microcenter.com/product/389986/OSEPP_FTDI_Breakout_Board


Logged

Experience, it's what you get when you were expecting something else.

0
Offline Offline
Full Member
***
Karma: 0
Posts: 117
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How about the polarity inversion that @afremont wrote about !
Actually, I'd found some contradictory information, which is why I asked here.

For instance, this link talks about the need of MAX2232 (and few caps) inspite of interaction with Arduino (which is clearly operating at 5VDC). See this one, where they talk of RS-232 working at 10VDC.

Sorry, but I am a software guy, with fairly superficial electronics knowledge, so this thing isn't very obvious.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 117
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks folks. So it is indeed multimeter time. Will try out the voltage levels of the connector I have. If they are 5VDC, then I believe, I should be good to go. Would I still have to worry about polarity inversion ?
Logged

texas
Offline Offline
God Member
*****
Karma: 27
Posts: 862
old, but not dead
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Look at the diagram on this page.
http://www.maximintegrated.com/datasheet/index.mvp/id/1798
Note the little dots (inverters) on the points (outputs) of the triangles (drivers).

Here is another, check the first diagram on the page for the signal polarity and voltage:
https://www.sparkfun.com/tutorials/215
« Last Edit: May 14, 2013, 12:01:47 pm by afremont » Logged

Experience, it's what you get when you were expecting something else.

texas
Offline Offline
God Member
*****
Karma: 27
Posts: 862
old, but not dead
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Would I still have to worry about polarity inversion ?

No. RS232 doesn't do inversion, I don't know where anybody got that idea.



I don't know where you get that idea from, but please check this link:
https://www.sparkfun.com/tutorials/215

The RS232 voltage level signal IS inverted from the TTL level version.

EDIT:  An RS232 line idles at -12V nominally, a TTL line idles at +5V.  Some micros (I don't know about the AVR) will let you invert the signals that the hardware UART generates.  This will sometimes work with the more modern serial ports, but I assure you that there is a whole lot of vintage equipment that will not honor +5V and 0V signals, even if they are the right polarity.
« Last Edit: May 14, 2013, 12:07:48 pm by afremont » Logged

Experience, it's what you get when you were expecting something else.

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 150
Posts: 5635
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't know where you get that idea from, but please check this link:
https://www.sparkfun.com/tutorials/215

The RS232 voltage level signal IS inverted from the TTL level version.

True, but if his cable outputs the inverted signals then it won't work with any known RS232 device. Somewhere in the cable it has to invert them before they reach the pins.

Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

texas
Offline Offline
God Member
*****
Karma: 27
Posts: 862
old, but not dead
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The cable that the OP posted a link to must have a MAX232 type level converter inside or they wouldn't have terminated it in the DB-9 connector.  The ones that I posted a link to only have the FTDI chip so they output TTL levels and polarities.  That's why they terminate the way they do.
Logged

Experience, it's what you get when you were expecting something else.

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 150
Posts: 5635
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks folks. So it is indeed multimeter time. Will try out the voltage levels of the connector I have. If they are 5VDC, then I believe, I should be good to go.

Thinking about this more, you only want to send data from the ATtiny85 and there's no flow control.

In this case there's no level conversion necessary. The only wire connected is TX (Tiny85->cable). It either works or it doesn't.

Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

0
Offline Offline
Full Member
***
Karma: 0
Posts: 117
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks folks.

@afremont, I read though the sparkfun article and data-sheet, and I think I understand the RS-232 and TTL differences now, and can appreciate your reasoning and why you suggested what you suggested. I think, I do have some MAX232x's somewhere and can use those.

@fungus, are you suggesting that I hook-up the TTL-level Tx pin, to the dongle/converter's RS-232 level Rx pin, and "try it out" ? Nothing bad can happen, because Rx-end can, in worst case expect higher voltage signals (and perhaps, also inversion). At worst, this thing won't work, but usually no fear of magic-smoke! Right ? Or, I didn't understand your last statement.

Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 150
Posts: 5635
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@fungus, are you suggesting that I hook-up the TTL-level Tx pin, to the dongle/converter's RS-232 level Rx pin, and "try it out" ? Nothing bad can happen, because Rx-end can, in worst case expect higher voltage signals (and perhaps, also inversion). At worst, this thing won't work, but usually no fear of magic-smoke! Right ? Or, I didn't understand your last statement.

Yep. I don't see how anything bad can happen if you only connect that wire.

PS: Connect GND as well!
Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

texas
Offline Offline
God Member
*****
Karma: 27
Posts: 862
old, but not dead
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have one of those USB to DB9 serial cables that I just tested.  With respect to the ground pin in the DB9 connector, the outputs idle at -6.5V.  So you can see, the DB9 versions support negative voltages of true RS-232.  It's kinda like this cable:
http://www.tri-plc.com/USB-RS232/drivers.htm

It can deliver 30mA on a pin.

Fungus is right, connecting only the TX pin from the Arduino board to the RX pin of the USB to serial cable shouldn't be able to harm anything since the cable can accept a much broader range of voltages than the Arduino board can deliver.  Don't hook up any of the other signaling wires though, because you don't really need the cable delivering -6.5V@30mA to the Arduino. 
« Last Edit: May 15, 2013, 03:26:12 am by afremont » Logged

Experience, it's what you get when you were expecting something else.

Pages: [1] 2   Go Up
Jump to: