Pages: [1]   Go Down
Author Topic: PORTC on ATMEGA644  (Read 938 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

USA
Offline Offline
Full Member
***
Karma: 0
Posts: 235
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

What are Arduino port registers?

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

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

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

Sure, many places...

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.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 437
Posts: 23660
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@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
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

USA
Offline Offline
Full Member
***
Karma: 0
Posts: 235
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm eager to learn. smiley
Logged

0
Offline Offline
Faraday Member
**
Karma: 19
Posts: 3418
20 LEDs are enough
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Check out my experiments http://blog.blinkenlight.net

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 437
Posts: 23660
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@joefosho
You will need to follow the set up here
https://github.com/maniacbug/mighty-1284p
and copy the 1284p sections into new 644/644p sections
and make signature adjustments as needed.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 437
Posts: 23660
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 437
Posts: 23660
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Pages: [1]   Go Up
Jump to: