PORTC on ATMEGA644

Hey guys,

I'm having trouble using the Arduino port registers on the ATMEGA644A-AU...but only for Port C. I've downloaded the 'arduino-extras.zip' file from avr-programmers.com and am able to program the PCB I designed for this chip. I have a simple code shown below that I'm using for test.

void setup()
{
DDRC = B11111111;
}
void loop()
{
PORTC = B11111111;
delay(100);
PORTC = B00000000;
delay(100);
}

The problem is that only pins 0,1,6, and 7 work on Port C...2,3,4,5 just stay HIGH. I've tried this code on Ports A, B, and D and it works fine. These pins aren't connected to anything at the moment, so I doubt it's a hardware problem.

Is there something that I need to change in the header files for this to work properly on the ATMEGA644? I have the board selected to be the Duino 644. I admit that I'm not much of a programmer, I'm more of a hardware guy.

Any help?

joefosho:
I'm having trouble using the Arduino port registers on the ATMEGA644A-AU...

What are Arduino port registers?

joefosho:
I've downloaded the 'arduino-extras.zip' file from avr-programmers.com ...

So you have downloaded third-party code and it doesn't work.

joefosho:
Is there something that I need to change in the header files for this to work properly on the ATMEGA644?

Sure, many places...

joefosho:
I have the board selected to be the Duino 644.

What is Duino 644?

It will take sometime to add support for the ATmega644 to the Arduino code-base.

@mkwired,
Your comments indicate you have not used a '644/1284, I suggest you leave replies to someone with knowledge of these parts.
And there are quite a few here. Best to monitor this thread, you will learn some good information re: 40 pins parts with 2 hardware serial ports/32 IO lines.

Moderator

I'm eager to learn. :slight_smile:

Check the datasheet vs. your fuse settings. This looks as if you have JTAG enabled but you want to have it disabled. I once had this issue. It can drive you mad until you realize that this is just a configuration issue.

@joefosho
You will need to follow the set up here

and copy the 1284p sections into new 644/644p sections
and make signature adjustments as needed.

Thanks for the responses everyone.

Again, I'm quite new to software so please excuse me if my questions aren't phrased properly/sound elementary.

I didn't get a chance to work on it this weekend, but I'm almost convinced that I'm using the wrong processor for the 'Duino-644' board setup. The ATMEGA644 and ATMEGA644A may not be compatible? I've ordered some ATMEGA644's and they are on their way.

The fuse settings that I was using are DEFINITELY wrong... I'm using and AVRISP MKII to program using the .hex file that the Arduino software creates. I was leaving the fuse settings in their default settings and that might be what's causing me these problems.

I'll have some more time to work on this in the next few days, and hope to be back here with some good news.

Thanks again for the tips.

Check atmel.com for the datasheet for the particular part you are using.
Signature bytes are different from part to part:
644 vs 644A vs 644AP vs 644P

http://www.atmel.com/products/microcontrollers/avr/default.aspx?tab=documents&Asset_Type=010 Datasheet

OK...it was the fuse settings.

The JTAG interface is on pins C2, C3, C4, and C5, which is why those pins on the port weren't working. The default fuse settings had JTAG enabled. When I fixed those settings, it worked like a charm EVEN with the ATMEGA644A processor.

Thank you Udo Klein and Crossroads for your help. This was driving me insane.

Cool - will make sure I keep an eye on that when downloading bootloaders.