atmega1284 programming from a 328 chip

I extracted the Arduino IDE to a folder on my desktop. In the path C:\Users\admin\Desktop\arduino-1.0.3-windows\arduino-1.0.3\hardware\maniacbug-mighty-1284p-68ed99c I have a boards.txt file and within it there is the following section

BTW, I don't know if this matters, but I believe maniacbug said to locate the 1284 bootloader
files in the Arduino "sketch" directory, not the Arduino IDE directory, which is what the above
seems to indicate [maybe].

Quote
I have tried selecting the bobuino from the dropdown list of boards in the IDE and still get the same error.

The chip is breadborded on a solderless breadbord, with just supply pins connected, 16mhz xtal and RX / TX lines from the working FDI board and a 10K resistor between RESET and +ve - The power is supplied from the +5v USB feed from the FDI board (in the same way the 328P is powered). I have the DTR line connected to the RESET pin via a series 0.1uf capacitor. I've also tried taking the VREF pin to +5v too.

I've tried using the trick with a series resistor inline with the TX/RX lines. Baud set to 115200, 8bit, no parity, and 1 stop bit (although all other baud rates have been tried)

There has been a great deal of discussion of the connections and the code.. But, No mention of any bypassing.. The 100 nF caps on Vcc and AVcc are NOT optional.

Bob
(Edit for clarity. RKJ}

Always count on d_e to remember bypassing, :-). I never liked using those silly whiteboards
for prototyping.

Guys, thanks again for the support.

I have one question as I'm getting a little confused. Can someone draft up a simple schematic on how I should hook this up, with the mention of 100pf caps in AVcc etc, low pass filters on the TX and or RX lines... etc.

I'll also try moving the files to different folders as suggested.

I'll also order up the components to assemble Roberts PCB to see if the issue is with the breadboard... but that might be a while as funds are limited at the moment.

For what they are... basically modeling a small circuit at low speeds and low power < 1W they are useful however until one really learns the limitations, High interconnection (pin to pin) capacity. Noisy, Dirty and intermittent connections (I recommend a marine lubricant called LPS) and relatively high supply rail resistance > 1 ohm...
Keeping that in mind, When a circuit works put it in place on a proto shield, re test it carefully to verify that the breadboard values are the real values and go on to the next part. Breadboards aren't meant for permanent and complete projects, they are a medium for Modeling a limited subset of electronics with the understanding that the results may be dependent on values used to compensate for the effects of the breadboard. This includes but is not limited to High Speed anything. Breadboards become real 'unusual' at speeds above 50 MHz. Low Noise anything. dealing with millivolt levels on a breadboard is problematical from several standpoints. High Voltage anything. Any voltage greater than 25 V should be avoided or put on a separate breadboard with HV isolation and finally RF anything including antenna connections, Especially antenna connections.
Finally, LCD backlight currents are really too big for connection to a power rail except at the same place the power does. This helps to avoid the voltage drops caused by the backlight current.
I need to repeat that again because of the structure and properties of a breadboard, twice as many bypasses as would be required on a finished PCB type of construction and this includes soldered proto boards too might not be enough. It's easy and virtually free to put down the footprints in the final PCB design, A little testing will tell you which ones are needed and which are optional.

