Pages: 1 2 3 [4]   Go Down
Author Topic: atmega1284 programming from a 328 chip  (Read 4135 times)
0 Members and 1 Guest are viewing this topic.
Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17259
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well I would like to report a successful 1284P installation, so I will.  smiley-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-grin

Lefty
« Last Edit: January 29, 2013, 06:19:28 pm by retrolefty » Logged

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

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

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 158
Posts: 2879
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

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

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
Logged

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

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

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

Logged

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 158
Posts: 2879
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Rapa Nui
Offline Offline
Edison Member
*
Karma: 60
Posts: 2061
Pukao hats cleaning services
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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


* serres.jpg (58.91 KB, 674x614 - viewed 20 times.)

* serrespullup.jpg (71.77 KB, 693x583 - viewed 21 times.)

* serres10k.jpg (61.54 KB, 583x574 - viewed 16 times.)

* sernorm.jpg (41.76 KB, 676x582 - viewed 18 times.)
« Last Edit: January 30, 2013, 03:05:42 pm by pito » Logged

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 158
Posts: 2879
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: January 30, 2013, 03:24:57 pm by oric_dan » Logged

Rapa Nui
Offline Offline
Edison Member
*
Karma: 60
Posts: 2061
Pukao hats cleaning services
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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


* serres1.jpg (48.83 KB, 675x606 - viewed 17 times.)
Logged

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 158
Posts: 2879
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

Must admit all that with the graphs went over my head smiley

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)

Code:
/*
 *
 * 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 smiley-sad

Any suggestions ?

Malcolm
Logged

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

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

Pages: 1 2 3 [4]   Go Up
Jump to: