Welcome! Log In Create A New Profile

Advanced

Getting a bootloader onto ATMega 644

Posted by monocultured 
Getting a bootloader onto ATMega 644
July 23, 2011 06:40PM
I can't get the bootloader onto my Rev7 1.2 with a blank ATMega 644 20. I'm on a Mac, and trying to use the Arduino IDE.

I've installed VTI drivers for FTDI, and my Arduino NG board works well, and the USB serial interface shows up when I hook up my Gen7 board. I've installet the Gen7 extras into the Arduino app, and the four boards and serial connection show up in the menu of Arduino.app. The power LED lights up and there's a jumper on the "serial power" pins.

As per Kliments IRC-recommendations, I started Arduino as root — sudo open arduino.app — but it seems to make no difference. The errors I get when choosing the bootloaders seem to indicate communication problems with the board, so I'm not certain if my board is busted and how I could narrow down the problem, or if there's a certain order in which this has to be done.

Burning bootloader using AVR ISP generates "avrdude: stk500_recv(): programmer is not responding"
and AVRISP MkII gives: avrdude: usbdev_open(): did not find any USB device "usb"

Any insight welcome.
M

The cable I'm using is from Wetterott: http://www.watterott.com/en/TTL-232R-USB-Serial-Converter-33V

Board looks like this:


Re: Getting a bootloader onto ATMega 644
July 24, 2011 03:44AM
There's no programmer in the picture ...

... to burn fuses and upload a bootloader you need a programmer, which hooks into the 3x2 pin ICMP header:



Additionally, I couldn't get the Arduino IDE to upload something to a factory fresh chip. The IDE forgets to send the -B 5 parameter which slows down communication enough to let the fresh chip deal with it. Brand new chips run at 1 MHz until you change the fuses to use chrystal.

Quote

avrdude: usbdev_open(): did not find any USB device "usb"

The device type you have is "serial".


Generation 7 Electronics Teacup Firmware RepRap DIY
     

Re: Getting a bootloader onto ATMega 644
July 24, 2011 04:14AM
Hah, so the good part is that my board might not be broken, the bad part is my brain might be.

I re-read one of the emails you sent, and you mention that you can use an Arduino as a programmer, so something like this [arduino.cc] should work, right? Any way to discern which wires go where?

I'm thinking.

* Change firmware on Arduino into AVR ISP
* Hook up Arduino to Gen7 w ATMega
* Try the sudo trick with Arduino IDE (although that shouldn't affect speed)
* Else follow the Linux instructions (bash is the same on Mac, one hopes)
Re: Getting a bootloader onto ATMega 644
July 24, 2011 06:11AM
Hum, found an Instructable here: [www.instructables.com] and larger breadboard layout here: [www.instructables.com]

So I'll remove the chip on the Arduino board and just use it to program the ATMega on a breadboard. (Looking at the schematics of the Gen7 1.2. board, I'm not sure which of the ICSP pins correspond to what on the Arduino, so I figure a breadboard is less chancy)

More info on doing setups on a breadboard is here: [www.arduino.cc]
Re: Getting a bootloader onto ATMega 644
July 24, 2011 11:33AM
Found a suggestion for solution to the speed rate of the Arduino IDE for bootloading: [www.instructables.com] Will try it when I'll get get breadboard set up. Currently, I have a short somewhere and get the "USB device drawing too much power" warning on my Macbook. Do I need to add resistors somewhere on the breadboard, or would it be enough to add external power to the Arduino you think?
Re: Getting a bootloader onto ATMega 644
July 25, 2011 05:18PM
I've written up what I've done so far on the blog here: [monocultured.com]

Also, on IRC Kerman suggested I take a look at MegaISP: [arduino.cc] and timtimred mentioned that the capacitors are specified in the datasheet if I use an external crystal. Questions is: What does the schematic look for bootloading the ATMega644 on a breadboard (i.e. how do I know which crystal to use, and where does it go?) and is Arduino ISP or Mega ISP the prefered method?

Assistance heartily appreciated.
Re: Getting a bootloader onto ATMega 644
July 25, 2011 11:36PM
For uploading the bootloader it doesn't matter which crystal you use. It's perfectly fine to use a programmer with the chip running on the internal clock. You can even upload a bootloader for 20 MHz, then. Just make sure tha last thing you do is to set the fuses to the new clock.

