Go Down

Topic: Sparkfun Pocket AVR Programmer with IDE (again) (Read 7 times) previous topic - next topic

JADB

Feb 26, 2011, 02:43 am Last Edit: Feb 26, 2011, 04:25 am by JADB Reason: 1
Hello,

I have searched and found a couple of topics on this, however I havent found a solution. There are many posts saying its possible, but nothing actually saying how to do it - what I have found so far anyway.

I have a custom board with a 644P on it, and no FTDI interface. I am wanting to use the Arduino IDE with this board, and program directly from the IDE rather than from AVRDude etc.

Can someone please explain what I need to modify in order to allow the IDE to write to the AVR via the Pocket Programmer - Please.

Do I change something in the boards.txt or programmers.txt files? If so, what do I change?
I will run the Sanguino based bootloader etc, I just dont understand how to tell the IDE to program via the Procket Programmer.
On the sparkfun site, they state this is the type of thing you write to use this programmer: avrdude -c usbtiny -B 1 -patmega328 -U flash:w:main.hex
Product page is here: http://www.sparkfun.com/products/9825

Can someone please assist.

Regards
J

chrissv


I am wanting to use the Arduino IDE with this board, and program directly from the IDE rather than from AVRDude etc.


You should be able to program an Arduino Bootloader into the '644P and then use the Arduino IDE as if you were speaking to a "traditional" Arduino board.

You'll have to have a custom board type since nothing in the Arduino code set natively supports the 644. Take a look at www.sanguino.cc

-- Steven

JADB

Hi there
Thanks for the reply.

I am a litle confused about how to do this though.
Writing the bootloader I am fine with, but modifying the files to suit I am not.

This is the contents of the boards.txt file from the Sanguino boards.

Code: [Select]
##############################################################

sanguino.name=Sanguino
sanguino.upload.protocol=stk500
sanguino.upload.maximum_size=63488
sanguino.upload.speed=38400
sanguino.bootloader.low_fuses=0xFF
sanguino.bootloader.high_fuses=0xDC
sanguino.bootloader.extended_fuses=0xFD
sanguino.bootloader.path=atmega644p
sanguino.bootloader.file=ATmegaBOOT_644P.hex
sanguino.bootloader.unlock_bits=0x3F
sanguino.bootloader.lock_bits=0x0F
sanguino.build.mcu=atmega644p
sanguino.build.f_cpu=16000000L
sanguino.build.core=arduino


What do I have to change exactly to make it work with the Sparkfun AVR Pocket programmer?

Thanks and sorry for my ignorance.

chrissv

There are two parts to your problem:
1) You need to program in an Arduino-style bootloader to your chip. To do this you need the Sparkfun AVR Programmer and the AVRDude executable. There isn't really an "off the shelf" 644P compatible bootloader; if you search for Optiboot and get the sources, it has support for the 644p.

2) After your bootloader works, you would use a plain serial connection to your chip (using USART0 with an appropriate USB to TTL converter - SparkFun sells those also). The boards.txt file works with the Arduino IDE to specify the various settings for your project.

I read somewhere that it is possible to use a programmer like the Pocket AVR programmer while you use the Arduino IDE (basically you don't need the serial connection), but I don't have any idea how that would work.

-- Steven

JADB

#4
Feb 26, 2011, 03:41 am Last Edit: Feb 26, 2011, 03:43 am by JADB Reason: 1
Thanks.

I mate has used the 644P for a few Arduino projects with no issues at all, using the Sanguino Bootloader. It acts just like a regular Arduino but with more IO etc.

Its just the part of getting the IDE to program over the ISP port via the Pocket Programmer that I dont understand how to set up.
Getting the IDE to program over USB via a FTDI connection to a 644P is no problem.

I just dont know how to put them both together.
I dont have the board on me to test either. Its currently being used in a workshop, so when I go to do the upgrade I need to do, I need it to work else the machine will be out of action till I figure out how to fix it.
I programmed it via Bascom AVR using an old Parallel programmer in the past, but want to upgarde it to Arduino and use the newer sparkfun pocket programmer as the PC that had the parallel port has since died, and I cant find the parallel programmer I used either...

Thanks
J

chrissv

Using the Sparkfun programmer should be identical to using the Bascom/parallel port programmer - it's the same concept. AVRDude will talk to the Sparkfun programmer no problem.

JADB

Yes I realise this, however I want to use the Arduino IDE as the projects I do from now on I want to be Arduino IDE based, rather than Bascom based.

So this project is currently in Bascom, which I am porting to Arduino IDE, and now I just need a method of writing it.

Sorry for the confusion or if I am not being clear.

hexskrew

sanguino.upload.protocol=stk500

That seems to be the part you would need to change, but I dunno what to change it to yet.

**BOOM!** **FOUND**
How to Use the Arduino IDE with an External Programmer
http://blog.lincomatic.com/?p=10

You'll have to figure out what to change on the boards.txt but shouldn't be too hard. Heck I may do this myself.
This should work for 328 w/arduino as isp.
Code: [Select]

##############################################################

usbtiny328.name=[avrisp]ATmega328

usbtiny328.upload.using=avrisp
usbtiny328.upload.maximum_size=32768

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


JADB

I have added this entry:

Code: [Select]
atmega644p.name=[usbtinyisp]ATmega644P

atmega644p.upload.using=usbtinyisp
atmega644p.upload.maximum_size=63488

atmega644p.build.mcu=atmega644p
atmega644p.build.f_cpu=16000000L
atmega644p.build.core=arduino


However I am wondering if its possible to set the fuse bits with this also, like what is done for the bootloader, but without actually uploading a bootloader hex file...

Like can I add the following lines (just as an example), and when I tell it to upload the bootloader, it will just modify the fuse bits to suit etc?

Code: [Select]
atmega644p.bootloader.low_fuses=0xFF
atmega644p.bootloader.high_fuses=0xDC
atmega644p.bootloader.extended_fuses=0xFD
atmega644p.bootloader.unlock_bits=0x3F
atmega644p.bootloader.lock_bits=0x0F


Thanks
J

JADB

#10
Feb 26, 2011, 11:18 am Last Edit: Feb 26, 2011, 11:33 am by JADB Reason: 1
Maybe I will just have to write the fuses via the AVRdude and then program with the method above, since fuses only get set once (or at least low freq).

Code: [Select]
avrdude.exe -F -c usbtiny -p atmega644p -U lfuse:w:0xff:m -U hfuse:w:0xdb:m -U efuse:w:0xfd:m

It would be nice to have this in the bootloader section though, without actually having to have a bootloader... hmm.

chrissv

You'll want to confirm what the fuse values to use, as those in the ".bootloader." section are set assuming you are using an Arduino bootloader.

chrissv


JADB


hexskrew

Ya know that makes me wanna start building a "Never Ending boards.txt" file for whoever needs it because it's aggrivating to see that things are done time and time again, and documented but then it get's swept in a sea of data that's really hard to search for, and then you have to go looking for it all over again. Maybe something of a wiki?

Go Up