Particle Electron is supplying power through TX pin to receiving device

Gentlemen,
I have an electron connected to an AVR Mega2560 cpu. The electron TX output pin is connected to the MEGA2560 RX pin. When the electron is not transmitting data, it seems to default to a high signal level. This High signal (+2.9v) is partially powering the MEGA2560. Is is possible to set the electron TX signal to stay at a low level until it is ready to transmit data?

@TomEldredge, the TX is the UART output which is a Non-Return-Zero signal. In other words, when Idling, it will always be HIGH. You would need to disable the Serial port (Serial.end()??) to have it go low I believe. I have not tested this.

1 Like

I was thinking the same thing as peekay123. I haven’t tested it, but you could probably use Serial.end() to turn off the port. It may or may not go low at that point. You may need to digitalWrite(TX, LOW) as well. Then do a Serial.begin() again when you want to send. But I’ve honestly never tried turning a serial port off after turning it on.

1 Like

It would be Serial1.end(), which is implemented like this

void USARTSerial::end()
{
  HAL_USART_End(_serial);
}

Which in turn does this (amongst other things)

  // Undo any pin re-mapping done for this USART
  GPIO_PinRemapConfig(usartMap[serial]->usart_pin_remap, DISABLE);

And in order to use digitalWrite() you might need to set pinMode() but maybe you don’t need OUTPUT and LOW - INPUT with high-Z might do too.

2 Likes

Thank you, Gentlemen.

We will try this.

Tom

Note that after re-enabling the port, you should wait at least a character time before sending your first byte, so that the receiving UART will go back to idle (looking for the falling edge of the start bit). This will ensure the first byte you send is received without error.

You will also likely see framing errors and a spurious junk byte on the arduino before your first good byte arrives due to the line being low.

2 Likes