Pages: [1] 2   Go Down
Author Topic: Basic 664p/1284p board  (Read 1828 times)
0 Members and 1 Guest are viewing this topic.
UK
Offline Offline
Sr. Member
****
Karma: 7
Posts: 436
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Right I DID get the 1284p up and running but other than flashing the LED I have had a few issues.  On day 1 I had followed some instructions and was using the reset prior to uploading a sketch and it worked.  I then went to bed and forgot and the reset button spending 2 days trying to get it to work again.  The current position is as follows.....

The chip (either 664p or 1284p) programs via ICSP (AVR studio v5 & AVR ISP Mk2) perfectly every time.

Arduino IDE will upload a TINY sketch 3 out of 5 times using either an FTDI cable or using RX/TX off a 328p board

The 664p/1284p will barely run the sketch ie in a tiny sketch it communicates with the IDE via serial.

The 664p/1284p can set a few pins high or low but then nothing seems to happen.....


So basically the boot loader appears to work ok.  The LED flashes to show the bootloader is working.

The program appears to run.


When programming the 664p/1284p via the IDE I get some issues.

When uploading THIS program :

Code:

void setup()   {

 Serial.begin(9600);
 Serial.println("setup");
}


void loop()
{


 PORTB |= B01010101;
 Serial.println("Port B = B01010101");
 delay(500);

 PORTB |= B10101010;
 Serial.println("Port B = B10101010");
 delay(500);

}

The 664p/1284p communicates and prints the "Port A = B01010101" message followed by "Port A = B01010101" over and over BUT the port values DO NOT CHANGE!

This is the stream from AVRDUDE when it is programmed: http://www.cowasaki.co.uk/Arduino/AVRDUDE1.txt



Right now IF I increase the program even slightly this is what happens:  http://www.cowasaki.co.uk/Arduino/AVRDUDE2.txt

AVRDUDE fails with an error saying that it can no longer communicate with the programmer ie:

avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding

and it always fails at the same location or similar.......

I have been speaking with Jim 'Skywalker' and we both feel that there may be a hardware issue so this is the schematic:



Can anyone see any issues with the schematic (I have purposefully done the schematic in a literal manner with every wire and component shown as is.  This is to highlight any problems!

Thank you to anyone who may help.

Once it is working I will update the thread I started and create a batch file to update the IDE on the Mac and Windows (if anyone can help me with the Linux version then thanks)
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16490
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Why are you using a or operator in PORTB |= B01010101; ?

Why not use just PORTB = B01010101;
and PORTB = B10101010;

Also did you forget to set the port pins to output pins? They are input pins by default.
?

Logged

UK
Offline Offline
Sr. Member
****
Karma: 7
Posts: 436
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Why are you using a or operator in PORTB |= B01010101; ?

Why not use just PORTB = B01010101;
and PORTB = B10101010;

Also did you forget to set the port pins to output pins? They are input pins by default.
?



DOH!

I have never used the PORTA/PORTB thing before and just copied a line from another program.  I was trying to get the sketch as short as possible due to the fault.

OK thanks muchly for your help, I will change the program to:

Code:
Serial.begin(9600);
 Serial.println("setup");
  DDRB = B11111111;
}


void loop()
{


 PORTB |= B01010101;
 Serial.println("Port B = B01010101");
 delay(500);

 PORTB |= B10101010;
 Serial.println("Port B = B10101010");
 delay(500);

}
« Last Edit: June 30, 2011, 05:41:28 pm by cowasaki » Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16490
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
OK thanks muchly for your help, I will change the program to:

I don't see a difference? And still no command to the DDRB register to set the pins to output mode?

Put this in your setup function:
DDRB = B11111111;  // sets all 8 bits to output pins

Lefty
Logged

UK
Offline Offline
Sr. Member
****
Karma: 7
Posts: 436
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Woo hoo smiley

The program runs and it changes the ports flashing the LEDs. (if you look at the diagram above I have PORT B connected the a bank of  LEDs like the LED 13)

Just have the issue of up-loading sketched bigger than a few hundred bytes now.
Logged

UK
Offline Offline
Sr. Member
****
Karma: 7
Posts: 436
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
OK thanks muchly for your help, I will change the program to:

I don't see a difference? And still no command to the DDRB register to set the pins to output mode?

Put this in your setup function:
DDRB = B11111111;  // sets all 8 bits to output pins

Lefty


Sorry I mis-copied the sketch to the post.  I had changed it as per your second post smiley
Logged

UK
Offline Offline
Sr. Member
****
Karma: 7
Posts: 436
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Right the above sketch works but:
Code:
void setup()   {       
 
  Serial.begin(9600);
  Serial.println("setup");
  DDRA = B11111111;
  DDRB = B11111111;
  DDRC = B11111111;
  DDRD = B11111111;

}


void loop()                     
{
 
 
  PORTA = B01010101;
  Serial.println("Port A = B01010101");
  PORTB = B01010101;
  Serial.println("Port B = B01010101");
  PORTC = B11111111;
  Serial.println("Port C = B11111111");
  PORTD = B00000000;
  Serial.println("Port D = B00000000");
  delay(500);

  PORTA = B10101010;
  Serial.println("Port A = B10101010");
  PORTB = B10101010;
  Serial.println("Port B = B10101010");
  PORTC = B00000000;
  Serial.println("Port C = B00000000");
  PORTD = B11111111;
  Serial.println("Port D = B11111111");
  delay(500);


}

