Arduino Forum

Using Arduino => Microcontrollers => Topic started by: MaxiKing on Aug 18, 2012, 03:07 pm

Title: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: MaxiKing on Aug 18, 2012, 03:07 pm
Hello there,
I've bought an ATmega1284p, set it up on a breadboard(Maniacbug's Mighty 1284p setup) and successfully programmed Optiboot into it, using ArduinoISP. As my Uno(the first version, not R2 nor R3) is the only device with USB-TTL serial I have, I tried to use it to upload sketches to the 1284p. I tried to remove the ATmega328p from Uno and then connecting Rx, Tx, and Reset to 1284p - it didn't work. I also tried it without removing the ATmega328p, but connecting Uno's reset to GND and manually resetting the 1284p - no success. I always get a message from avrdude that the programmer is not responding(not out of sync). When I reset the 1284p, a LED connected to pin 1 blinks, so the bootloader is there. Original Mighty 1284p bootloader doesn't want to work either. I also tried to upload sketches via ArduinoISP, without bootloader, and it works fine. Even sketches using hardware Serial work fine, using Arduino Uno as USB-TTL serial. I'm using Arduino IDE 1.0.1 on Debian Wheezy amd64.
I'm not sure if this is issue of Arduino Uno(and buying a FTDI cable would help) or the ATmega1284p. Has anybody ever tried to use Arduino Uno with Mega8u2 to upload sketches to standalone ATmega or Arduino without USB?

PS Sorry for mistakes in language, if any. English is not my native language.
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: Tom Carpenter on Aug 18, 2012, 03:16 pm
Remove the ATMega328p. Connect TX from the arduino to TX of the ATmega1284, and RX from the arduino to RX of Atmega1284. Then connect the reset pins together.

There is no reason why this shouldn't work, so I am guessing that you got the TX and RX reversed.
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: MaxiKing on Aug 18, 2012, 03:46 pm
I've checked if the Rx and Tx pins are not reversed, and they are OK. I think this is not the problem, because sketch using Serial, uploaded with ArduinoISP, using "Upload with Programmer" works.
Here's an image showing how it's all connected. The switch on the left was used previously to reset the 1284p and in the photo it's unconnected. Three LEDs on the right were connected to Arduino when I was using it as an ISP.
(http://i.imgur.com/oqbFzs.jpg) (http://imgur.com/oqbFz)

When I try to upload sketches using serial, the TX and RX LEDs flash two or three times, and after two-three seconds i get "avrdude: stk500_recv(): programmer is not responding" in Arduino IDE.
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: Tom Carpenter on Aug 18, 2012, 03:53 pm
Could you go to File->Preferences and check the box labeled upload next to "Show Verbose Output during:". Then try uploading again and post what it says.
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: MaxiKing on Aug 18, 2012, 03:56 pm
Here it is:
Code: [Select]
/usr/share/arduino/hardware/tools/avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -v -v -v -v -patmega1284p -carduino -P/dev/ttyACM0 -b115200 -D -Uflash:w:/tmp/build5095698683208589081.tmp/Blink.cpp.hex:i

avrdude: Version 5.11.1, compiled on Oct 18 2011 at 21:41:15
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/usr/share/arduino/hardware/tools/avrdude.conf"
         User configuration file is "/home/szymon/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM0
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
         AVR Part                      : ATMEGA1284P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    10   128    0 no       4096    8      0  9000  9000 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         65    10   256    0 yes    131072  256    512  4500  4500 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00

         Programmer Type : Arduino
         Description     : Arduino
avrdude: Send: A [41] . [80]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: MaxiKing on Aug 18, 2012, 11:01 pm
Well, I've recompiled Optiboot to use 9600 baud rate and burned it into 1284p. I can upload Blink sketch without problems using serial to the 1284p, and it blinks fine, but uploading anything that is bigger is never successful. It stops in random place when uploading and I get that from avrdude:
Code: [Select]
avrdude: Recv: b [62]

avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x62
avrdude: Send: V [56] @ [40] . [00] . [00] . [0c]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: Tom Carpenter on Aug 18, 2012, 11:05 pm
When you compile optiboot with a 16MHz crystal it switches in a software based UART if the BAUD rate is <57600 baud. I found that optiboots software version is not very reliable (works for small programs, but not larger ones), so you may want to compile it for 57600.
Alternatively, if that fails, I can send you my current version of optiboot.c which has a much improved software UART routine (written mainly for the tiny84, but should work with others). That would allow you to run at the lower Baud rate.
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: MaxiKing on Aug 19, 2012, 12:24 am
Well, it couldn't upload even Blink at 57600 baud rate. Could you send the file, please?
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: spcomputing on Aug 19, 2012, 07:19 am
Ah, the "paged_write" fun that nobody else has a problem with ;)

