Pages: [1]   Go Down
Author Topic: How can I communicate Serially with an Atmega328  (Read 680 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 36
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have set an Atmega328 on a board and programmed it with avrdude and a R3 UNO board as shown in the image


the code that is uploaded on it contains some Serial communications
Serial.print("....");
How can I see what it sends , without the need of any extra hardware  ?
Thanks in advance.
Logged

Brisbane, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1123
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

What were you hoping to view it on? If it's your PC then you're going to need something to convert that RX/TX signal to USB (say) that a serial terminal program can interpret on the PC.  If you have a serial display of some kind (I2C character LCD for example) you could change the Serial.print calls to lcd.print and see it that way.  Otherwise if you're debugging a standalone ATMega board, using LEDs to indicate program states is a simple alternative also.

What kind of information are you needing to see from your sketch?

Cheers ! Geoff
Logged

"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

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

I believe that if you connect the serial output pin of the other chip to pin 0 (RX) you will be able to see it on the serial monitor as long as the baud rate is correct.
Logged

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

Offline Offline
Newbie
*
Karma: 0
Posts: 36
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I want to view it on my PC and it is basically Strings..
The problem is that , everything now is soldered so connecting it to an LCD would need a lot of time.
What If I removed the Atmega328 from the UNO board then connected the TX , RX pins from the Atmega328 to the UNO board , will that work ?
Logged

Brisbane, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1123
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What If I removed the Atmega328 from the UNO board then connected the TX , RX pins from the Atmega328 to the UNO board , will that work ?
Yes, that sounds like a good option for the gear you have on hand.  With the Uno powered up the USB functionality will be provided that you need to view the strings on the Arduino IDE's serial monitor.
Logged

"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

Offline Offline
Jr. Member
**
Karma: 4
Posts: 67
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What If I removed the Atmega328 from the UNO board then connected the TX , RX pins from the Atmega328 to the UNO board , will that work ?

This is what I've been doing and it works great.  The only down side is you'll be removing and replacing the '328 a lot on the uno as you switch between programming and debugging.  If you're going to be doing this frequently, it may be worth looking into getting a standalone programmer.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17303
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What If I removed the Atmega328 from the UNO board then connected the TX , RX pins from the Atmega328 to the UNO board , will that work ?

This is what I've been doing and it works great.  The only down side is you'll be removing and replacing the '328 a lot on the uno as you switch between programming and debugging.  If you're going to be doing this frequently, it may be worth looking into getting a standalone programmer.

That will work but there is an easier way. On the UNO board just jumper the shield reset pin to a shield ground pin, that will force all the UNO's 328P I/O pins input to high impedance input mode so will have no effect on anything wired to pins 0 and 1 to utilize the USB serial function.

Lefty
Logged

Brisbane, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1123
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That will work but there is an easier way. On the UNO board just jumper the shield reset pin to a shield ground pin, that will force all the UNO's 328P I/O pins input to high impedance input mode so will have no effect on anything wired to pins 0 and 1 to utilize the USB serial function.
Lefty that is tremendously clever.  Thanks so much for that tip.  I'll have to remember it the next time I'm reaching for a chip puller smiley

Geoff
Logged

"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

Denmark
Offline Offline
Edison Member
*
Karma: 36
Posts: 1084
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Even easyer than Lefty's suggestion:

Use TinyISP instead of ArduinoISP.
With that you don't need any swapping around wires, just leave everything as it is when programming, and open the serial monitor as you are used to.

TinyISP:

https://github.com/Coding-Badly/TinyISP/zipball/master

TinyKnockBang library
https://github.com/Coding-Badly/TinyDebugKnockBang/zipball/master
« Last Edit: April 07, 2013, 07:06:12 am by Erni » Logged

Pages: [1]   Go Up
Jump to: