Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
chwong
PostPosted: Jan 20, 2012 - 11:37 AM
Wannabe


Joined: Jul 31, 2003
Posts: 94


Dear All

I have 2 devices want to communicate each other.
(the maxiumn distance is 10m)

I test it OK when each devices communicate to PC via UART by TTL232.

but I test it fail when the 2 device connect together.
the mcu on device1 can NOT receive any UART interrupt.
also the mcu on device2 can NOT receive any UART data.

My question is Do I need the TTL232 in each device for communication (No PC, only 2 MCUs)??

if no need use TTL232 ic (direct TX<->RX pin of MCU), can it communicate in 10m distance ?

Thank you!!
 
 View user's profile Send private message  
Reply with quote Back to top
bobgardner
PostPosted: Jan 20, 2012 - 11:59 AM
10k+ Postman


Joined: Sep 04, 2002
Posts: 21274
Location: Orlando Florida

The TTL level might work if the baud rate is not too fast. Need the to run the ground wire as well as the rx and tx. Did you do that?

_________________
Imagecraft compiler user
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
chwong
PostPosted: Jan 20, 2012 - 12:14 PM
Wannabe


Joined: Jul 31, 2003
Posts: 94


bobgardner wrote:
The TTL level might work if the baud rate is not too fast. Need the to run the ground wire as well as the rx and tx. Did you do that?
No, I didn't test on direct connect TX/RX pin between these 2 MCUs.

in the past, I used TTL232 for communication between MCU to PC. I didn't test to use TTL232 for communication between 2 MCUs.

today, I test it, but it fail. so why I have these question, DO I NEED the TTL232 in communication of 2 MCU? If I don't need it, what the maxiumn distance will the UART have ?

tks!

PS: I have connected the ground of 2 devices together. (gound B == ground A)
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Jan 20, 2012 - 12:28 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62365
Location: (using avr-gcc in) Finchingfield, Essex, England

Quick question: how are the AVRs being clocked? Crystals or internal oscillators?

If you are using TTL232 (presumably MAX232 or similar?) then you need a pair. When you use AVR-TTL232-PC what you are really using is AVR-TTL232-TTL232(inPC)-PCUart

The line driver both level shifts the signal AND inverts it. So if you don't have a pair one end is going to see the inverted signal (and also at the wrong voltage level).

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
bobgardner
PostPosted: Jan 20, 2012 - 12:45 PM
10k+ Postman


Joined: Sep 04, 2002
Posts: 21274
Location: Orlando Florida

Make one send UUUUU in a loop. If the other one can receive that, both are running at the same baud rate.

_________________
Imagecraft compiler user
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
chwong
PostPosted: Jan 20, 2012 - 01:35 PM
Wannabe


Joined: Jul 31, 2003
Posts: 94


Sorry, I know what the problem is..

in 2 mcus:
AVR1(TX)-(TX)TTL232(Rxd)-(Rxd)(TTL232)(TX)-(TX)AVR2

I swaped the RxD and TxD wire, then I can receive the data.

THANK YOU, ALL !
 
 View user's profile Send private message  
Reply with quote Back to top
dksmall
PostPosted: Jan 20, 2012 - 02:38 PM
Raving lunatic


Joined: Apr 16, 2001
Posts: 3522
Location: Phoenix, Arizona

What is TTL232 suppose to be? I assumed it simply means a TTL level serial stream, but then I see the OP comment that he connected directly to a PC using TTL232, but that should be RS232, not TTL voltage levels.
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Jan 20, 2012 - 03:00 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62365
Location: (using avr-gcc in) Finchingfield, Essex, England

Quote:

What is TTL232 suppose to be?

MAX232 I guess?

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
AgwanII
PostPosted: Jan 20, 2012 - 03:37 PM
Posting Freak


Joined: Mar 17, 2005
Posts: 1307
Location: Stockholm, Sweden

Some PC RS232 cheat and use other voltages. I have even seen them with 0-5V instead of +-12.
 
 View user's profile Send private message  
Reply with quote Back to top
chwong
PostPosted: Jan 20, 2012 - 03:49 PM
Wannabe


Joined: Jul 31, 2003
Posts: 94


clawson wrote:
Quote:

What is TTL232 suppose to be?

MAX232 I guess?

Yes, I use max232~
 
 View user's profile Send private message  
Reply with quote Back to top
bobgardner
PostPosted: Jan 20, 2012 - 04:06 PM
10k+ Postman


Joined: Sep 04, 2002
Posts: 21274
Location: Orlando Florida

Just pretend its a stereo amp. The output of the amp goes to the input of the speaker. Now pretend the tx is the output and the rx is the input.

_________________
Imagecraft compiler user
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
Torby
PostPosted: Jan 20, 2012 - 04:34 PM
Raving lunatic


Joined: Nov 11, 2003
Posts: 3904
Location: Chicago Illinois USA

Chwong, Oh yes, I've done that

_________________
Discursive design,

Torby

Some days, it's just not worth chewing through the restraints.
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
dksmall
PostPosted: Jan 20, 2012 - 07:29 PM
Raving lunatic


Joined: Apr 16, 2001
Posts: 3522
Location: Phoenix, Arizona

AgwanII wrote:
Some PC RS232 cheat and use other voltages. I have even seen them with 0-5V instead of +-12.


And then people wonder why their serial devices don't work.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits