Go Down

Topic: Ok, on to Atmega32 (Read 42805 times) previous topic - next topic

potaton0

Here's the verbose output of avrdude if that helps.  I have to link it since I can only go to 5500 chars here.

http://www2.justinday.com/avrdude.txt

             

mazx

Zack,

I just checked the link and got HTTP 404 error.  :o

Can you please update the link?

It's nice to hear that you got things going. Kewl staff.


Andre

michelef

#47
Jul 08, 2008, 05:13 am Last Edit: Jul 08, 2008, 05:20 am by michelef Reason: 1
Andre,

I'm not sure what happened to Zach server, so I put up my version of the files here:

http://macjordomo.fuortes.net/atmega644/

if you copy the two atmega644 folders in cores and bootloaders in the hardware folder and append_to_board.txt to board.txt file you should get a new board menu called atmega644 in the Arduino IDE.

A few notes:

This is working on a DevBoard-32 with a Atmega644 and a 16 MHz resonator. It connects to my Mac with a Arduino Mini USB Adapter with the DTR connected to the reset pin by a 100 nano-farad capacitor and a 10K pull-up resistor (as per the Diecimila). It's working well and i can upload the sketches straight from the Arduino IDE after having uploaded the bootloader once (the Devboard-32 came with a different one) with a USBTiny connector.

Most of the code in the "core" folder is the Arduino original as changed by robotcraft.ca (without all the conditinals). Zach made most changes and I made some in the pinouts (due to my choice of board).
The bootloader was modified and made working by Zach  (I made extremely little changes). The boot loader hex file is currently compiled for a 16 Mhz external clock and a 3 seconds delay after reset before starting the sketch. The delay is plenty with the setup as above in which the reset is started by the Arduino IDE.  If you need to change these two things (e.g.manual reset, different clock) you can change two variables in the Make file of the bootlader. Change the AVR_FREQ to your clock frequency and the -DMAX_TIME_COUNT to a higher value (with 1/4 of AVR_FREQ is about 3 secs) to increase the delay. Also change the atmega644.build.f_cpu=16000000L value in the boards.txt


Also the current baud rate is 57600, it seems to work well if you have problems you can decrease it to 19200 by changing the 57600 both in the boards.txt and the bootloader .c file.

Make sure you look at pins_arduino.c because currently the "logical" pin in Arduino do not correspond to physical pin in the ATmega644 and that's where the correspondence is dictated. I'm currently working on a new board with a ATMega644 which would keep the same physical and logical pinouts of the Diecimila so you could just pop in shields and sketches and have it working. (Current code name is Quarantamila)

Finally if your clock is not external you might also need to change the fuses setup in boards.txt. I got them wrong at the beginning and my  

digitalWrite(ledPin, HIGH);    // sets the LED on
delay(1000);                       // waits for a second
digitalWrite(ledPin, LOW);    // sets the LED off

was taking about 16 seconds to turn off!!

(I apologize if most of these instructions were already clear to you, but ........ just in case  ;)

Michele



Hoeken

Yo!

Sorry about the posting delay, but we managed to fix the problem.  We now have a fully functioning Arduino environment running on an atmega644.  This is very exciting, and we'll be posting a big announcement in a few weeks once we have it all nicely packaged up for the blogosphere.

Anyway, here is the 'latest' developments, aka how to follow along at home:

all files are stored in NYC Resistor subversion at: http://svn.nycresistor.com/projects/sanguino/

