Go Down

Topic: How to debug serial communication (Read 5222 times) previous topic - next topic

anio

Hello,
If I want to communicate to some serial device trough the RX/TX pins but how to debug it? I cant connect arduino to my PC in the same time and send the output from the device to the Serial Monitor. Is there any way to use them both? This serial device will return some text strings and I want to read them.
Thanks!

graynomad

#1
Mar 16, 2011, 11:46 am Last Edit: Mar 16, 2011, 03:33 pm by Graynomad Reason: 1
You could use a Mega to get the code running then put it back on the Deum...heck I can never spell that word.

Otherwise maybe use Software serial or new SS for the job and hardware serial for a debugging output.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

anio

I only have one Arduino Duemilanove :(

PaulS

How are you connecting the device you want to read to the Arduino? You could use two pins other than the serial pins 0 and 1, and use NewSoftSerial to read from/write to the device using the other pins. Then, Serial can be used to talk to the PC.
The art of getting good answers lies in asking good questions.

anio

Thank you PaulS,
I will test it with different pins using NewSoftSerial and Serial for the PC.

astrofrostbyte

Maybe the free terminal Realterm could help you :
http://realterm.sourceforge.net/index.html#Monitor_RX_and_TX_data:_Protocol
It has a port 'sniffing' feature

In combination with the com0com.
The Null-modem emulator (com0com) is a kernel-mode virtual serial port driver for Windows. You can create an unlimited number of virtual COM port pairs and use any pair to connect one COM port based application to another.
http://sourceforge.net/projects/com0com/

Terminal from brad++ also has some handy features:  https://sites.google.com/site/terminalbpp/


Hope it helps, Frosybyte
current project: http://sites.google.com/site/arduinofocus/

anio

Thanks @astrofrostbyte, but I want to debug it inside Arduino. The communication PC<->Arduino is fine.

gardner

I have found that a bus pirate http://dangerousprototypes.com/docs/Bus_Pirate is a useful tool for debugging serial comms.  They're pretty cheap and easy to use.

nickgammon


If I want to communicate to some serial device trough the RX/TX pins but how to debug it? I cant connect arduino to my PC in the same time and send the output from the device to the Serial Monitor. Is there any way to use them both? This serial device will return some text strings and I want to read them.


What I did when debugging the RFID gadget was just plug its output into D0 (Rx pin) and leave D1 (Tx) unconnected. So I got the data from the reader (with Serial.Read) but if I display it (with Serial.print) it goes back to the console. This won't work if you need to send stuff to the serial device, but you said it would "return some text strings".
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

RanTalbott

There are lots of options available to you.

You could use a program like scope to monitor the traffic between the Arduino and the peripheral.  This can be done for next to nothing if you can find an unwanted "obsolete" PC/laptop with a couple of serial ports.

You could attach an LCD or some LEDs with a shift register to display debugging status info with minimal pin usage.  There are I2C interfaces available off-the-shelf that are pretty cheap.

You'll probably want another Arduino eventually, anyway, so buy one now, and hook it up as an I2C slave to your project. Then it can handle communications with the PC.

Go Up