fredericplante / sanguino

Automatically exported from code.google.com/p/sanguino
0 stars 0 forks source link

Enabled JTAG in hfuse is preventing the endstop detection for reprap with Marlin to work properly #32

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Uploading bootloader for 644/1284 with Arduino IDE using the provided 
boards.txt.

What is the expected output? What do you see instead?
I have an Sanguino based Reprap running Marlin firmware. With earlier version 
of Sanguino boards file the JTAG was disabeled and the endstops worked 
properly. 

Please provide any additional information below.
Disabling JTAG in boards.txt i.e. change 0x9A back to 0xDA solves the issue.

Original issue reported on code.google.com by einkauf.cn on 10 Nov 2012 at 9:21

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I was having a problem disabling JTAG on my atmega644p. I tried the above by 
changing JTAG to 0xDA but that didn't work. So I used the following code 
"MCUCR|= (1<<JTD); MCUCR|= (1<<JTD);" it needs to be written twice for it to 
work according to the data sheet. Include the code inside the void setup() 
section and it worked :) Only down side though it needs to be included in every 
sketch :(

According to Atmega644p datasheet page 275. The MCU Control Register contains 
control bits for general MCU functions. Bits 7 – JTD: JTAG Interface Disable.
When this bit is zero, the JTAG interface is enabled if the JTAGEN Fuse is 
programmed. If this bit is one, the JTAG interface is disabled. In order to 
avoid unintentional disabling or enabling of the JTAG interface, a timed 
sequence must be followed when changing this bit: The application software must 
write this bit to the desired value twice within four cycles to change its 
value. Note that this bit must not be altered when using the On-chip Debug 
system.

Original comment by yassirsh...@gmail.com on 26 Feb 2013 at 7:41