* eagle board design files for soon to be released board based on atmega644 (i'm playing with prototype right now, will order production ASAP
* atmega644 compatible bootloader (located in code/bootloader)
* atmega644 compatible arduino 'core' (located in code/cores/sanguino)
* a boards.txt file that is ready to go with the required changes.

so, what do you need to do to get arduino running on your atmega644?

1. copy the 'sanguino' core file to arduino/hardware/cores
2. copy the 'bootloader' directory to arduino/hardware/bootloader/atmega644 (rename the folder)
3. replace boards.txt in arduino/hardware with the one in sanguino/code/boards.txt (or just copy the relevant section in)
4. make sure your avr-gcc has support for atmega644 (the macs *dont* have it built in, others may... will be fixed in arduino 0012)
5. breadboard the circuit based on the eagle schematic
6. upload the bootloader via the arduino 'upload bootloader' menu option.  i prefer usbtinyisp, but use whatever programmer you like
7. upload your sketches via serial connection.
8. yay!

kg4wsv

cool!  Several of the guys around here like the 644.

Will this be merged into the Arduino distribution?

-j


JAy1st

Great  [smiley=tekst-toppie.gif]

Hoeken

Quote
cool!  Several of the guys around here like the 644.

Will this be merged into the Arduino distribution?

-j



sort of.

i had a nice, long face-to-face conversation with a couple of the core arduino guys.  they were very supportive and are receptive and welcoming of projects like this.  
understandably, they care deeply about providing software that is simple and reliable out of the box.  additionally, they are all quite busy and are unwilling to take on maintenance of others code.  therefore, they declined to include it in the default arduino distribution.  from the perspective of the guy who wants it included, i think they made the right decision.

however, they do want to make it possible.  two important things were discussed and are in the works:

* arduino 0012 which is due out here in the next month will include avr-gcc for more chips out of the box, including the atmega644/atmega644p.
* a future version of arduino, hopefully arduino 0013, will include support for a 'new board' option in the 'boards' menu which will prompt you for a .zip file that contains the relevant files for your board of choice.  this will be provided by the designer of the board in question.  (eg: you download arduino, then you download my sanguino-0012.zip file and install it into your arduino software.)

in the meantime, with built-in support for the atmega644 chip it becomes a trivial process to add support to the arduino software.  there are 3 things required:

1. copy the 'sanguino' core to the 'cores' folder
2. copy the 'atmega644' bootloader to the 'bootloaders' folder
3. add a new board entry to the boards.txt file

it then becomes a 5 minute task.  yay!

hotcarrier

Hoeken,
Can you tell me does the IDE compile the bootloader for the atmega644? Under which conditions?

mazx

Hotcarrier,

the bootloader comes pre-compiled already for specific AVR chip and clock speed.

It's not the same as Arduino library or sketch files.

Andre

hotcarrier

OK, I thought so, but the posted bootloader here:
http://macjordomo.fuortes.net/atmega644/

is an uncompiled c file. Does someone have the atmega644 (not 644p) bootloader compiled? With that
I am ready to go and try this.

hotcarrier

My mistake, this file
http://svn.nycresistor.com/projects/sanguino/code/bootloaders/atmega644/

is uncompiled, the  other location I showed in the previous post has a compiled version,but appears to be for the 644p. At least that is what my environment with all the IDE updates and a breadboard atmega644 with the AVRisp II reports.

mazx

Quote
Yo!

Sorry about the posting delay, but we managed to fix the problem.  We now have a fully functioning Arduino environment running on an atmega644.  This is very exciting, and we'll be posting a big announcement in a few weeks once we have it all nicely packaged up for the blogosphere.
...
* atmega644 compatible arduino 'core' (located in code/cores/sanguino)
...

Hoeken,

What changes have you made to robotcraft.ca patch to get sanguino core to work with your board?

I'd like to integrate those changes back into the patch.


Andre

PS: I've also added Mega48 (Pololu Orangutang, anyone? :) ) and Mega324P ;). You can get the patch here.
http://www.robotcraft.ca/webshop/p7/Robot-Software-Downloads/pages.html
The code is not fully tested yet, but if anyone is willing to poke around, you are welcome to.

mazx

Quote
My mistake, this file
http://svn.nycresistor.com/projects/sanguino/code/bootloaders/atmega644/

is uncompiled, the  other location I showed in the previous post has a compiled version,but appears to be for the 644p. At least that is what my environment with all the IDE updates and a breadboard atmega644 with the AVRisp II reports.


What clock speed your 644 is running at?

hotcarrier

My atmega644 clock is 16mhz,crystal controlled.

mazx

Quote
My atmega644 clock is 16mhz,crystal controlled.


Here you go
http://www.robotcraft.ca/webshop/download/zip/bootloader_atmega644_16MHz.zip

Here is the compiler output:
Code: [Select]

C:\platform\arduino-0011\hardware\tools\avr\bin\avr-gcc -g -Wall -O2 -mmcu=atmeg
a644 -DF_CPU=16000000L  '-DMAX_TIME_COUNT=8000000L>>1' '-DNUM_LED_FLASHES=3' -Wl
,--section-start=.text=0xF800 -c -g -O2 -Wall -mmcu=atmega644 ATmegaBOOT.c -o AT
megaBOOT_644.o
avr-gcc: --section-start=.text=0xF800: linker input file unused because linking
not done
C:\platform\arduino-0011\hardware\tools\avr\bin\avr-gcc -g -Wall -O2 -mmcu=atmeg
a644 -DF_CPU=16000000L  '-DMAX_TIME_COUNT=8000000L>>1' '-DNUM_LED_FLASHES=3' -Wl
,--section-start=.text=0xF800 -o ATmegaBOOT_644.elf ATmegaBOOT_644.o
C:\platform\arduino-0011\hardware\tools\avr\bin\avr-objcopy -j .text -j .data -O
ihex ATmegaBOOT_644.elf ATmegaBOOT_644.hex


The zip contains source by nyresistor guys and binaries produced for atmega644@16MHz. I've changed makefile slightly so now you can recompile the bootloader to your heart's content by simply specifying path to your ARDUINO_HOME\hardware\tools\avr\bin.
Code: [Select]

ARDUINO_AVR_BIN_DIR=C:\platform\arduino-0011\hardware\tools\avr\bin


Hmm... you will need to have Make installed on your system. Otherwise, use compiler output as posted above as your guideline to compile bootloader manually.

Andre
robotcraft.ca

Go Up