Arduino IDE but no Arduino board.

Hello guys! I recently decided to make my own board because of space problems. What i did is i took a blank atmega328 and placed it out of its arduino board.

I am now trying to write code on it, but i always get the:

avrdude: stk500_getsync(): resp=0x00 avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

i've seen this error in many other posts but reading them didn't solve my problem.

First of all my programmer is this one: http://www.sparkfun.com/commerce/product_info.php?products_id=14

and i've written "avrisp" in the preferences.txt file at the upload entry. My programmer has a 5x2 port instead of the 3x2 found on the arduino boards. I connected it this way:

www.olimex.com/dev/images/avr-icsp-10.gif

..And that's it. No other connections on board. From what i've read on other forums/posts the problem might concern the reset pin, but i do not know what to do with it (it is currently only connected to the programmer, see link above).

One other thing: does the programmer supply the atmega with power or do i still have to plug in the batteries?

Thank you in advance!

EDIT: forgot to mention that on this page (http://www.societyofrobots.com/images/sbs_avr_schematic.png) you can see that the guy who built that also connected both GNDs together and V to AREF and AVCC, but i have no idea if that's important or not (just started playing with atmega alone).

I'm not clear on how your atmega is set up or what actions you need the ide to do. Maybe you can explain or show a picture.

Is your 328 really a factory-fresh blank from an electronics supplier or is it from an arduino? If it's pulled from an arduino or has been prepped for one, it needs a crystal. A factory fresh one is set up to run on the internal oscillator so no crystal.

I don't know that programmer but for mine, it connects to 6 pins on the atmega. 7&8 for vcc & ground, 1 for reset, 17, 18, and 19 for miso, mosi, and sck.

To run reliably the atmega needs a few other connections but for programming that's it. Your programmer probably supplies VCC but check the documentation.

Hi Bill and thanks for answering.

The atmega328 is blank (not taken from arduino and doesn't have a bootloader). From what you've written it looks like that the pins which get connected to the programmer are the same, even if arranged differently, so i guess that's not the problem.

Maybe I just found out why it doesn't work but i'm not sure. Just checked olimex .com (programmer's site) and it says "will not work with rs232 converters", and well, i used it with an rs232 converter! Funny how that wasn't written in the datasheet. :=(

Before bothering you with more i'll check if it works directly connected to my pc's serial port. Thank you again for answering!

UPDATE: taking off the rs232 didn't help, still the same problems. (tried with and without batteries connected to atmega)

Can show us a picture or describe the setup please.

sure, here it is:

same colored dots means there is a connection between the two, and the GND and VCC are also connected to a battery (but i have also tried without the battery). I then set "upload.using=avrisp" in the preferences.txt file and that's it, nothing else.

good picture, thanks. The connections look fine assuming the icsp ground is connected to pin 8.

get rid of the battery unless you know you need it. use a meter to check that you’ve got 5v on pin 7 from the programmer.

I have never tried uploading a sketch using a programmer so I don’t know about the upload using stuff. Again with a meter you should see the reset pin pulled low by the programmer when the action starts.

If it’s a bare 328 it’s running on the internal oscillator and maybe even only 1mhz. I THINK it would program ok though. I have mine set to 8mhz and I tell the ide it’s a lilypad in tools/board - is that what you’re setting? what about the serial baud rate - maybe you have to set that somewhere?

In your situation I would open a command window and start playing with avrdude directly. Alternatively I believe in that preferences.txt you can set upload.verbose=true and see the avrdude command lines and error messages. or… did the programmer come with any utilities?

I left the default setting which said "Arduino duemilanove with atmega 328". As for the baudrate, i checked in control panel> system> hardware manager and it is set for 9600. I'll try with the upload.verbose=true, then i'll see what happens.

Thanks again for helping me!

ps: no utilities came with the programmer :(

Change the ide board setting to lilypad with 328. probably doesn't matter for this point but you'll have to do it sometime.

If I'm reading this schematic correctly I think you do need to power the target chip separately. I would find 5 volts somewhere if I were you.

Why don't you poke around sparkfun or google and see if there is a tutorial or how-to on programming an avr with it. Getting any sort of success would be a help.

Do you have a bona fide arduino or clone working at hand?

"no need for external power supply as it takes the power supply from target board." as written on olimex's site. So i guess i have to keep my battery connected to the circuit. Have to go to bed now (GMT+1) i'll try again tomorrow with the info you gave me. Thank you!

oops, looking at that schematic while you sleep I notice that the programmer is really just level-shifting the serial port lines. There is no intelligence other than the pc.

That means that it will not be avrisp or any other standard protocol. The program running on the pc will have to do the isp programming directly. On the spark-fun web site they ref using ponyprog and point to a web site.

It's possible that avrdude the IDE wil support this as "ponyser" (as opposed to avrisp). Maybe give that a quick shot and, if no go, either swap the programmer for a more standard one or start looking at "pony prog".

If you can get anything going at all you can eventually get it all working but you just need something to start clicking.

I've searched a bit on the net and i found out that the original AVRdude has a "ponyser" entry in the programmers section. Though on the arduino guide it says the under the "upload.using" in the preferences.txt i have to insert one of the names found under /hardware/programmers.txt file in the arduino-0017 folder.

But i've seen a guy on the forums program an avr using avrdude with a similar programmer to mine. There must be a way to set it up on the arduino...i guess i'll have to find the right configuration for it.

"BIG" UPDATE: i got my atmega328 to work by using avrdude alone, without arudino IDE. I followed this guide (http://www.ladyada.net/learn/avr/avrdude.html) and i wrote this in the command window: avrdude -c ponyser -P com3 -p atmega328p -U flash:w:myprogram.hex

so looks like the ponyser is the way to go. I now have to find a way to "stick it" in the arduino IDE. My guess is that i have to tweak the /hardware/programmers.txt file, after all it's still avrdude....

ADDITIONAL THOUGHTS:

i checked the avrdude .CONF file and in the programmers section this is what i found:

programmer id = "avrisp"; desc = "Atmel AVR ISP"; type = stk500; ;

programmer id = "ponyser"; desc = "design ponyprog serial, reset=!txd sck=rts mosi=dtr miso=cts"; type = serbb; reset = ~3; sck = 7; mosi = 4; miso = 8;

;

so maybe in the hardware.txt file (the one in the arduino folder) i should put "serbb" under protocol? I'll try. And i somehow need to, or at least i guess i have to, add the additional information about the ponyser programmer.

"BIG" UPDATE: i got my atmega328 to work by using avrdude alone, without arudino IDE. I followed this guide (http://www.ladyada.net/learn/avr/avrdude.html) and i wrote this in the command window: avrdude -c ponyser -P com3 -p atmega328p -U flash:w:myprogram.hex

good going - you're on the board. let us know how you make out.

I am having no luck with arduino IDE. Tried almost everything in the hardware.txt. What puzzles me is that i still get the stk500_getsync(): resp=0x00 error, and i don’t understand why since i’ve set the hardware file to:

ponyser.name=PonySer
ponyser.communication=serial
ponyser.protocol=ponyser

oh and i even tried placing “serbb” in protocol and in communication, just in case, but no difference. I think im stuck, and when i’m stuck Google is the answer!

YES!!! GOT IT!!

i don't know what lead me to opening that boards.txt file (maybe desperation :D i had tried everything else) but that's what you have to modify to make it work!

I modified two entries, don't really know which one made it work, here they are:

atmega328.upload.protocol=ponyser (instead of stk500, that's why the ide kept on telling me there was an error with stk500!!) atmega328.upload.speed=9600 (it was higher, but i guess this doesn't matter). Maybe i should notify the makers about this issue? Because in the guide which tells you how to program an arduino through the ISP this wasn't mentioned.

Before introducing the next problem (fortunately it looks simpler :D ) i want to thank you for your time and precious answers!! Thank you!

Now one last problem. I uploaded the example sketch called "blink" which should switch on an LED for 1 second and then off and then wait another second before looping. The problem here is that the LED stays on for 16 seconds and then off for 16 seconds. 16 sounds curious, because i've read that the atmegas have a fuse which sets the chip running at the original frequency divided by 8 (but it's 8, not 16 :-/ ).

Have any ideas about this one? I probably will have to add an external oscillator if i set the "divide freq by 8" option on.

as delivered the atmegas are set for internal oscillator and "divide by 8". I don't know why you'd be seeing 16 but get rid of the divide-by-8 and see if the issue goes away. You can do that with avrdude by resetiing the ckdv8 fuse - i don't have the setting right to hand but if you look in that same boards.txt you'll see the ones for the lilypad 328 and they should work.

Oh noes! i set it the way lilipad has it but according to this page (http://www.engbedded.com/fusecalc/) that fuse setting requires an external oscillator and now my atmega doesn't respond anymore. I think that sticking an external oscillator will fix it.

oh noes.

oops. I didn't know the lilypad used a crystal. too bad.

oh well, at least I know why the 16:1.

The chip you're using is running at 8mhz as above. The entry you're using in boards.txt is meant for a standard arduino with a crystal at 16mhz.

You might want to make your own entry in boards.txt. Just copy whatever you've been using and change all the details to suit your setup. next time you start the arduino ide it will show up in tools/boards.

and you're more than welcome for the help. I've gotten acres of help from this board and I'm happy to give any assistance I can.

works like a charm! with the 16MHz external resonator it goes on and off for 1 second. BTW i found the freq entry in the boards.txt file: atmega328.build.f_cpu=16000000L

Thank you for all your help! Couldn't have made it without it! :)

One last thing: should i tell the "arduino guys" about the modification i had to make to the boards.txt file in order to make it work?

One last thing: should i tell the "arduino guys" about the modification i had to make to the boards.txt file in order to make it work?

maybe on sparkfun? I think someone there might appreciate knowing how to run the arduino ide with that programmer.