A lot of people miss this, but if you have an external 3V device, and it's not working on a
certain pin, make sure you're not using a pin with a Schmitt Trigger input buffer.

A pin with a TTL input buffer should work fine with the 3V input if VDD >= 4.5V and <= 5.5V.

A Schmitt Trigger input needs ~0.8 * VDD to meet the input logic 1 threshold.

The comparator trick is cool too, but you might fix it by just switching to a TTL input.