Tx/Rx do not seem to work when connected to external power

Trying to debug a Bluetooth transceiver using an Arduino Uno, so I simplified the code immensely. I wanted to make sure that the transceiver was receiving data from the Serial Communications pins. Now I’m really puzzled.

The code has a simple “heartbeat”: LED flashes and Pin 7 gets a pulse. At the same time, the serial port outputs “A” + + .

Works fine when connected to PC with USB A-B cable. A serial port monitor shows the proper results.
A scope indicates Pins 1, 7 are doing what I expect. The on-board LED flashes.

When using a wall-wart or power supply, the onboard LED works fine. Pin 7 generates the sync pulse. However, Tx/Rx LED’s no longer flash and Pin 1 is stuck at 5 V.

When probing with a scope and plugged into the USB port, everything works as expected. I can go back and forth all day. The state repeats itself. The wall-wart is 12V @ 180 mA. The power supply is set to 9.0 V and never pulls more than 45 mA (limited at 650 mA). There is no “brownout” on the 5.0V or 3.3V regulated supplies. Seems like there’s enough power. :confused:

#define PIN_heartbeat 7

void beatHeart()
{
  digitalWrite(PIN_heartbeat, HIGH);
  digitalWrite(LED_BUILTIN, HIGH);
  delay(200);
  digitalWrite(PIN_heartbeat, LOW);
  digitalWrite(LED_BUILTIN, LOW);
}

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(PIN_heartbeat, OUTPUT);
  digitalWrite(PIN_heartbeat, LOW);
  digitalWrite(LED_BUILTIN, LOW);

  Serial.begin(9600);
  delay(50);
}

void loop() {

  Serial.println("A");
  beatHeart();

  delay(2000); // wait half a sec
}

Before you ask for a circuit, there isn’t one! Nothing is connected. I just probe the pins with a scope

bcat007:
Before you ask for a circuit, there isn't one! Nothing is connected. I just probe the pins with a scope

Don't you have the Bluetooth module connected?

Please post the complete program.

The Uno should not care how it is powered - mine don't.

...R

I can't explain why the TX pin does not work.

However the TX/RX leds are controlled by the USB-to-TTL converter; and I have noticed that they don't work when there is no connection with the PC.

Robin2:
Don't you have the Bluetooth module connected?

Please post the complete program.

The Uno should not care how it is powered - mine don't.

...R

I removed the Bluetooth module. So, it is just the Arduino.

I did post the entire code base. There's nothing else.

bcat007:
I did post the entire code base. There's nothing else.

Sorry. I thought it was just the beatHeart() function.

I tried your program on my Uno and it works as expected when powered by the USB cable and when powered from a 4.5v battery with the USB cable disconnected.

...R

sterretje:
I can't explain why the TX pin does not work.

However the TX/RX leds are controlled by the USB-to-TTL converter; and I have noticed that they don't work when there is no connection with the PC.

sterretje:
I can't explain why the TX pin does not work.

However the TX/RX leds are controlled by the USB-to-TTL converter; and I have noticed that they don't work when there is no connection with the PC.

I've even applied power to the USB "B" connector. Still no success. Tried the following:

  1. USB in PC / works fine. Terminal emulator shows "A", light blinks, pin 7 toggles
  2. USB in power strip (no PC just power). No serial comm, light blinks, pin 7 toggles
  3. Wall-wart to power connector (12 V @ 180 mA). No serial comm, light blinks, pin 7 toggles
  4. Power supply to power connector. No serial comm, light blinks, pin 7 toggles

bcat007:
I've even applied power to the USB "B" connector. Still no success. Tried the following:

  1. USB in PC / works fine. Terminal emulator shows "A", light blinks, pin 7 toggles
  2. USB in power strip (no PC just power). No serial comm, light blinks, pin 7 toggles
  3. Wall-wart to power connector (12 V @ 180 mA). No serial comm, light blinks, pin 7 toggles
  4. Power supply to power connector. No serial comm, light blinks, pin 7 toggles

plug your tx pin into your rx pin.

bcat007:
I've even applied power to the USB "B" connector. Still no success. Tried the following:

  1. USB in PC / works fine. Terminal emulator shows "A", light blinks, pin 7 toggles
  2. USB in power strip (no PC just power). No serial comm, light blinks, pin 7 toggles
  3. Wall-wart to power connector (12 V @ 180 mA). No serial comm, light blinks, pin 7 toggles
  4. Power supply to power connector. No serial comm, light blinks, pin 7 toggles

I wasn't referring to power on the USB. The usb-to-ttl chip needs to 'see' the computer (data lines).