This seems to be an issue when low voltage serial programmers try to put Optiboot on.  You should be able to eventually get "Blink" onto the 1284p, but any larger sketches will fail.

Try bootloading the "Orginal Mighty 1284" onto the chip and then try to upload any sketch on it.  It might fail.

If you bootload/sketch upload this one on the 1284p UART1 (as opposed to UART0) it seems to work well.
http://code.google.com/p/optiboot/downloads/detail?name=optiboot_atmega1284p-u1.hex&can=2&q=
Just replace the "U1" optiboot in the folder of the Mighty1284 Optiboot and burn bootloader.

The history is here: http://arduino.cc/forum/index.php/topic,80483.465.html
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: CrossRoads on Aug 19, 2012, 07:39 am
Have you tried NickGammon's writeup for '1284s?

http://www.gammon.com.au/forum/?id=11637

Go a little past halfway down the page.
Covers installing a bootloader and downloading a sketch.
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: spcomputing on Aug 19, 2012, 07:57 am

Have you tried NickGammon's writeup for '1284s?

http://www.gammon.com.au/forum/?id=11637

Go a little past halfway down the page.
Covers installing a bootloader and downloading a sketch.


Question CrossRoads... Have you tried this Gammon setup with an Uno?
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: CrossRoads on Aug 19, 2012, 08:35 am
I have not. I use Atmel AVR ISP MKii.
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: baselsw on Aug 19, 2012, 09:50 am

Hello there,
I've bought an ATmega1284p, set it up on a breadboard(Maniacbug's Mighty 1284p setup) and successfully programmed Optiboot into it, using ArduinoISP. As my Uno(the first version, not R2 nor R3) is the only device with USB-TTL serial I have, I tried to use it to upload sketches to the 1284p. I tried to remove the ATmega328p from Uno and then connecting Rx, Tx, and Reset to 1284p - it didn't work. I also tried it without removing the ATmega328p, but connecting Uno's reset to GND and manually resetting the 1284p - no success. I always get a message from avrdude that the programmer is not responding(not out of sync). When I reset the 1284p, a LED connected to pin 1 blinks, so the bootloader is there. Original Mighty 1284p bootloader doesn't want to work either. I also tried to upload sketches via ArduinoISP, without bootloader, and it works fine. Even sketches using hardware Serial work fine, using Arduino Uno as USB-TTL serial. I'm using Arduino IDE 1.0.1 on Debian Wheezy amd64.
I'm not sure if this is issue of Arduino Uno(and buying a FTDI cable would help) or the ATmega1284p. Has anybody ever tried to use Arduino Uno with Mega8u2 to upload sketches to standalone ATmega or Arduino without USB?

PS Sorry for mistakes in language, if any. English is not my native language.



I feel like I'm the expert at this type of problem with the 1284p =P!! Try my solution and if it doesn't work i'll try to help you in some other way.

http://arduino.cc/forum/index.php/topic,80483.465.html (http://arduino.cc/forum/index.php/topic,80483.465.html) See Post : #473
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: MaxiKing on Aug 19, 2012, 03:08 pm
The Original Mighty 1284p bootloader doesn't work and Nick Gammon's sketch doesn't want to compile on Arduino IDE 1.0.1.

