1
\$\begingroup\$

I’ve an issue with my ATmega32A in some of PORTC pins.

I’m trying to control some LEDs using MCU but I faced an issue with PINC2,3,4,5 as shown in picture bellow.

Off state (LED num 3,4,5,6 from the bottom):
enter image description here

On state:
enter image description here

My code:
enter image description here

And here is my schematic:
enter image description here

enter image description here

I measured the output voltage in those pins using voltmeter.

With LEDs connected:

  • On state: 2.6 V
  • Off state: 2.9 V

Without the LEDs:

  • On state: 4 V
  • Off state: 5 V

Only one pin PINC4:

  • With LEDs connected: 1 V
  • Without the LEDs: 2 V

I don’t know what’s going on. Can anyone explain what’s happening?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

By default, on these pins on PORTC the JTAG interface is enabled. So, to get access to PORTC you need to disable the JTAG interface by setting the Fuse High Byte to 0xD9.

How can I disable the jtag in atmega 32 using serial programmer?

Or try to use this code to disable JTAG in your software:

/*disable JTAG*/
MCUCSR |= (1 << JTD); 
MCUCSR |= (1 << JTD);

Reference: ATmega32A Data Sheet enter image description here

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.