Sanguino 644 problems

I have just bootloaded a 644 ( not 644P) with Sanguino

I made the changes below to get it to run at 8mhz (and 8mhz crystal) and removed the P's after the 644's

##############################################################

sanguino.name=Sanguino
sanguino.upload.protocol=stk500
sanguino.upload.maximum_size=63488
sanguino.upload.speed=19200
sanguino.bootloader.low_fuses=0xFF
sanguino.bootloader.high_fuses=0xDC
sanguino.bootloader.extended_fuses=0xFD
sanguino.bootloader.path=atmega644p
sanguino.bootloader.file=ATmegaBOOT_644.hex
sanguino.bootloader.unlock_bits=0x3F
sanguino.bootloader.lock_bits=0x0F
sanguino.build.mcu=atmega644
sanguino.build.f_cpu=8000000L
sanguino.build.core=arduino

I then uploaded my project sketch after making the pin changes as it was running on a Mini Pro.
Strangely it takes about 8 seconds before the sketch starts. When it does it all run correctly including timing except for one out of 6 LED's which is on pin D0.
I checked the hardware and its correct. If I short out the pin the LED is connected to with an adjacent LED pin then both LED's flash so this confirms its not the LED or its resistor.

I tried another 644 thinking I may have damaged it. Same thing.
I wrote another simpler sketch as shown below. Its pretty much a cut and paste of parts of the original.
pwm drives a transistor that connects to all LEDs Cathodes to allow for dimming.

int ledoner = 0;      // select the pins for LED one
int ledoneg = 1;  
int ledtwor = 2;     // select the pins for LED two
int pwm=3;
int button = 4;    //button pin 1
int ledtwog = 5;  
int ledthreer = 6;   // select the pins for LED three
int ledthreeg = 7;  


void setup() {
  // put your setup code here, to run once:

}
  
  
  
  void loop(){
    
    digitalWrite(pwm,HIGH); 
    digitalWrite(ledoneg,HIGH);      digitalWrite(ledtwog,HIGH);      digitalWrite(ledthreeg,HIGH);      delay (1000);//green
    digitalWrite(ledoner,HIGH);      digitalWrite(ledtwor,HIGH);      digitalWrite(ledthreer,HIGH);      delay (1000);// orange
    digitalWrite(ledoneg,LOW);      digitalWrite(ledtwog,LOW);      digitalWrite(ledthreeg,LOW);      delay (1000);//red
  }

I get the same 8 second delay before the sketch starts. When it does only the LED on pin D0 works which is the opposite of what was happening with the original sketch problem.

I am at a loss as to what is going on. Any suggestions?

I am at a loss as to what is going on. Any suggestions?

It's not enough just to modify the boards.txt file to get the IDE to function correctly for a 644 chip. There are many built in Arduino core libraries that are not setup to handle the 644 chip unless you replace or modify them.

Lefty

Oh, I was under the impression that Sanguino was (mostly) compatible with Arduino. Thats what is says here http://sanguino.cc/useit

I think you need the 644 cores from here avr-developers.com to work with arduino-0022.

Ooh, check this thread out too:

CrossRoads:
I think you need the 644 cores from here avr-developers.com to work with arduino-0022.

I tried that earlier.
When I tried burn bootloader with the Duino 644 I got the following error. The Duino 644 is the only 644 one in there.

avrdude: can't open input file C:\Users\Greg\Desktop\aduino\arduino-0022\hardware\arduino-extras\bootloaders\atmega\atmega644: No such file or directory
avrdude: write to file 'C:\Users\Greg\Desktop\aduino\arduino-0022\hardware\arduino-extras\bootloaders\atmega\atmega644' failed

The rest of the original sketch seems to work fine. This includes 3 Analogue inputs and a digital input with a button on it. It just will not work the D0 pin.

UPDATE.

OK I got the second sketch ( listed above) going correctly by adding

pinMode(ledoneg, OUTPUT);
pinMode(ledoner, OUTPUT);
pinMode(ledtwog, OUTPUT);
pinMode(ledtwor, OUTPUT);
pinMode(ledthreeg, OUTPUT);
pinMode(ledthreer, OUTPUT);

Ooops! Silly mistake I guess. :blush:
But my original sketch still will not activate pin D0 even though that sketch has always set pin D0 as an output in the setup.

But why did pin D0 work before it was set as an output while the rest of the pins didnt? Is there something different about D0 than the rest?

And why does pin D0 not work in my original sketch? while the rest do?

A bit more banging my head against the brick wall and I am sure it will give way! :smiley:

BANG!!!
There goes the wall!!!

In the end it was all in my code ( of course).

int LDR=0;
pinMode(LDR, INPUT);

LDR is supposed to be an analogue pin. Before it was A0 but when I tried compiling it for the Sanguino it didnt like the "A" so it became 0 instead of A0.
As it was it was a redundant line of code since I guess you dont have to define an analogue pin as an input ( I think). This was not an issue when it was A0 but when it became 0 it changed D0 to an input not an output.

Thanks all for your replies guys.

Glad you got it working. Code can be aggravating at times!