The UART1 solution seems to work fine with 115200 baud rate. Thanks! But, unfortunately, the UART1 pins are also interrupt pins. But I think I won't need to use more than one in my project.
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: CrossRoads on Aug 19, 2012, 05:33 pm
Quote

Nick Gammon's sketch doesn't want to compile on Arduino IDE 1.0.1.

Did you put all the files into the same folder, Atmega_Board_Programmer?
I did and then opened Atmega_Board_Programmer.ino, compiled just fine.
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: spcomputing on Aug 19, 2012, 06:08 pm

Quote

Nick Gammon's sketch doesn't want to compile on Arduino IDE 1.0.1.

Did you put all the files into the same folder, Atmega_Board_Programmer?
I did and then opened Atmega_Board_Programmer.ino, compiled just fine.


I have used the Atmega Board Programmer and it is nice, and it appears to install the 1284p well enough, but again, uploading a sketch ~25kB fails with the paged_write error.  Blink uploads fine.  I have also tried pulling the hex out of another hex file and putting in, same problem.

The Atmega328 works flawlessly.  The 25kB sketch uploads perfectly.
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: nickgammon on Aug 19, 2012, 10:34 pm

The Original Mighty 1284p bootloader doesn't work and Nick Gammon's sketch doesn't want to compile on Arduino IDE 1.0.1.


Please post your error messages. Possibly you didn't install the SDFat library. There is a comment near the top of the sketch about that:

Code: [Select]

// for SDFat library see: http://code.google.com/p/beta-lib/downloads/list
#include <SdFat.h>
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: nickgammon on Aug 19, 2012, 10:36 pm

I have used the Atmega Board Programmer and it is nice, and it appears to install the 1284p well enough, but again, uploading a sketch ~25kB fails with the paged_write error.  Blink uploads fine.  I have also tried pulling the hex out of another hex file and putting in, same problem.

The Atmega328 works flawlessly.  The 25kB sketch uploads perfectly.


What gives the paged write error? The bootloader? My sketch? Please clarify and post any messages you get.
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: MaxiKing on Aug 19, 2012, 11:01 pm


The Original Mighty 1284p bootloader doesn't work and Nick Gammon's sketch doesn't want to compile on Arduino IDE 1.0.1.


Please post your error messages. Possibly you didn't install the SDFat library. There is a comment near the top of the sketch about that:

Code: [Select]

// for SDFat library see: http://code.google.com/p/beta-lib/downloads/list
#include <SdFat.h>


I have SDFat installed. I didn't try to compile the sd card hex uploader, but Atmega_Board_Programmer and here are the error messages:
Code: [Select]
In file included from Atmega_Board_Programmer.cpp:121:0:
bootloader_atmega168.h:3:34: error: variable 'atmega168_optiboot' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
In file included from Atmega_Board_Programmer.cpp:122:0:
bootloader_atmega328.h:3:34: error: variable 'atmega328_optiboot' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
In file included from Atmega_Board_Programmer.cpp:123:0:
bootloader_atmega2560_v2.h:3:29: error: variable 'atmega2560_v2' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
In file included from Atmega_Board_Programmer.cpp:124:0:
bootloader_atmega1284.h:5:40: error: variable 'optiboot_atmega1284p_hex' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
In file included from Atmega_Board_Programmer.cpp:125:0:
bootloader_lilypad328.h:5:53: error: variable 'ATmegaBOOT_168_atmega328_pro_8MHz_hex' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
In file included from Atmega_Board_Programmer.cpp:126:0:
bootloader_atmega1280.h:5:45: error: variable 'ATmegaBOOT_168_atmega1280_hex' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp: In function 'byte writeFlash(long unsigned int, byte)':
Atmega_Board_Programmer.cpp:262:3: warning: no return statement in function returning non-void [-Wreturn-type]
Atmega_Board_Programmer.cpp: In function 'void showHex(byte, boolean, boolean)':
Atmega_Board_Programmer.cpp:270:71: warning: narrowing conversion of '((((int)(b >> 4)) & 255) | 48)' from 'int' to 'char' inside { } is ill-formed in C++11 [-Wnarrowing]
Atmega_Board_Programmer.cpp:270:71: warning: narrowing conversion of '((((int)b) & 15) | 48)' from 'int' to 'char' inside { } is ill-formed in C++11 [-Wnarrowing]
Atmega_Board_Programmer.cpp: In function 'void writeBootloader()':
Atmega_Board_Programmer.cpp:415:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
Atmega_Board_Programmer.cpp:438:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
Atmega_Board_Programmer.cpp:354:8: warning: unused variable 'lFuse' [-Wunused-variable]
Atmega_Board_Programmer.cpp: In function 'void getSignature()':
Atmega_Board_Programmer.cpp:526:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: nickgammon on Aug 19, 2012, 11:14 pm
I just re-tested on Arduino 1.0.1 and got this result:

