Enable Pullup on UART input (Nano 33)

I have two Nano 33's communicating with each other over SERCOM0. If one of them is powered down, the other receives junk. I would think that could be prevented by having a pullup on the input pin (that would be pin 5).

So I need to use an external pullup, or can I enable an internal pullup on a pin that is enabled for serial I/O?

Thanks,
Ken

Answering my own question, I tried it:

pinMode(2, INPUT_PULLUP);

And that solves the problem I was having.
So, the answer is yes, I can enable an internal pullup on a pin that is enabled for serial I/O.

It is a bad idea to connect two devices by I/O pins, when one of them is powered down.

An output pin on the powered device that is set high, while connected to the unpowered device will be overloaded, and may even "phantom" power the other device via the input protection diodes, causing it to malfunction.

@jremington: Thanks for the feedback. I'm sure you are correct.

It looks like my answer is wrong. I don't know why it seemed to work, but it doesn't.

It looks like I'll have to put opto-isolators in the circuit to keep this clean.

In normal operation, both will be powered up. It's only in the case of a failure that one might go down.

Optoisolators are a good solution. I should have mentioned the possibility.

Some people use a less safe approach for a UART connection: a 4.7K or 10K resistor between the input and output pins will limit the current into the unpowered device. May not work with high baud rates.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.