I need measure temperature to adjust ticks as temperature changes. I suppose thermistor nearby crystal (10ppm) as low cost solution. I'm using AT90USBxxx but I have allocated PF0-3 for more important analog signals. So I need reuse pins shared with JTAG interface and I need debugging option enabled when thermometer is disabled. Thermistor is not capacitive load hence I can connect circuit behind serial resistor as explained in AVR042 app note.
simulate this circuit – Schematic created using CircuitLab
When starting I can adjust JDT bit of MCUCR register.
But is somehow possible to detect if JTAG cable is plugged in?
I don't think so. As workaround is possible to modify bootloader or implement a custom JTAG on/off parameter stored in EEPROM.
What JTAG pin (TCK, TDO, TMS, TDI) is preferred or does not matter?
Any ideas or objections against proposed solution?
Reference: http://blog.lse.epita.fr/articles/61-dealing-with-the-pull-up-resistors-on-avr.html (but they do not want to support JTAG)