Go Down

Topic: Toggle DTR before programming? (Read 2548 times) previous topic - next topic

zenocon

Hi, I've got a mega 1280 board, and building and uploading sketches from the IDE works fine.

I want to use Makefiles for my build, and I've got the compilation working but the hook into avrdude is not working (see below).  I read somewhere that you can add upload.verbose=true to the IDE preferences.txt and it will print out the commands it is issuing.  I tried this (with IDE restart), and it did not work.

The only other thing I can think of is what this guy is saying http://johanneshoff.com/arduino-command-line.html -- he's basically toggling the DTR in his Makefile via Python before he attempts the avrdude upload.  Is this possibly what I'm missing.  I'm pretty certain that the params passed to avrdude are right, and I'm calling the same avrdude binary that is shipped with the IDE (and it works from the IDE) -- the params for compilation and upload are dynamically found via sed and boards.txt.

Code: [Select]

avrdude -V -F -vvvvv -C /home/davis/arduino-0022//hardware/tools/avrdude.conf  -p atmega1280 -P /dev/ttyUSB0 -c stk500  -b 57600 -U flash:w:tmp/BlinkWithoutDelay.hex

avrdude: Version 5.10, compiled on Jun 29 2010 at 21:09:48
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

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

         Using Port                    : /dev/ttyUSB0
         Using Programmer              : stk500
         Overriding Baud Rate          : 57600
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14]
avrdude: ser_recv(): programmer is not responding


CrossRoads

toggling DTR just makes a reset happen - you can do the same manually to see if that is the problem. When you upload, there is a message that says something like "xxx bytes". press reset right after you see that.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

zenocon

I knew it did a reset, and I seem to recall that reset is necessary to get the board in re-programmable mode.  I just thought maybe the avrdude binary would take care of that for me.  Does anyone know if it does do that or not?  If it doesn't do it, and if it is required, then the Java code in the IDE must take care of this before calling out to avrdude.  I suppose I'll just have to go look at the source code to find my answer, but if anyone has an answer, I'd love to hear it.

The strange thing is that the Makefile examples provided by the Arduino distros don't seem to do anything like this -- they just call avrdude directly to do the upload.

madworm

As you use avrdude 5.10, you can use 'arduino' as the programmer type instead of stk... This will automatically toggle the DTR line for you. No need for any hacks anymore.

zenocon

#4
Apr 29, 2011, 07:45 pm Last Edit: May 01, 2011, 03:31 pm by zenocon Reason: 1
hmm...are you sure about the 'arduino' programmer type?

Code: [Select]

$ make upload
stty -F /dev/ttyUSB0 hupcl
avrdude -V -F -vvvvv -C /home/davis/arduino-0022//hardware/tools/avrdude.conf  -p atmega1280 -P /dev/ttyUSB0 -c arduino  -b 57600 -U flash:w:tmp/BlinkWithoutDelay.hex

avrdude: Version 5.10, compiled on Jun 29 2010 at 21:09:48
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

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


avrdude: Can't find programmer id "arduino"