Code: [Select]

Binary sketch size: 22,932 bytes (of a 32,256 byte maximum)


This is on OS/X. Also compiled OK on Windows XP.
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: nickgammon on Aug 19, 2012, 11:15 pm
Quote
... variable 'atmega168_optiboot' must be const in order to be put into read-only section  ...


Try adding the word "const" before the hex images in the .h files. eg, change:

Code: [Select]
byte PROGMEM ATmegaBOOT_168_atmega1280_hex [] = {

to:

Code: [Select]
const byte PROGMEM ATmegaBOOT_168_atmega1280_hex [] = {
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: spcomputing on Aug 19, 2012, 11:32 pm


I have used the Atmega Board Programmer and it is nice, and it appears to install the 1284p well enough, but again, uploading a sketch ~25kB fails with the paged_write error.  Blink uploads fine.  I have also tried pulling the hex out of another hex file and putting in, same problem.

The Atmega328 works flawlessly.  The 25kB sketch uploads perfectly.


What gives the paged write error? The bootloader? My sketch? Please clarify and post any messages you get.


Hi Nick,

It has the stk_500_paged_write error in the middle of uploading a large sketch (Show Info modified for a Mega).  Blink uploads fine.  This problem seems to be around serial pocket programmers(USBasp) and Arduino as ISP.  

The only 1284p bootloader that uploads consistently with Aduino as ISP is WestfW's Optiboot for UART1.  I can somehow get Original Might 1284 (16MHz) to work as well.  cyclegadget has no problem with Atmega Board Programmer and an Arduino and the 1284p SMD/CrossRoads Board.  AVRISP MkII have no trouble at all.

It is quite the enigma wrapped in bacon.  I am going to build an *exact* half-board minimal-duino from your tutorial to see if there is something else causing trouble.

Even with this hic up, Atmega Board Programmer is a very clever sketch, great for my 328's!

Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: MaxiKing on Aug 19, 2012, 11:47 pm

Quote
... variable 'atmega168_optiboot' must be const in order to be put into read-only section  ...


Try adding the word "const" before the hex images in the .h files. eg, change:

Code: [Select]
byte PROGMEM ATmegaBOOT_168_atmega1280_hex [] = {

to:

Code: [Select]
const byte PROGMEM ATmegaBOOT_168_atmega1280_hex [] = {


I've already tried it before. It only makes the errors like this:
Code: [Select]
Atmega_Board_Programmer.cpp:223:3: error: invalid conversion from 'const byte* {aka const unsigned char*}' to 'byte* {aka unsigned char*}' [-fpermissive]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Atmega_Board_Programmer.cpp:223:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: nickgammon on Aug 20, 2012, 12:01 am
You must be using a different toolchain to what I am. Try moving the word PROGMEM around a bit, eg.

Code: [Select]
byte ATmegaBOOT_168_atmega1280_hex [] PROGMEM = {
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: nickgammon on Aug 20, 2012, 12:04 am

It has the stk_500_paged_write error in the middle of uploading a large sketch (Show Info modified for a Mega).  Blink uploads fine.  This problem seems to be around serial pocket programmers(USBasp) and Arduino as ISP.  


Does my bootloader uploader upload a bootloader OK? If so, then after that are you saying the (new) bootloader fails to upload a large sketch? That sounds then like the hex codes for the bootloader might be wrong. If we replace them with the bootloader that works (like WestFW's one) then things should be OK.
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: spcomputing on Aug 20, 2012, 02:10 am
Quote
Does my bootloader uploader upload a bootloader OK? If so, then after that are you saying the (new) bootloader fails to upload a large sketch? That sounds then like the hex codes for the bootloader might be wrong. If we replace them with the bootloader that works (like WestFW's one) then things should be OK.


Correct.  I have an incredibly stupid question.  With the Atmega Board Programmer, the 1284p h file (bootloader is 1024 in size) is ~4kB, while the 1280 h file is ~24kB (4096 in size), is there any reason for this?  I see the 2560 h file doubles the 1280 h file size.

It really would be nice if someone could build out a 1284p on a breadboard and burn a standard optiboot or optiboot mighty 1284p with the current ABP software and with an arduino.  Then upload through FTDI (or even a aduino serial) the ABP program and report the results.  And, if that works, pull the hex out of that chip and post here or compare to the current ABP?

The optiboot atmega1284 UART1 is good to have as a stopgap, but it really would be nice to have things a little more standardized when working from anything Arduino.
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: ghps on Sep 12, 2012, 09:10 pm

If you bootload/sketch upload this one on the 1284p UART1 (as opposed to UART0) it seems to work well.
http://code.google.com/p/optiboot/downloads/detail?name=optiboot_atmega1284p-u1.hex&can=2&q=
Just replace the "U1" optiboot in the folder of the Mighty1284 Optiboot and burn bootloader.


I had exactly the same problem: 1284p with FTDI serial converter. The bootloader was written correctly,
"blink" could be flashed but any larger sketch failed with a "protocol error" at various points of the upload
process ranging from 5% to 60%. (Previously I used the "Original Mighty 8 MHz" bootloader which was slow but usable. Ken Shirriff's IRremote- ibrary, however, insists on 16 MHz so I had to change to that bootloader version.)

I spend hours and fouled around with every parameter I could find: cabling, crystal, capacitors, voltage, software - nothing helped.

The UART1 bootloader solved the problem at the very first attempt...

Great - thanks!

Make it available to the general public!
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: spcomputing on Sep 12, 2012, 10:39 pm
Quote
I spend hours and fouled around with every parameter I could find: cabling, crystal, capacitors, voltage, software - nothing helped.

The UART1 bootloader solved the problem at the very first attempt...

Great - thanks!

Make it available to the general public!


Another "fix" is to use a resonator instead of the more precise crystal.  Apparently, there is a Atmel problem with UART0 on just the 1284P-PU packages, not the -AU.  With the resonator and lfuse = 0xF7, all the other bootloaders should work.
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: ghps on Sep 13, 2012, 12:04 pm

But, unfortunately, the UART1 pins are also interrupt pins. But I think I won't need to use more than one in my project.


The interrupt problem is even worse: No matter which interrupt I use, attachInterrupt defaults always to INT0 on pin 16/D10 - which is now used for RX1 on UART1. So in fact one only of the three interrupt lines is usable.
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: nickgammon on Sep 13, 2012, 12:17 pm

The interrupt problem is even worse: No matter which interrupt I use, attachInterrupt defaults always to INT0 on pin 16/D10 - which is now used for RX1 on UART1. So in fact one only of the three interrupt lines is usable.


This assertion is backed up by what code?
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: ghps on Sep 13, 2012, 12:51 pm


The interrupt problem is even worse: No matter which interrupt I use, attachInterrupt defaults always to INT0 on pin 16/D10 - which is now used for RX1 on UART1. So in fact one only of the three interrupt lines is usable.


This assertion is backed up by what code?


Sorry false alert: The interrupts work as they should.

And one should never mix development environments: After one hour of testing I've found that using the sketches from Eclipse directly in the Arduino IDE caused avrdude to upload the same sketch again and again...
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: ghps on Mar 25, 2013, 04:14 pm
Final Remark: The easiest way to regain INT0 and INT1 is to solve the original problem.
This is caused only by RX0, in my tests of the serial port TX0 worked fine.
For a speed of 115.200 baud a simple RC group can filter the incoming signal up to a point where
RX0 is perfectly usable again. The RC filter consists of a 10k resistor in series and
100pf cap to ground.

http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=107115 (http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=107115)

That's it, problem solved.

So I switched back from optiboot_atmega1284p-u1.hex to optiboot_atmega1284p-u0.hex...
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: retrolefty on Mar 25, 2013, 04:35 pm
I thought the problem that some people were having using uart0 on 1284P boards was pretty much solved with changing the low fuse byte to use full swing oscillator option?

Quote

#bobuino.bootloader.low_fuses=0xff
bobuino.bootloader.low_fuses=0xf7


I didn't require that change as I never saw a problem using optiboot on my CrossRoads through hole 1284P PCB using uart0 even with uploading long sketches, but I made the change anyway.

Lefty
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: oric_dan on Mar 25, 2013, 04:51 pm
lefty, as I remember in most of the prior discussions, you were using the 644 chip.
So, I assume you eventually got and tried the 1284P chips, and all is working
well with those?
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: retrolefty on Mar 25, 2013, 05:07 pm

lefty, as I remember in most of the prior discussions, you were using the 644 chip.
So, I assume you eventually got and tried the 1284P chips, and all is working
well with those?


That is correct, both the 644P and 1284P chips are working fine using CrossRoads through hole 1284 board and both chips loaded with optiboot and using the maniac's hardware files. As I said I never saw a serial problem with either chip but was following the thread where several were and they tried various fixes including a R/C filter on uart0 rec pin, but I though all found that changing the low fuse byte cleared up any uart0 problems?

Lefty
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: CrossRoads on Mar 25, 2013, 05:39 pm
This board.
Schematics & PL at http://www.crossroadsfencing.com/BobuinoRev17/
Bare boards $6 mailed to US locations.
Will acceot all these 40-pin DIP chips:
ATmega164A
ATmega164PA
ATmega324A
ATmega324PA
ATmega644A
ATmega644PA
ATmega1284
ATmega1284P
offboard FTDI module, or onboard MIKROE-483 module
http://www.mouser.com/ProductDetail/mikroElektronika/MIKROE-483/?qs=%2fha2pyFaduhQ%2frcyPs7PmGdeFG1B7qIuGl16liNH8Zb3mCcKALPhoQ%3d%3d (less expensive than offboard modules - i think Mouser also has the best prices on uCs)
(http://www.crossroadsfencing.com/BobuinoRev17/1284_thruhole2.JPG)
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: tack on Mar 26, 2013, 01:45 am
Changing the fuse to 0xf7 for Full Swing Oscillator solved the UART0 issue for most, me included.

The symptoms were being unable to upload anything other than small sketches via bootloader through UART0. The falure message was the pagef_write error. Uploading via ICSP worked fine. After changing the low fuse a full 128kb sketch can be uploaded vis UART0 without issue.
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: ghps on Apr 09, 2013, 02:31 pm

Changing the fuse to 0xf7 for Full Swing Oscillator solved the UART0 issue for most, me included.


I substituted a resistor and a capacitor for a single bit in the low fuses - and it works.

So I'll try again:

Final Remark 2.0: Set the low fuses to 0xF7 (not 0xFF) to enable the Full Swing Oscillator.
Title: Re: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot
Post by: kf2qd on Apr 09, 2013, 08:40 pm
Since you already have an Arduino, - why don't you just learn how to use AVRDude and write the .hex file using ArduinoISP? In the end it will require about the same amount of messing around with the 2 devices, and use slightly less flash(I know, the 1284 has a bunch...) In some ways it might be slightly less convenient, but I have had enough problems with programming breadboarded  chips with a serial connection that using the ISP route was just easier.