Bob
{Edit: Funny thing wuz that it all made sense... when I wrote it. RKJ

The 2 minimum bypasses are 100nF, .1 uF capacitors one from Vcc to ground and one from AVcc to ground close to the chip which at least on the 28 pin devices are across from each other so a 100nF/.1uF cap across pins 7 and 8 (Vcc) and 20 and 22 (AVcc). Adding a 10 to 22 uF cap couldn't hurt... Unless you put it in backwards... Messy and stinky, that.

Bob

I'll also order up the components to assemble Roberts PCB to see if the issue is with the breadboard... but that might be a while as funds are limited at the moment.

I should think you'd have enough components from your protoboard ckt of reply #15 to wire
the Crossroads pcb for minimal testing. At least you know the wiring is straight.

And yeah, the 100pF I mentioned was for the RX0 low-pass filter, 100nF is for bypassing Vcc.

Well I would like to report a successful 1284P installation, so I will. :wink:

I'm using CrossRoads great through-hole Bobuino board and so far no signs of serial uploading problem using a 68K big sketch on repeated tries, no errors reported or seen.

So I would like to thank CrossRoads for designing, building, and selling a great blank PCB that will support 644P and 1284P chips, and a big hand to Nick's great bootloader program that kept me from having to purchase a more capable hardware programmer then the USBtiny that I do have.

So my Arduino (well one of them anyway) now has 16K of SRAM, how large is yours? :smiley:

Lefty

Well if it's good enough for Lefty.... I'll build the PCB tomorrow and report back.

So lefty, what is the data code on your chips? The 1284Ps I got last week are 1247.

oric_dan:
So lefty, what is the data code on your chips? The 1284Ps I got last week are 1247.

Forgot all about datacode thing. Just checked and it's a 1247 also, so either 47th week or 47th batch of 2012, sounds like a fresh one to me.

Which remind me that starting Friday for 3 days our Local Lucky grocery store is having a sale of fresh (not previously frozen) Dungeness crab for $3.99 a pound. Quite a reduction if price as it's been pretty high this year.

Lefty

OK we have a result.... it programs with no errors

I followed the notes on this site (http://www.gammon.com.au/forum/?id=11637 I breadboarded both chips and having confirmed the 328P was working, hooked up the ICP pins between both chips. Loaded his sketch that interrogated the 1284p and the serial monitor reported details as described, so that proved the 1284p was running. I then sent the command to upload the optiboot loader which again came back as successful. I continued down the page and downloaded the files from Maniacbug's site again and copied them to the hardware folder, confirming the operation to overwrite the existing files.

Removed the ICP wires and connected the RX and TX lines, with the DTR to reset via the 0.1uf capacitor. I also found and placed a 220K resistor in series with the TX line from the FTDI board (had previously tried this with the same sync errors before I re-loaded the bootloader). Loaded the BLINK sketch, selected the Mighty 1284p optiboot 16mhz board and clicked on the upload....and waited

The TX and RX leds flickered as they did before... then flickered again as data was transmitted.... I hocked up the LED to pin 19 (D13 in the mappings) and it's flashing away as I type. :slight_smile: :slight_smile:

My only conclusion, and I don't mean this with any disrespect, is that the initial upload of the bootloader either failed, or in some way got corrupted ??

Anyway... I'm a happy bunny now, and can now start work on building my aquarium controller project - Thanks to all those who have commented and offered suggestions

Well, good at last. Breadboarding on both sides is probably not something I would have
wanted to do myself.

FYI - This is how the 115kbaud signal (ie. 0xAA, 0x55 sent) looks like at the 1284p' Rx input when passed via 220kohm serial resistor with 100pF to ground (the "RC filter"). Hard to recommend, though.. The same with 10k pullup on the Rx input. The same with 10kohm serial.. And a picture when connected directly w/o the "RC" filter (FTDI or BT output resistance assumed ~200ohm typically)..

10K series-R with 100 pF to gnd looks like the winner, if wanting to make a reasonable
low-pass filter on RX0.

For reference, you might try the 220K series-R without the 100 pF to gnd, and no pullup.
The first and second waveforms here are useless. The first is basically like smoothing out
a PWM signal to produce a d.c. level, and in the 2nd, the output is too tiny.

Basically I would not recommend to put 220k in series even w/o the cap for such speeds..

Looks about right. Estimated capacitance to gnd, from T.C. = 63% of swing, is approx
C = 2.5usec/220K = 11.5 pF. Spot on. Slow, but much better than with the 100pF on
there.

Must admit all that with the graphs went over my head :slight_smile:

I now have another issue, and would welcome comments.

I've breadboarded the chip neatly, and tested it using the example blink and fade examples - worked fine. I then breadboarded the 1307 RTC chip and uploaded the sample code below (found on this forum)

/*
 *
 * Read and set through serial port demo sketch for DS1307 I2C rtc clock
 *
 * DS1307 library provided by mattt & D.Sjunnesson, corrected by bricofoy.
 * See DS1307.h for more details.
 *
 * This exemple code is under GNU GPL
 *
 * (c) bricofoy 2012
 *
 */



// This is for compatibility with both arduino 1.0 and previous versions
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif

#include <Wire.h>
#include <DS1307.h>

void setup() {
  Serial.begin(9600);
  use();
  read_RTC();
}


// use explanation message
void use() {
  Serial.println("\nUSE      : u U r R h[00-23]m[00-59]s[00-59]j0[1-7]D[01-31]M[01-12]A[00-49]");
  Serial.println("\nEXEMPLE  : h09m35d03 set time to 09h35 and day of week 3 (thuesday).");
  Serial.println("\nCommands : h** : hour,  m** : minutes, s** : seconds, d0* : day of week");
  Serial.println("           M** : month,  Y** : year,   D** : day of month.");
  Serial.println("           r stops clock, R starts it. ");
  Serial.println("           u or U shows this message, all other caracter shows time.");
}

// DS1307 time read function
void read_RTC() {
	  Serial.print("\nActual time : ");
	  Serial.print(RTC.get(DS1307_HR,true)); //read the hour and also update all the values by pushing in true
	  Serial.print(":");
	  Serial.print(RTC.get(DS1307_MIN,false));//read minutes without update (false)
	  Serial.print(":");
	  Serial.print(RTC.get(DS1307_SEC,false));//read seconds
	  Serial.print(" ");                 // some space for a more happy life
	  Serial.print(RTC.get(DS1307_DOW,false));
	  Serial.print(" ");
	  Serial.print(RTC.get(DS1307_DATE,false));//read date
	  Serial.print("/");
	  Serial.print(RTC.get(DS1307_MTH,false));//read month
	  Serial.print("/");
	  Serial.println(RTC.get(DS1307_YR,false)); //read year
}

// set clock values
void write_RTC() {
      char value=0;
      char command=0;

      command = Serial.read();
      delay(50);				//delay to allow good serial port reading
      value=byte((Serial.read()-48)*10); 	//-48 becaus ASCII value for 0 is 48, 1 is 49, etc and *10 because we read tens first
      delay(50);
      value+=byte((Serial.read()-48));		//and then we read units

      switch (command) {
	case 'h' :
	  RTC.set(DS1307_HR,value);
	  Serial.print("hours set to ");
	  Serial.println(value,DEC);
	  break;
	case 'm' :
	  RTC.set(DS1307_MIN,value);
	  Serial.print("minutes set to ");
	  Serial.println(value,DEC);
	  break;
	case 's' :
	  RTC.set(DS1307_SEC,value);
	  Serial.print("seconds set to ");
	  Serial.println(value,DEC);
	  break;
	case 'D' :
	  RTC.set(DS1307_DATE,value);
	  Serial.print("day of month set to ");
	  Serial.println(value,DEC);
	  break;
	case 'd' :
	  RTC.set(DS1307_DOW,value);
	  Serial.print("day of week set to ");
	  Serial.println(value,DEC);
	  break;
	case 'M' :
	  RTC.set(DS1307_MTH,value);
	  Serial.print("month set to ");
	  Serial.println(value,DEC);
	  break;
	case 'Y' :
	  RTC.set(DS1307_YR,value);
	  Serial.print("year set to ");
	  Serial.println(value,DEC);
	  break;
	case 'u' :
	case 'U' :
	  use();
	  break;
	case 'r' :
	  RTC.stop();
	  Serial.println("Clock stopped");
	  break;
	case 'R' :
	  RTC.start();
	  Serial.println("Clock running");
	  break;
	default :
	  break;
      }
      read_RTC();
}

void loop() {
   if (Serial.available()) {
     write_RTC();
    }
}

This is (if I ready the details correctly) will display the date / time via the serial monitor, which is fine as I don't have an LCD hooked up yet. The code compiled and loaded without error, but when I launched the serial monitor I got the message that the port was in use and I needed to close other applications. So I tried uploading the basic blink example and got the same message... it seems that the code running won't free up the com port :frowning:

Any suggestions ?

Malcolm

belay that - re-boot the PC and all is well