JTAG disable/enable during debug.

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I know, bad idea but perhaps it may work, won't be able to try it for a few days. Any ideas welcome.

I'm using 2 bits of portc (JTAG pins) as startup settings, they will only be read once after reset.

So the idea is that JTAG would be enabled as per normal, after init JTAG would be disabled with the usual writing to JTD, this will switch the pins to input mode (but probably also crash the JTAG session).
Read the pins.
Re-eneable JTAG by writing 0 twice to JTD???
Continue with normal JTAG debugging...or not :?

Has anybody tried anything like this? Can JTAG be switched on/off during debug? It's unlikely but I can't see anything specific, only that JTD has to be 0 for JTAG to work.

Would "hot-plugging/unplugging" JTAG be allowable? It would be nice if it worked.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, did not really expect it to work (just hoping) and I was right. :?

Tried this

#if debug==1
	MCUCR = (1<<JTD); 							//Disable JTAG in debug mode
	MCUCR = (1<<JTD); 
	portc_status=PINC;
	MCUCR &= ~ (1<<JTD); 						//Re-enable JTAG in debug mode
	MCUCR &= ~ (1<<JTD); 
#endif

but JTAG does not get re-enabled. I think the Message window tells the tale

Quote:
JTAGICE mkII: IDR event 0xff.
JTAGICE mkII: Target has entered sleep mode.
JTAGICE mkII: IDR event 0xff.
Back to fake portc_status during debug :(

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is exactly what I'm trying to do also (disable JTAG, read option switches isolated w/1k resistors, re-enable JTAG).

 

Did you ever find a way to get it to work or documented somewhere that you can not re-enable JTAG?

 

Regards,

 

Chuck Hackett

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are you talking about disabling JTAG at run time or during debug? The later is not possible as far as I know. I have never tried it but soon as you disable JTAG (if at all possible in software during debug ) then Studio will crash as it loses communications with the chip. But I may be wrong, even if it would be for the 1st time in my life..... cheeky

 

Edit oops so it was me with that crazy idea 11 years ago....

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

Last Edited: Fri. Jul 5, 2019 - 10:59 PM