Butterfly problem JTAG (I can´t disable)

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

My problem is that I want to use some port F pins(4,5,6,7) as general I/O, but i can´t disable the JTAG interface. (Im using usart port to programme butterfly)
I tried that code that I saw in net:

void disable_JTAG(void)
{
unsigned char sreg;

sreg = SREG;
cli();
MCUCR |= ( 1 <<JTD );
MCUCR |= ( 1 <<JTD );
SREG = sreg;
}

But PORTF still doesn´t work...
I used Os optimization...
HELP PLEASE.

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

How does the generated assembly (or disassembly) code of that function look?

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

The current version of the Butterfly bootloader disabled the fuse and lock writing functions. People were messing up their fuses, so they took a sledge hammer to fix the problem and just disabled the feature.

Here's a smallish discussion.

Chuck Baird

"I wish I were dumber so I could be more certain about my opinions. It looks fun." -- Scott Adams

http://www.cbaird.org

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

zbaird wrote:
The current version of the Butterfly bootloader disabled the fuse and lock writing functions. People were messing up their fuses, so they took a sledge hammer to fix the problem and just disabled the feature.

Here's a smallish discussion.

I think this was a good thing since it stopped the bootloader from running away and trashing the fuses when the coin cell went low, which was pretty common.

Smiley

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

Thanks for the insight, Smiley. I always wondered why the fuses would get rewritten accidentally. Low battery and runaway code hadn't dawned on my dim little brain.

Chuck Baird

"I wish I were dumber so I could be more certain about my opinions. It looks fun." -- Scott Adams

http://www.cbaird.org

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

Huh? The bootloader cannot change fuse bits at all, and it can only
modify the BLBs (bootloader lock bits).

Anyway, the OP doesn't want to change fuses, he simply wants to turn off
JTAG at run-time, which is a legitimate request, and ought to work the
way the code is written.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

Yeah, I meant lock-bits, I get confused... fuses, lock-bits, bears, oh my.

Smiley

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

My mistake. All the read functionality (lock bits and fuses) and write functionality (lock bits) has been removed in the current version. Nice catch, Jörg - sorry about that.

;       these commands were removed in version 4:
;
;	l 	CR		    write lock bits
;	r		    		read lock bits
;	F		    		read low byte of fuse bits
;	N		    		read high byte of fuse bits
;	Q		    		read extended fuse bits

Chuck Baird

"I wish I were dumber so I could be more certain about my opinions. It looks fun." -- Scott Adams

http://www.cbaird.org