View previous topic :: View next topic |
Author |
Message |
educasoft
Joined: 02 Feb 2009 Posts: 82
|
Posted: Thu Feb 16, 2012 11:45 pm Post subject: Connect an atmega328 to an arduino mega over serial |
|
|
Hi ,
Since an arduino mega seems to have 2 serial ports, I was thinking if it would be possible to connect the arduino to the pc over the usb cable and then connect another atmega328 with his serial port to the second uart of the avr on the arduino board?
Is that possible?
Should I just cross TX and RX and share GND ? Or is there more involved than that ?
Kind regards,
Bart |
|
Back to top |
|
|
hgrueneis
Joined: 04 Apr 2009 Posts: 902 Location: A-4786 Brunnenthal
|
Posted: Fri Feb 17, 2012 5:30 am Post subject: |
|
|
If the board does not have a serial connection that can be directly connected to a PC (I do not use these boards),
meaning if it has a TTL (5V) level output instead of RS232 (mostly 12 Volt), then you can connect it as you assumed.
Otherwise you kill the other RX input and /or the chip.
If you do not know but can trace the TX and RX lines to the com connection directly visually or with an ohm-meter, without a chip in between, then it is OK too.
Of course I do not know if your board has any status lines that need to be connected or jumpered for functionality of the serial link.
Hope this helps.
Hubert |
|
Back to top |
|
|
educasoft
Joined: 02 Feb 2009 Posts: 82
|
Posted: Fri Feb 17, 2012 7:48 am Post subject: |
|
|
Well, the board I use is an arduino mega256 which has 4 hardware serial ports.
The serial0 is connected to hardware to interface at pc serial voltage levels, but I don't see that serial1,2 and 3 would have such circuitry. I believe the pins have just been brought out in direct connections on the board, so I can assume that I can cross connect with the serial on my atmega328 which also has direct connection and no additional hw to alter voltage levels ?
Maybe a stupid question, but can serial0 work at for example 115200 baud to the pc and then the connection on serial1 (to my atmega328) only be 9600 baud ? Or must baudrates be the same on all ports ?
Kind regards,
Bart |
|
Back to top |
|
|
bzijlstra
Joined: 30 Dec 2004 Posts: 1179 Location: Tilburg - Netherlands
|
Posted: Fri Feb 17, 2012 12:18 pm Post subject: Hard- and soft serial... |
|
|
Perhaps not what you exactly looking for, but a nice solution for hardware and software serial ports.
http://members.home.nl/bzijlstra/software/examples/wiz610wi.htm
Written by SIX1
See step 9.
The softserial on interrupt-base.
Have fun
Ben Zijlstra |
|
Back to top |
|
|
educasoft
Joined: 02 Feb 2009 Posts: 82
|
Posted: Fri Feb 17, 2012 12:23 pm Post subject: |
|
|
Ben, I wonder what a wireless lan module has to do with this ?
I think (hope) that I just can connect TX from serial1 (2nd serial) on my arduino mega to RX on my atmega328 and then RD from arduino to TX on atmega + share the gnd line and then I could communicate.
Thats what I was initially asking
Regards,
Bart |
|
Back to top |
|
|
hgrueneis
Joined: 04 Apr 2009 Posts: 902 Location: A-4786 Brunnenthal
|
Posted: Fri Feb 17, 2012 5:03 pm Post subject: |
|
|
To select a different baud rate for the second hardware UART, just use $BAUD1=9600 (see Help File).
This way you can connect as you discribed.
Hope this helps.
Hubert |
|
Back to top |
|
|
|