JTAG disable problem

Hallo people, sry for my bad english :confused:

I have a problem to program a ATmega32 over the Arduino-IDE.

[u]Which works:[/u] I use a Arduino Uno as ISP to program a ATmega32 (ext. 8Mhz). I can load a program on the ATmega32 that a LED blink on D31. That's works fine:

void setup(){  
   pinMode(31, OUTPUT);

void loop() {
  digitalWrite(31, HIGH);
  digitalWrite(31, LOW);

[u]My problem:[/u] Now i will use the output register C. This are the data pins D16-D23. What i become: - D16 - work fine - D17 - work fine - D18 (TCK) - LED shines continues with half power - D19 (TMS) - LED shines continues with half power - D20 (TDO) - LED shines no time - D21 (TDI) - LED shines continues with half power - D22 - work fine - D23 - work fine I think that it is a problem with the JTAG, because all 4 pins are for this. I have look in the datasheet and I have see that the 7. bit of the "Fuse High Byte" are for this. But I think this is correct in my boards.txt:


Have someone I idea where can come my problem? Thank you.

Sorry I can't understand the rest of your problem. Post the code that does not work not the code that works.

I program a separate ATmega32 over the Arduino IDE.
The program:

void setup()
   pinMode(15, OUTPUT);
   pinMode(20, OUTPUT);

void loop() {
  digitalWrite(15, HIGH);
  digitalWrite(20, HIGH);
  digitalWrite(15, LOW);
  digitalWrite(20, LOW);

The LED at output 15 blink. The LED at output 20 not.
I can change the LED’s and the same. I have change the IC and the same. So it is no hardware problem. The ATMega32 will give no signal out at output 20.

Is there a pin mapping for pin 20 for this processor in the Arduino IDE? A quick look and I couldn't see one. Have you tried direct port mapping?

I hope you mean this: I use this file (attachment).

I have now try direct port mapping:

DDRC = DDRC | B00010000;
PORTC = PORTC | B00010000;
PORTC = PORTC & B00010000;

It’s doesn’t work.

I have see: Even I load a new program on the ATmega32, a signal come out of D18 D19 D21. I think it is something from the JTAG, because all pins which doesn’t work correct, is from it.

mega32_pins_arduino.h (4.39 KB)

I have found the solution. It was the JTAG.
to disable it, i must write this line -two- times into the setup. A have try only one time …

MCUCSR|= (1<<JTD);
MCUCSR|= (1<<JTD);