[SOLVED more or less] Rx and Tx pins 0 and 1 at 5v on power up: confused

Morning all,

Just about to start using Uno pins 0 and 1 for serial comms for the first time: so far I've only ever used Serial with the USB, and I'm bit confused.

Do I need to do anything to configure the pins?- do they need a PinMode for example? Here's why I ask: my understanding is that the built-in Rx and Tx LEDs indicate the status of those two pins, yet when I load a sketch like BareMinimum, the pins are both at 5v although the built-in LEDs are off. That doesn't seem right, and I can't imagine why a receive pin would be high anyway when it's not active. If I put an LED from either pin to ground it lights up: but I thought the Tx and Rx built-in LEDs were exactly that, and they're both off.

So clearly either I'm not understanding something and / or my Uno has a glitch. I'm in no hurry so I'm going to await clarity before I hook anything to the Uno Rx pin and pop something.

As an aside, I'm confused also by the directions of the arrows on the board art: strikes me that a Rx pin should have an arrow pointing to the pin, not away?

Any

The Tx and Rx pins are configured by the Serial library (it's a built-in one).

To get it running, you use Serial.begin(19200); (or whatever baud rate you want)

The Tx and Rx pins are high because it's TTL serial. A low is a 1 bit, so the start bit is when it's driven low, for example.

The Tx and Rx LEDs are lit by the ATMega16U2 (The USB chip). The LEDs only indicate that either aactivity is happening, or that the interface chip's serial buffer is full without being read.

On mine, the Rx artwork does have its arrow pointing toward the pin.

Hey lar3ry, and thanks for the quick response.

Have a look at the artwork on this very site!

Your explanation makes sense, so I'll go ahead.

One other thing though: Please confirm there's nothing to do to tell Uno that it must look at the pins rather than at the USB? Obviously when I've used Serial before on the USB I've always used Serial.begin, so how does the board know I mean usb- or pin-based comms? Or does it watch both once Serial.begin is done?

Thanks again,

Jim

Or does it watch both once Serial.begin is done?

The USB and pins 0 and 1 are the same pins so there is no conflict.

Ahh... that picture is what I have. I consider that arrow to be in the proper direction. It's pointing into the board from the input connector, toward the pin on the AVR. Looks like a gozinta, and the Tx pin looks like a gozouta. Funny how folks interpret thing differently.

I can confirm that. The Serial pins are connected to the connector on the side of the Arduino, and also to the interface chip, which has the serial buffers to and from the USB port. You can't separate them. If you need serial communication on the USB to be separate from communication to other devices, you need to either (a) use the Siftware Serial library and specify other pins, or 9b) pick up an Arduino Mega2560. That chip has more built-in serial ports.

Please confirm there's nothing to do to tell Uno that it must look at the pins rather than at the USB?

No, you don't. And as the others said the LEDs only flash if the data happens to be going via USB. If you want to monitor the pins yourself wire an LED and a resistor in series with the actual pin. Since "idle" is high it might be best to wire between the pin and the 5V line rather than Gnd. That is, the serial is active when driven low.

The arrow pointing from the pin to the board does make some kind of sense....

Now I have another concern: I'm going to be using a Wixel on those pins, and the Wixel is a 3.3v, 5v intolerant, device. I expected to have to put a voltage divider between the Uno Tx and Wixel Rx to take the Uno Tx's 5v to the Wixel Rx 's 3.3: the Wixel documentation tells me to do exactly that.

But now that I also see 5v on the Uno Rx, I hope that won't be "seen" by the Wixel Tx and that 0v on the Wixel Tx will happily pull the Uno Rx to 0v. Hopefully the Wixel Tx pin will be configured as an output and won't be "looking" while the Uno has 5v on that line...... If I put a voltage divider on that line just to make sure that the Uno 5v appears as 3.3 to Wixel, what effect will that have on the 3.3v the Wixel will then put "backwards" through the divider: how will that 3.3 appear to the Uno?

(I guess I probably should figure out how to do that calc, or I should at least throw a divider together with input on the output and see what output appears on the input 8) )

(EDIT: Ok I think I thought that one through: if I put 3.3v on the midpoint of a divider, the "output", it'll all just ground through the lower resistor, and nothing will appear at the top of the upper resistor, the "input".)

(I'm not going to be using the Pololu Wixel shield for Uno: perhaps it would have some magic built in to take care of the above problem, if indeed it's a problem in the first place.)

Maybe I should get the Pololu shield: this schematic shows 2 mosfets in a circuit between the Wixel Tx and Uno Rx. Can you boffins tell me if that circuitry is indeed there to prevent that 5v on the Uno Rx appearing at the Wixel Tx?

EDIT: Having said that, this Instructable, which is actually linked from Pololu's Wixel page, simply connects the Uno Rx to the Wixel Tx with a wire. So does this one by a different author, and is exactly what I was planning to do.

So maybe it's not a problem? Keen to hear what you guys think, though.

Maybe I should get the Pololu shield: this schematic shows 2 mosfets in a circuit between the Wixel Tx and Uno Rx. Can you boffins tell me if that circuitry is indeed there to prevent that 5v on the Uno Rx appearing at the Wixel Tx?

Yes it does.

Anyhoo, in spite of my reservation about the 5v UNO Rx appearing on the Wixel Tx, I hooked it up and all is good.

The laptop runs PuTTY to talk to the local Wixel, the Wixels both run the Pololu supplied Wireless Serial App, and the UNO runs this trivial sketch:

// Switch pin 13 led to high with an "h" or "H" 
//     from serial interface

char incomingByte;   // for incoming serial data

void setup() {
        Serial.begin(9600);     // opens serial port, sets data rate to 9600 bps
        pinMode(13,OUTPUT);
        digitalWrite(13, LOW);
}

void loop() {

        
        if (Serial.available() > 0) {
                // read the incoming byte:
                incomingByte = Serial.read();

        }
        
         if (incomingByte == 'h' || incomingByte == 'H')
        {
          digitalWrite(13, HIGH);
        }
        else
        {
        digitalWrite(13, LOW);
        } 
          
}

Next step is to enhance that sketch so that different laptop keystrokes control a robot’s motors.

Visio pic below shows the setup.

Wixels and Uno.jpg