Go Down

Topic: Problems Programming Mini w/ATmega328 (Read 572 times) previous topic - next topic

AgSnake

I just bought an Arduino mini w/ATmega328 and a miniUSB programmer and am having problems loading the blink program on to the Arduino.  If I do a verbose upload it appears to hang at "avrdude: ser_open(): setting dtr".  I am running version 0022 of the Arduino programmer and I have added the following entry for my board.

Code: [Select]
mini328.name=Arduino Mini with ATmega328

mini328.upload.protocol=stk500
mini328.upload.maximum_size=28672
mini328.upload.speed=115200

mini328.bootloader.low_fuses=0xff
mini328.bootloader.high_fuses=0xd8
mini328.bootloader.extended_fuses=0x05
mini328.bootloader.path=bt
mini328.bootloader.file=ATmegaBOOT_168_atmega328.hex
mini328.bootloader.unlock_bits=0x3F
mini328.bootloader.lock_bits=0x0F

mini328.build.mcu=atmega328p
mini328.build.f_cpu=16000000L
mini328.build.core=arduino


I have tried on a windows 7 64-bit PC and a windows xp machine.  One odd bit of behavior that I notice is that when I reset the LED i have on pin 13 only flashes once.  I read that this should flash three times if the bootloader is working so I am thinking I may have somehow got one without a bootloader.  Also, when I try to upload to the Arduino the RX LED on the USB module flashes but the TX LED does not.  Can anyone confirm my suspicions that the bootloader is gone or have any thoughts on other things that might be wrong?

johnwasser

I think the problem is that, by default, the Arduino is loaded through a serial port via bootloader.  This is specified in 'preferences.txt': upload.using=bootloader.  If you shut down the Arduino IDE, change the preference.txt file to specify upload.using=USBtiny and then re-start the Arduino ISP it might work better.

I think you can make the change specific to the Arduino Mini with ATmega328 by changing boards.txt to include:

mini328.upload.using=USBtiny
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

AgSnake

I just tried it but it didn't seem to help.  I have a the FTDI USB driver that emulates a serial port so shouldn't it work just like it was being programmed on a serial interface?  Thanks for the fast reply.

johnwasser

Oops.  My mistake.  I misread "miniUSB programmer" as "USBtiny programmer".  Set the preferences.txt and boards.txt files back the way they were.

Sounds like you have a "Mini USB Adapter" that is either doesn't have the DTR line (early models) or it's not wired to the Reset signal correctly. Have you tried doing a manual reset?
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

AgSnake

I don't think that the mini has an automatic reset from what I have read so I have a push button on the reset pin.  When I press that button the LED on pin 13 flashes once, not three times like I would expect.  I have tried pressing the button 1 second before I hit upload and I have also tried holding the button until the programmer is ready to send the data.

AgSnake

So I did some more reading and I found that some older versions of the bootloader only flash the LED once so it sounds like I at least have something there because if I did not then I would not be getting any LED flashes.  Is there any way to find out what version of the bootloader I have installed?  Also, I have been trying to find the source code for the arduino bootloader but all I can find are links to AVRDUDE source.  If someone could point me to the source code for the bootloader I would appreciate it.

Go Up