May I add a suggestion myself? Either kludge together such a parallel port programmer or buy one. Everything else is too complex and not worth the work for programming a single CPU.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Getting a bootloader onto ATMega 644
July 26, 2011 01:26AM
I've got an Atmega 644A , and it seems that I've alread bricked two chips setting the fuses wrong, following the WIKI. If someone has the right fuses settings, that would be appreciated. tongue sticking out smiley




reprapworld.com
PLA, ABS, PETG multiple colors (3 and 1.75 mm) €16,49 / kg
Megatronics 3.0 €79.99 / Minitronics €37,19
Re: Getting a bootloader onto ATMega 644
July 26, 2011 04:20AM
Traumflug, any advice is greatly appreciated. I've been trying to kludge a parallell programmer together the past two days, but my kludge-fu is weak.

I have some 20Mhz crystals lying around and will try to use those along with ceramic capacitors to get a result with the Arduino as ISP; If this doesn't take, do you have recommendations for a particular parallell port programmer? (Something like this [www.adafruit.com] would do, right?) Also, I'm not sure how many ATMegas I'm going to program in the future, so am considering just getting bootloaded chips to begin with — if you sell those I'm interested.

A thought struck me; will I have similar problems with Pololus, or does the Gen7 board take care of all that once I have the ATMega bootloaded and programmed with firmware?

Cheers
M

As a side-note, if there's a FAQ or guide to the function of the crystal oscillator as it relates to the ATMega, I'd love to read it.
Re: Getting a bootloader onto ATMega 644
July 27, 2011 01:35AM
Quote

I've got an Atmega 644A , and it seems that I've alread bricked two chips setting the fuses wrong

What makes you think you bricked the chip? Does it no longer react at all, of do you just get errors?

Quote

If someone has the right fuses settings, that would be appreciated.

Here's a fuse calculator: [www.engbedded.com] You can use the ceckboxes to find out the numbers or insert the numbers at the bottom and see what checkoxes you get in the upper half.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Getting a bootloader onto ATMega 644
July 27, 2011 05:45AM
Quote

What makes you think you bricked the chip? Does it no longer react at all, of do you just get errors?

After I do the first step as described on the wiki, avrdude says ok.

Quote

sudo ./avrdude -C ./avrdude.conf -c avrispmkII -p atmega644 -U lfuse:w:0xF7:m -U hfuse:w:0xDC:m -U efuse:w:0xFF:m -P usb

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9609
avrdude: reading input file "0xF7"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.02s

...
Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of efuse verified

avrdude: safemode: Fuses OK

avrdude done. Thank you.
All next steps fail
Quote

sudo ./avrdude -C avrdude.conf -c avrispmkII -p atmega644 -P usb -B 1 -U flash:w:./Gen7\ Arduino\ IDE\ Support/Gen7/bootloaders/Gen7/bootloader-644-20MHz.hex


avrdude: stk500v2_command(): command failed
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.

So I guess I've put the chip in a wrong mode, making the effectively unusable...

I saw the fuse calculator. I've tried to make sense of it with the datasheet in hand. But I find it hard to understand and have not enough chips to brick to try something :p




reprapworld.com
PLA, ABS, PETG multiple colors (3 and 1.75 mm) €16,49 / kg
Megatronics 3.0 €79.99 / Minitronics €37,19
Re: Getting a bootloader onto ATMega 644
August 01, 2011 09:43AM
I borrowed an Adafruit USBTiny and managed to get it hooked up to the board (I put the atmega644 in the wrong way around at first…) and got a response from the programmer and chip, but not the same progress report which brupje got. Also, I didn't get the final error mentioned on the wiki — "verification error 0xcf != 0x0f" — so I suspect that there's something off here. I'm going to doublecheck what I did and then get Teacup onto the board, but if there seems to be anything off in my process below, give a shout.


mateusz$ sudo ./bin/avrdude -C ./etc/avrdude.conf -c usbtiny -p atmega644 -P /dev/ttyACM0 \ -B 5 -U lfuse:w:0xF7:m -U hfuse:w:0xDC:m -U efuse:w:0xFFD:m
Password:

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9609

