Pages: [1] 2 3   Go Down
Author Topic: Using Arduino Uno instead of FTDI cable to program 1284p w/ Optiboot  (Read 5411 times)
0 Members and 1 Guest are viewing this topic.
Poland
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Leeds, UK
Offline Offline
Edison Member
*
Karma: 72
Posts: 1642
Once the magic blue smoke is released, it won't go back in!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

~Tom~

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

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.


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

Leeds, UK
Offline Offline
Edison Member
*
Karma: 72
Posts: 1642
Once the magic blue smoke is released, it won't go back in!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

~Tom~

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

Here it is:
Code:
/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
Logged

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

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

Leeds, UK
Offline Offline
Edison Member
*
Karma: 72
Posts: 1642
Once the magic blue smoke is released, it won't go back in!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

~Tom~

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

Well, it couldn't upload even Blink at 57600 baud rate. Could you send the file, please?
Logged

California
Offline Offline
God Member
*****
Karma: 13
Posts: 629
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ah, the "paged_write" fun that nobody else has a problem with smiley-wink

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
Logged


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

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

California
Offline Offline
God Member
*****
Karma: 13
Posts: 629
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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


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

I have not. I use Atmel AVR ISP MKii.
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.

Sweden
Offline Offline
Sr. Member
****
Karma: 11
Posts: 253
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 See Post : #473
Logged

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

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

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

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

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