| Author |
Message |
|
|
Posted: Jan 20, 2012 - 11:37 AM |
|


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!! |
|
|
| |
|
|
|
|
|
Posted: Jan 20, 2012 - 11:59 AM |
|


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
|
| |
|
|
|
|
|
Posted: Jan 20, 2012 - 12:14 PM |
|


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) |
|
|
| |
|
|
|
|
|
Posted: Jan 20, 2012 - 12:28 PM |
|


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). |
_________________
|
| |
|
|
|
|
|
Posted: Jan 20, 2012 - 12:45 PM |
|


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
|
| |
|
|
|
|
|
Posted: Jan 20, 2012 - 01:35 PM |
|


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 ! |
|
|
| |
|
|
|
|
|
Posted: Jan 20, 2012 - 02:38 PM |
|


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. |
|
|
| |
|
|
|
|
|
Posted: Jan 20, 2012 - 03:00 PM |
|


Joined: Jul 18, 2005
Posts: 62365
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
|
Quote:
What is TTL232 suppose to be?
MAX232 I guess? |
_________________
|
| |
|
|
|
|
|
Posted: Jan 20, 2012 - 03:37 PM |
|

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. |
|
|
| |
|
|
|
|
|
Posted: Jan 20, 2012 - 03:49 PM |
|


Joined: Jul 31, 2003
Posts: 94
|
|
|
clawson wrote:
Quote:
What is TTL232 suppose to be?
MAX232 I guess?
Yes, I use max232~ |
|
|
| |
|
|
|
|
|
Posted: Jan 20, 2012 - 04:06 PM |
|


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
|
| |
|
|
|
|
|
Posted: Jan 20, 2012 - 04:34 PM |
|


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.
|
| |
|
|
|
|
|
Posted: Jan 20, 2012 - 07:29 PM |
|


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. |
|
|
| |
|
|
|
|
|