Show Posts
Pages: [1] 2
1  Using Arduino / Microcontrollers / Re: Unable to locate library files on: February 13, 2013, 04:41:20 am
Thanks Nick.

I've been away from the board for a few days. In desperation to get the project off the ground I've dusted off my EasyPIC5 board and went back to programming in PicBASICpro  smiley-red  I may revert back and give the Arduino another run, but feel (for me with my limited level of programming skills) that hunting for library files, the structure and syntax of the programming language frustrating.
2  Using Arduino / Microcontrollers / Re: Unable to locate library files on: February 11, 2013, 04:55:32 pm
Thanks for the further replies guys.  I had posted the question on the authors blog site, so hopefully I may get a reply as further searching hasn't thrown up anything yet.

@Nick - I don't know about writing a substitute... I'm very much a newbie to this in terms of how the AVR works and the C style language...
3  Using Arduino / Microcontrollers / Re: Unable to locate library files on: February 11, 2013, 06:13:23 am
Hi Nick,

Here's the link to the guys site http://arduino-aquarium.blogspot.co.uk/p/software.html

and here is the hub link https://github.com/RogerReed/Arduino-Aquarium

Hope that helps. 
4  Using Arduino / Microcontrollers / Re: Unable to locate library files on: February 11, 2013, 05:52:47 am
Hi guys, thanks for the input.

I'm aware of how to copy the library files to the library folder and restarting the IDE, what I'm struggling with is locating these library files on the net so I can install them...  I'll try Hugo's suggestion to see if it compiles and runs
5  Using Arduino / Microcontrollers / Unable to locate library files on: February 11, 2013, 05:37:33 am
Hi,

I'm trying to convert from PICs to Arduino and learn by example by downloading code for specific projects and adapting them for use.  EG, my first project is to be an Aquarium controller, but rather than re-invent the wheel, have located a source code in the public domain.  OK some of the components I probably won't use for my controller, but the thing that I find frustrating is that often or not the include files are not linked or contained in the zip files.  I've been googling for the following, and would welcome any pointers as to their location

#include <Arduino.h>
#include <FormatDouble.h>

Trying to compile the code I get a an "fmtDouble was not declaired in this scope" error
6  Using Arduino / Microcontrollers / Re: atmega1284 programming from a 328 chip on: January 31, 2013, 03:43:26 pm
belay that - re-boot the PC and all is well
7  Using Arduino / Microcontrollers / Re: atmega1284 programming from a 328 chip on: January 31, 2013, 03:34:51 pm
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
8  Using Arduino / Microcontrollers / Re: atmega1284 programming from a 328 chip on: January 30, 2013, 08:40:06 am
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

9  Using Arduino / Microcontrollers / Re: atmega1284 programming from a 328 chip on: January 29, 2013, 05:45:54 pm
Well if it's good enough for Lefty.... I'll build the PCB tomorrow and report back.
10  Using Arduino / Microcontrollers / Re: atmega1284 programming from a 328 chip on: January 29, 2013, 03:20:08 pm
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.
11  Using Arduino / Microcontrollers / Re: atmega1284 programming from a 328 chip on: January 29, 2013, 05:17:46 am
Hi Robert, yes it is the supplied 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

Code:


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

bobuino.name=Bobuino
bobuino.upload.protocol=arduino
bobuino.upload.maximum_size=130048
bobuino.upload.speed=115200
bobuino.bootloader.low_fuses=0xff
bobuino.bootloader.high_fuses=0xde
bobuino.bootloader.extended_fuses=0xfd
bobuino.bootloader.path=optiboot
bobuino.bootloader.file=optiboot_atmega1284p.hex
bobuino.bootloader.unlock_bits=0x3F
bobuino.bootloader.lock_bits=0x0F
bobuino.build.mcu=atmega1284p
bobuino.build.f_cpu=16000000L
#bobuino.build.core=arduino:arduino
bobuino.build.core=standard
bobuino.build.variant=bobuino

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


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)
12  Using Arduino / Microcontrollers / Re: atmega1284 programming from a 328 chip on: January 28, 2013, 06:11:51 pm
After reading back through this thread, it appears you never burned the bootloader into the 1284P
chip yourself, but have been assuming the chip you bought has a proper bootloader burned into it.
However, given the nature of ebay, that may be a bad assumption - given comments by others
who've bought things on ebay.

So, maybe you should just try starting over and burning the bootloader yourself, using a regular
Arduino in ArduinoISP mode.

Alternatively, scrub this mission, and just buy a 1284 board from Crossroads.



Thanks for the comments - but the 1284p was purchased from Crossroads, with a request to have the bootloader installed.  I have also purchased one of his unpopulated PCB's but not had a chance to build it due to a few component shortages in my hobby box.  This was why I've breadboarded the 1284P.

The 328P purchased from e-bay works fine ;-)
13  Using Arduino / Microcontrollers / Re: atmega1284 programming from a 328 chip on: January 28, 2013, 05:29:29 pm
Leo, thanks for the reply... I don't have any 220K, but tried with 100K and still no joy.  I've looked through that thread and noted some comments of the baud rate, so checked the boards.txt file and noted that it stated 115200, so I tried this and again got the same sync error.   I know the FTI board is working fine as I can program the 328P with no issue (no serial resistors required, and even with the port set to this fast speed).

I'm finding all this very frustrating. Programming PICs using PicBASIC now seem a lot easier compared to using larger processors other than the original arduino based 328P.  I used to wonder why so many projects on the web had "shields" stacked one on top of another and then the lot placed into a box rather than the traditional breadboard and then dedicated PCB (be that stripboard or printed) approach.  Having spend all this time fuffing about with the 1284P I can now see why !

One last question... having got the 328P running on the breadboard, is it possible to use that to program the 1284p via ISC using MOSI / MISO / SCK pins or do I need a dedicated programmer for that ?

Cheers

Malcolm
14  Using Arduino / Microcontrollers / Re: atmega1284 programming from a 328 chip on: January 28, 2013, 04:13:47 am
Thanks for the replies.

I too have no idea what is happening.  When the 328P is breadboarded, with DTR connected to  the reset via a 0.1uF capacitor in series and a 10K pull up resistor I can select the Uno as the board in the IDE and it uploads many of the example sketches.  With the 1284P chip breadboarded in the same way it fails with the errors shown.

I made the following observation:
When a successful upload on the 328P is achieved, the TX and RX leds on the FTI board initially flash a few times, pause and then flash for a longer period.  It's as if the software is initially checking for the chip, the chip identifies itself and agrees to accept the code, which is then transmitted.  When breadboarding the 1284P I get the initial flashes on the TX / RX leds on the FTI, but then the IDE pauses before the time out results in the errors. 

I'm no expert, but it seems to me as if the bootloader is communicating correctly.  I've tried different baud rates, but with the normal standard port settings.. I assume the optiboot loader uses the standard serial protocols ?

 
15  Using Arduino / Microcontrollers / Re: atmega1284 programming from a 328 chip on: January 27, 2013, 04:58:19 pm
Bit more googling and it seems to be due to resetting too soon.  I found this regarding the error - OK it's related to programing the 328... but my guess it the same thing happening with the 1284P

Quote
Having investigated this a bit, it seems that the problem is because the Optiboot loader resets the ATMega328 when the serial port is opened. When avrdude is started up to program the slave chip it firsts opens the serial port then tries immediately to write to it. The initial comms fail because the chip has reset and, whilst in the bootloader, isn’t actually responding to the STK500 protocol.

Just need to find a way of resolving it
Pages: [1] 2