JTAG and IO

Is possible to use same IO pins for JTAG interface and external interface ?

I don’t belive so. This wracked my brain for a while trying to figure out why my LCD display wasn’t working on PortC of my Mega32. From the datasheet: “If the JTAG interface is enabled, the pull-up resistors on pins PC5(TDI), PC3(TMS) and PC2(TCK) will be activated even if a reset occurs.”

I suppose you could try to use them as inputs (I haven’t and it would probably be a bad, bad idea), but you won’t be able to use them as outputs unless you disable the JTAG by configuring the fuses.

You can disable - and re-enable - the JTAG from software running in your target. So you can at least switch off the JTAG before doing things like LCD writes, then switch it back on so your debugger works. At least this gives you some control, better that setting the fuses, which is permanent.