Go Down

Topic: Monitoring RX Pin (Read 835 times) previous topic - next topic

Aug 05, 2011, 01:55 am Last Edit: Aug 05, 2011, 02:04 am by isometrik Reason: 1
I am attempting to interface an Arduino Uno with a bluetooth module. The two communicate with one another via TTL level signals using the RX/TX pins. In order to setup the bluetooth module on power up, I must wait for a prompt and send some text commands via serial.

The problem lies in the fact that I can't see anything I'm receiving on the RX pin of the Arduino. The only way I can see it is if I have the serial monitor open and call

Code: [Select]
Serial.println((char)Serial.read());

to echo whatever data I receive to the screen. This obviously causes problems since using that method actually writes the received data back to the bluetooth module.

Is there a way I can echo the RX data without having to actually write it back to the serial port?

Edit: I just realized the serial monitor only captures what is sent over the usb connection, not what is sent/received over the RX/TX pins. I suppose the only way to monitor these pins is to use another serial cable?

retrolefty

Quote
I suppose the only way to monitor these pins is to use another serial cable?


That a good reason to get one of these nice inexpensive usb serial converter modules:

http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=190544446821&ssPageName=STRK:MEWNX:IT


Lefty

PaulS

You could connect the bluetooth device to some other pins, and use NewSoftSerial to talk to it, leaving pins 0 and 1 free for debugging.

tkbyd

For details of connecting Arduinos to serial devices, such as the one you are working with, or even just a "big" PC....

http://sheepdogguides.com/arduino/art4SeIntro.htm

Nick Gammon


Edit: I just realized the serial monitor only captures what is sent over the usb connection, not what is sent/received over the RX/TX pins. I suppose the only way to monitor these pins is to use another serial cable?


What is the difference? What is sent over the USB connection is what is on the Rx/Tx pins. As an example, in this project here:

http://www.gammon.com.au/forum/?id=11283

I have connected a RFID card-reader to pin D0 (the Rx pin). I receive the data in the sketch, and echo it on D1 (the Tx pin). That shows up in the serial monitor, as I expect it to.

Quote
Is there a way I can echo the RX data without having to actually write it back to the serial port?


Well the serial monitor never echoes the Rx data, so that is the real problem.

For debugging you could disconnect the Tx pin from your bluetooth module (so the data from your sketch is not echoed back to it) and then add the line you had which copies the Rx data to the Tx pin.

Alternatively use the NewSoftSerial library and connect the bluetooth module to other pins (which is exactly what PaulS said). Or, for debugging echo via (say) I2C to a second Arduino and monitor what is happening with that. Or, get a logic analyzer.
Please post technical questions on the forum, not by personal message. Thanks!

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

Go Up