Valid programmers are:
  dasa3    = serial port banging, reset=!dtr sck=rts mosi=txd miso=cts [/home/davis/arduino-0022//hardware/tools/avrdude.conf:776]
  dasa     = serial port banging, reset=rts sck=dtr mosi=txd miso=cts [/home/davis/arduino-0022//hardware/tools/avrdude.conf:763]
  siprog   = Lancos SI-Prog <http://www.lancos.com/siprogsch.html> [/home/davis/arduino-0022//hardware/tools/avrdude.conf:750]
  ponyser  = design ponyprog serial, reset=!txd sck=rts mosi=dtr miso=cts [/home/davis/arduino-0022//hardware/tools/avrdude.conf:737]
  frank-stk200 = Frank STK200                   [/home/davis/arduino-0022//hardware/tools/avrdude.conf:702]
  blaster  = Altera ByteBlaster             [/home/davis/arduino-0022//hardware/tools/avrdude.conf:689]
  ere-isp-avr = ERE ISP-AVR <http://www.ere.co.th/download/sch050713.pdf> [/home/davis/arduino-0022//hardware/tools/avrdude.conf:679]
  atisp    = AT-ISP V1.1 programming cable for AVR-SDK1 from <http://micro-research.co.th/>  [/home/davis/arduino-0022//hardware/tools/avrdude.conf:669]
  dapa     = Direct AVR Parallel Access cable [/home/davis/arduino-0022//hardware/tools/avrdude.conf:658]
  xil      = Xilinx JTAG cable              [/home/davis/arduino-0022//hardware/tools/avrdude.conf:645]
  futurlec = Futurlec.com programming cable. [/home/davis/arduino-0022//hardware/tools/avrdude.conf:628]
  abcmini  = ABCmini Board, aka Dick Smith HOTCHIP [/home/davis/arduino-0022//hardware/tools/avrdude.conf:618]
  picoweb  = Picoweb Programming Cable, http://www.picoweb.net/ [/home/davis/arduino-0022//hardware/tools/avrdude.conf:608]
  sp12     = Steve Bolt's Programmer        [/home/davis/arduino-0022//hardware/tools/avrdude.conf:597]
  alf      = Nightshade ALF-PgmAVR, http://nightshade.homeip.net/ [/home/davis/arduino-0022//hardware/tools/avrdude.conf:581]
  bascom   = Bascom SAMPLE programming cable [/home/davis/arduino-0022//hardware/tools/avrdude.conf:571]
  dt006    = Dontronics DT006               [/home/davis/arduino-0022//hardware/tools/avrdude.conf:561]
  pony-stk200 = Pony Prog STK200               [/home/davis/arduino-0022//hardware/tools/avrdude.conf:549]
  stk200   = STK200                         [/home/davis/arduino-0022//hardware/tools/avrdude.conf:533]
  bsd      = Brian Dean's Programmer, http://www.bsdhome.com/avrdude/ [/home/davis/arduino-0022//hardware/tools/avrdude.conf:522]
  pavr     = Jason Kyle's pAVR Serial Programmer [/home/davis/arduino-0022//hardware/tools/avrdude.conf:514]
  dragon_dw = Atmel AVR Dragon in debugWire mode [/home/davis/arduino-0022//hardware/tools/avrdude.conf:507]
  dragon_hvsp = Atmel AVR Dragon in HVSP mode  [/home/davis/arduino-0022//hardware/tools/avrdude.conf:499]
  dragon_pp = Atmel AVR Dragon in PP mode    [/home/davis/arduino-0022//hardware/tools/avrdude.conf:491]
  dragon_isp = Atmel AVR Dragon in ISP mode   [/home/davis/arduino-0022//hardware/tools/avrdude.conf:483]
  dragon_jtag = Atmel AVR Dragon in JTAG mode  [/home/davis/arduino-0022//hardware/tools/avrdude.conf:475]
  jtag2dw  = Atmel JTAG ICE mkII in debugWire mode [/home/davis/arduino-0022//hardware/tools/avrdude.conf:467]
  jtag2isp = Atmel JTAG ICE mkII in ISP mode [/home/davis/arduino-0022//hardware/tools/avrdude.conf:459]
  jtag2    = Atmel JTAG ICE mkII            [/home/davis/arduino-0022//hardware/tools/avrdude.conf:451]
  jtag2fast = Atmel JTAG ICE mkII            [/home/davis/arduino-0022//hardware/tools/avrdude.conf:443]
  jtag2slow = Atmel JTAG ICE mkII            [/home/davis/arduino-0022//hardware/tools/avrdude.conf:435]
  jtagmkII = Atmel JTAG ICE mkII            [/home/davis/arduino-0022//hardware/tools/avrdude.conf:427]
  jtag1slow = Atmel JTAG ICE (mkI)           [/home/davis/arduino-0022//hardware/tools/avrdude.conf:420]
  jtag1    = Atmel JTAG ICE (mkI)           [/home/davis/arduino-0022//hardware/tools/avrdude.conf:412]
  jtagmkI  = Atmel JTAG ICE (mkI)           [/home/davis/arduino-0022//hardware/tools/avrdude.conf:404]
  avr911   = Atmel AppNote AVR911 AVROSP    [/home/davis/arduino-0022//hardware/tools/avrdude.conf:398]
  avr109   = Atmel AppNote AVR109 Boot Loader [/home/davis/arduino-0022//hardware/tools/avrdude.conf:392]
  butterfly = Atmel Butterfly Development Board [/home/davis/arduino-0022//hardware/tools/avrdude.conf:386]
  usbtiny  = USBtiny simple USB programmer  [/home/davis/arduino-0022//hardware/tools/avrdude.conf:380]
  usbasp   = USBasp, http://www.fischl.de/usbasp/ [/home/davis/arduino-0022//hardware/tools/avrdude.conf:374]
  avr910   = Atmel Low Cost Serial Programmer [/home/davis/arduino-0022//hardware/tools/avrdude.conf:368]
  stk500hvsp = Atmel STK500 V2 in high-voltage serial programming mode [/home/davis/arduino-0022//hardware/tools/avrdude.conf:362]
  stk500pp = Atmel STK500 V2 in parallel programming mode [/home/davis/arduino-0022//hardware/tools/avrdude.conf:356]
  stk500v2 = Atmel STK500 Version 2.x firmware [/home/davis/arduino-0022//hardware/tools/avrdude.conf:350]
  stk500v1 = Atmel STK500 Version 1.x firmware [/home/davis/arduino-0022//hardware/tools/avrdude.conf:344]
  stk500   = Atmel STK500                   [/home/davis/arduino-0022//hardware/tools/avrdude.conf:338]
  avrisp2  = Atmel AVR ISP mkII             [/home/davis/arduino-0022//hardware/tools/avrdude.conf:328]
  avrispmkII = Atmel AVR ISP mkII             [/home/davis/arduino-0022//hardware/tools/avrdude.conf:322]
  avrispv2 = Atmel AVR ISP V2               [/home/davis/arduino-0022//hardware/tools/avrdude.conf:316]
  avrisp   = Atmel AVR ISP                  [/home/davis/arduino-0022//hardware/tools/avrdude.conf:310]



Go Up