avrdude: safemode: Fuses OK

avrdude done. Thank you.


mateusz$ ./bin/avrdude -C ./etc/avrdude.conf -c usbtiny -p atmega644 -P /dev/ttyACM0 \ -B 1 -U flash.w:/Applications/Arduino.app/Contents/Resources/Java/hardware/Gen7/bootloaders/Gen7/bootloader-644-20MHz.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9609

avrdude: safemode: Fuses OK

avrdude done. Thank you.


mateusz$ ./bin/avrdude -C ./etc/avrdude.conf -c usbtiny -p atmega644 -P /dev/ttyACM0 \ -B 1 -U lock:w:0xCF:m

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9609

avrdude: safemode: Fuses OK

avrdude done. Thank you.
Re: Getting a bootloader onto ATMega 644
August 01, 2011 12:09PM
Woot, I think I nailed it.

Just for the hell of it I tried to to upload the bootloader via the Arduino IDE again using USBTiny, and lo and behold it seemed to take after a minute. I didn't start Arduino as root, but it seemed to work regardless; Perhaps the -R flag took from before and the speed was adjusted?

I downloaded the latest Teacup and uploaded it through Arduino IDE as per [reprap.org] without any changes to the config.h file. That worked, and once I started up Replicator G I could access the board as a Teacake. Now I'll connect the motors + drivers and a PSU and see if I can get the thing to go whirr whirr.

No idea why the Arduino IDE worked with USBTiny this time, but am not about to look a gifted AVR in the baud.
Re: Getting a bootloader onto ATMega 644
August 02, 2011 01:40AM
sudo ./avrdude -C avrdude.conf -c avrispmkII -p atmega644 -P usb -B 1 -U flash:w:./Gen7\ Arduino\ IDE\ Support/Gen7/bootloaders/Gen7/bootloader-644-20MHz.hex


avrdude: stk500v2_command(): command failed
avrdude: initialization failed, rc=-1
brupje,

"initialization failed" means, avrdude it's self is missing something. One time you give -c avrdude.conf, the other time -c ./avrdude.conf. It might be this, or something similar.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Getting a bootloader onto ATMega 644
August 02, 2011 07:15AM
Thanks, I have tried it on a third chip with AVR studio for Windows. That seems to have worked ok, but uploading the firmware to the chip with the Arduino software fails over the serial line. So I still think it's the fuses, but have not proved that the bootloader was in fact uploaded ok.

Hopefully I can reset the bricked chips with AVR studio, but I have been busy blowing up Arduino MEGA's, so I haven't had time playing with this anymore... Will let you know if I fixed this problem.




reprapworld.com
PLA, ABS, PETG multiple colors (3 and 1.75 mm) €16,49 / kg
Megatronics 3.0 €79.99 / Minitronics €37,19
Re: Getting a bootloader onto ATMega 644
August 03, 2011 02:02AM
Quote

uploading the firmware to the chip with the Arduino software fails over the serial line

Maybe a baud rate misalignment. One possible test is to upload something with the programmer. This something should send characters over the serial line, so you can see what's going on.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Getting a bootloader onto ATMega 644
February 29, 2012 10:54AM
brupje Wrote:
-------------------------------------------------------
> I've got an Atmega 644A , and it seems that I've
> alread bricked two chips setting the fuses wrong,
> following the WIKI. If someone has the right fuses
> settings, that would be appreciated. tongue sticking out smiley


Brupje - Not sure if you're still working on this - your posts are pretty old, but I have 2 644PA's and they acted exactly as yours did when using the 0xF7 low fuse setting.

[forums.reprap.org]

They were completely unresponsive when using the "Full Swing" crystal setting. I have an STK500 devel board though, so I can reset them with AVR Studio. I finally tried 0xFF for the low fuse instead which equates to "External oscillator, 8MHz+, Startup Time 16K CK + 65ms". Now everything works perfectly (even though I'm using 20MHz crystals, not external oscillators). I assume this is a bug in the "A" series, but it works. My Gen7 board is up and running with Teacup and this setting - go figure.
Sorry, only registered users may post in this forum.

Click here to login