Offline
Newbie
Karma: 0
Posts: 40
|
 |
« on: February 25, 2011, 08:43:20 pm » |
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.hexProduct page is here: http://www.sparkfun.com/products/9825Can someone please assist. Regards J
|
|
|
|
« Last Edit: February 25, 2011, 10:25:54 pm by JADB »
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 25
|
 |
« Reply #1 on: February 25, 2011, 09:09:23 pm » |
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
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 40
|
 |
« Reply #2 on: February 25, 2011, 09:20:41 pm » |
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. ##############################################################
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.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 25
|
 |
« Reply #3 on: February 25, 2011, 09:37:16 pm » |
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
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 40
|
 |
« Reply #4 on: February 25, 2011, 09:41:24 pm » |
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
|
|
|
|
« Last Edit: February 25, 2011, 09:43:23 pm by JADB »
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 25
|
 |
« Reply #5 on: February 25, 2011, 10:19:32 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 40
|
 |
« Reply #6 on: February 25, 2011, 10:21:33 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 1
Posts: 54
|
 |
« Reply #7 on: February 26, 2011, 12:38:42 am » |
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=10You'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. ##############################################################
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
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 40
|
 |
« Reply #8 on: February 26, 2011, 12:45:09 am » |
Thankyou!
I will try this!
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 40
|
 |
« Reply #9 on: February 26, 2011, 03:52:59 am » |
I have added this entry: 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? 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
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 40
|
 |
« Reply #10 on: February 26, 2011, 05:18:07 am » |
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). 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.
|
|
|
|
« Last Edit: February 26, 2011, 05:33:29 am by JADB »
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 25
|
 |
« Reply #11 on: February 26, 2011, 09:12:32 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 25
|
 |
« Reply #12 on: February 26, 2011, 09:21:37 am » |
By the way, here's a site for calculating fuse values: http://www.engbedded.com/fusecalc
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 40
|
 |
« Reply #13 on: February 26, 2011, 03:19:20 pm » |
Yep already done, thanks though.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 1
Posts: 54
|
 |
« Reply #14 on: February 27, 2011, 11:48:50 am » |
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?
|
|
|
|
|
Logged
|
|
|
|
|
|