I'm working on a project that requires pins to be in a high-impedance state. For most pins this works fine by setting the pin to input and disabling the pull-up resistor. However, when I do this with pins 0 and 1 they will source enough current to dimly light an LED. Presumably this has something to do with their dual function for USB. Anything I can do to disable this behavior, either in hardware or software?
You can disable it by clearing the relevant bits in UCSRnA (see datasheet).
This is an electrical hardware issue, not an internal firmware configuration situation.The rec data coming to arduino pin 0 from the USB serial converter is going through a series 1k ohm resistor will act as a permanent pull-up to +5vdc as that is the idle state when the USB serial link is not active, so it's an electrical issue and the pin cannot be truly 'tri-stated' as long as that electrical path to the USB chip is intact.Now possibly if one wanted to erase the firmware in the USB serial converter chip, what you cause all it's I/O pins to default to input only and thus the two 1k series resistors would be a non issue.
If the atmega16u2 were configured to have PD2 and PD3 (the RXD and TXD pins) as inputs, then that would solve my pull-up problems.