Go Down

Topic: How can I communicate Serially with an Atmega328 (Read 832 times) previous topic - next topic

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.

strykeroz

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
"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

afremont

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.
Experience, it's what you get when you were expecting something else.

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 ?

strykeroz


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.
"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

JoshD


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.

retrolefty



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

strykeroz


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 :)

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

Erni

#8
Apr 07, 2013, 02:02 pm Last Edit: Apr 07, 2013, 02:06 pm by Erni Reason: 1
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

Go Up