Clearly the heartbeat is working, so we know the UNO is alive and processing code. It's not a matter of power. The Tx pin is only 1/2 of a circuit and requires the receiving half to work at all. Similarly, the Rx pin is only 1/2 of a circuit and requires the transmitting half to work at all. A probe is not sufficient.

sterretje:
I can't explain why the TX pin does not work.

However the TX/RX leds are controlled by the USB-to-TTL converter; and I have noticed that they don't work when there is no connection with the PC.

I'm not sure I understand. This is what I found for a schematic of the Uno: https://www.arduino.cc/en/uploads/Main/arduino-uno-schematic.pdf .

The schematic seems to indicate that the Tx / Rx pins come straight out of the ATMEGA8. In what way is the USB-to-TTL connected to this?

How would the Arduino even "know" that the USB is connected other than through the ATMEGA8U2-MU? Seems like this is firmware (F/W) not an explicit feature of the circuit.

What F/W on the ATMEGA8U2-MU might detect the presence of the USB-PC connection and why might that logic disable the Tx/Rx?

Why does it matter whether the lights flash or don't flash?

...R

Sorry if I caused confusion

sterretje:
I can't explain why the TX pin does not work.

It would probably have been clearer if I had said "I can't explain why the TX pin does not work, it should not be affected".

The only point that I was trying to make was that the LEDs don't work in my experience if there is no data connection with the PC.

bcat007:
I'm not sure I understand. This is what I found for a schematic of the Uno: https://www.arduino.cc/en/uploads/Main/arduino-uno-schematic.pdf .

The schematic seems to indicate that the Tx / Rx pins come straight out of the ATMEGA8. In what way is the USB-to-TTL connected to this?

How would the Arduino even "know" that the USB is connected other than through the ATMEGA8U2-MU? Seems like this is firmware (F/W) not an explicit feature of the circuit.

What F/W on the ATMEGA8U2-MU might detect the presence of the USB-PC connection and why might that logic disable the Tx/Rx?

The 8U2 (nowadays 16U2 in the Uno R3) is the USB-to-TTL converter and it knows if a PC is connected; don't ask me how. It does not disable the RX/TX of the 328P and I never indicated that (to my knowledge); I only referred to the leds. The TX line that you measure (pin 1) should follow what you print with the Serial.println in your code.

Robin2:
Why does it matter whether the lights flash or don't flash?

...R

Op's problem is that the TX pin is stuck at 5V (no data); below from the opening post

bcat007:
When using a wall-wart or power supply, the onboard LED works fine. Pin 7 generates the sync pulse. However, Tx/Rx LED's no longer flash and Pin 1 is stuck at 5 V.

sterretje:
Op's problem is that the TX pin is stuck at 5V (no data); below from the opening post

That is the normal state for the Serial TX when Serial is idle.

...R

I know; but according to the code, OP is printing.

Perehama:
Clearly the heartbeat is working, so we know the UNO is alive and processing code. It's not a matter of power. The Tx pin is only 1/2 of a circuit and requires the receiving half to work at all. Similarly, the Rx pin is only 1/2 of a circuit and requires the transmitting half to work at all. A probe is not sufficient.

Tried connecting Tx to Rx and the results are the same...nothing.

Why does it matter whether the lights flash or don't flash?

I don't care if the lights flash, but I do care if the Tx/Rx don't work. I want to connect the Tx/Rx to a Bluetooth module (HC05). Wiring examples show the Tx/Rx connected to the appropriate pins on the HC05. Since the HC05 didn't work as expected, I'm simplifying the circuit to make sure that everything other than the HC05 works as I expect.

When I disconnected the HC05, I noticed no signal on the Tx. That made me suspicious.

As far as I know, you cannot operate the HC05 at the same time as having an Uno plugged into the USB. Therefore, there's got (?) to be a way to make the Tx/Rx work without the Uno connected via USB. The question is how.

Maybe unrelated, but I couldn’t get rx and tx to work when connected to usb and external power, had to also connect a gnd from the usb to my board to get it working

bcat007:
As far as I know, you cannot operate the HC05 at the same time as having an Uno plugged into the USB. Therefore, there’s got (?) to be a way to make the Tx/Rx work without the Uno connected via USB. The question is how.

To my knowledge, you actually can, except for uploads.
1)
328P TX → BT RX and 16U2 RX; whatever you print from the 328P will go to both.
2)
328P RX → BT TX and 16U2 TX; there will be a conflict if both the BT and the 16U2 send at the same time.

The series resistor between the 328P and the 16U2 provides protection of the 16U2 in case BT pulls the TX low while the the 16U2 makes it high (and vice versa).

Without USB connection, TX pin should work.

sterretje:
I know; but according to the code, OP is printing.

Maybe. But according to Reply #3 he has nothing connected to the Arduino - so the test seems a complete waste of time.

...R

According to the opening post, a scope is connected.