The above slightly larger one fails every time with the errors as per http://www.cowasaki.co.uk/Arduino/AVRDUDE3.txt
Logged

Smithfield, Rhode Island
Offline Offline
God Member
*****
Karma: 2
Posts: 843
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have been speaking with Jim 'Skywalker' and we both feel that there may be a hardware issue so this is the schematic:


Skywalker is that Luke guy, I prefer to fall through the sky ;-)

Actually, if you're doing this with the Arduino cores, why use the port macros at all? Use digitalwrite and such.

Probably best to get the code - even sample or test code - working on a known good Arduino first then upload it to this breadboard device.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 436
Posts: 23648
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

Hey skyjumper/walker/skipper/hopper smiley-cool,
Got acks from digikey, mouser, dipmicro that parts are shipping.
Got message from itead with status all in Chinese with a bottom date showing 7/1, so whatever that may mean.

Guess I need to follow up with Ryan on a stencil order...
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.

Smithfield, Rhode Island
Offline Offline
God Member
*****
Karma: 2
Posts: 843
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah he still has not replied to my last note (about the stencil) so I sent him another tonight.

Maybe your parts will come addressed in Chinese as well ;-) I got most of mine in, still waiting for boards and switches. Boards have shipped - from China!


Logged

Leighton Buzzard, UK
Offline Offline
Edison Member
*
Karma: 20
Posts: 1318
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

1. i know nothing about these things having never used AVRdude
2. if it manages a small program, but not a large, i wonder if the baud rate for communication is either slightly out or drifting?

not sure what you can do about it, though
is the comms rate fixed for upload?

does the 1284 reset or just sit there glaring at you?

have you tried adding the diode to the reset line to prevent it going above 5 volts?
there was a thread about UNO rev2 regression - long discussion there
Logged

there are only 10 types of people
them that understands binary
and them that doesn't

UK
Offline Offline
Sr. Member
****
Karma: 7
Posts: 436
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have been speaking with Jim 'Skywalker' and we both feel that there may be a hardware issue so this is the schematic:


Skywalker is that Luke guy, I prefer to fall through the sky ;-)

Actually, if you're doing this with the Arduino cores, why use the port macros at all? Use digitalwrite and such.

Probably best to get the code - even sample or test code - working on a known good Arduino first then upload it to this breadboard device.

Sorry Jim, brain was elsewhere! (I have a mental block with names and I've got used to talking to you with your real name!)

I didn't test it because it was a single line that I assumed was right.  I now know it wasn't but the replacement code works on the 1284p and can be seen to work with the leds flashing on and off alternatively.

So the only issue at he moment is the uploading larger sketches.

The scope gives 15.99MHz for the pulse at the 1284p so timing there should be ok - I assume.

The core is the core you gave me for 16MHz and I am uploading at 38400 as per conv.

It does the same using either an arduino duemilanove board with it's RX/TX,5V&GND pins + reset OR a FDTI cable.


Just unpacking a delivery of all the kit to start SMT work then got to go to work so will have a mess with this tomorrow.


Once again thanks for all your help and that of everyone else, it is appreciated.
Logged

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

What device are you using to upload the sketches on the FTDI port?

I am using the BUB board from Moderndevice and it already has the capacitor on the reset line so I removed the capacitor, C3 shown on your schematic and uploads smoothed out for me.

I am also uploading at 115200 too with no issues.

Mnmis
Logged

UK
Offline Offline
Sr. Member
****
Karma: 7
Posts: 436
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

BLIMEY!!

I was a little unhappy with the naff looking trace when I looked at the output from the crystal oscillator so yesterday I ordered a pack of 5 16MHz ceramic oscillators off fleabay anyway.  I just pulled out the caps and crystal and stuck the oscillator in and hey presto.  The larger sketch just uploaded FIRST time with no issues whatsoever.......

I don't have enough time to do much more with it now but it would appear that it was the crystal oscillator part of the circuit causing the problems.  This is strange because I have tried SEVERAL oscillators and several pairs of caps including slightly smaller and slighter larger ones.

Just doubled the length of the sketch again so and hit upload - no problems whatsoever it uploaded and is still working.......

I am very happy now  smiley  smiley

And I really do appreciate everyones help !!
Logged

UK
Offline Offline
Sr. Member
****
Karma: 7
Posts: 436
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What device are you using to upload the sketches on the FTDI port?

I am using the BUB board from Moderndevice and it already has the capacitor on the reset line so I removed the capacitor, C3 shown on your schematic and uploads smoothed out for me.

I am also uploading at 115200 too with no issues.

Mnmis

I was originally using a duemilanove board minus it's 328p chip then I bought a FTDI lead (it just looks like a normal USB lead but the USB plus is clear and the electronics for the FTDI are inside it - very nice).

I did try removing the cap C3 but it didn't work at all when I did.

The upload speed of 38400 is a product of Mr Skyjumpers core for the 1284p, it is fixed.

Thank you for your ideas.  As you can see from the above post it all appears to be down to the oscillator!!
Logged

Pages: [1] 2   Go Up
Jump to: