Atmega328pu standalone upload sketch via Usbasp..how can i do it;

Atmega328pu Chip already bootloaded,can i program it with a usbasp programmer?
Hello everybody,i purchased some atmega328pu chips for a DIY projects (arduino bootloaded) ,just to get little space for my projects,I have already done with the chip part and im stucked on the Usbasp programming,i purchaces a programmer from e bay.

https://www.protostack.com/download/Users%20Guide%20(AC-PG-USBASP-UG-V2.0).pdf

I found the pinout for this programmer,and i attacked 4 cables on my atmega328pu chip, TX,RX,VCC,GND,also i installed the drivers from the site,And now im going onto arduino IDE,and i cant find a port to upload my sketches,nothink seems to communicate,and i got stucked here,i need some help Thank you.. (sorry for my bad english)

P.S Im a new guy on programming and chip stuff :smiley:

I have never heard of a USB Asp that acts as a USB serial converter (and I note that no part of that PDF says anything about it acting as a serial port) - I think it's only able to do ISP programming.

I think you're going to need a separate USB serial adapter.

Of course, you can upload sketches by connecting it like an ISP programmer, and doing Upload using programmer, but this erases the bootloader - and that won't give you the serial monitor, which you probably want.

You can program already bootloaded chip with USBasp but the bootloader will be lost. If you will need the bootloader again, it can be loaded with USBasp. The device you've posted should be ok but you have to connect it to the ICSP on ATmega (see the datasheet) MOSI, MISO, SCK, RST, VCC and GND (section 2.2 in UG). Forgot TX, RX.

DrAzzy:
I have never heard of a USB Asp that acts as a USB serial converter (and I note that no part of that PDF says anything about it acting as a serial port) - I think it's only able to do ISP programming.

I think you're going to need a separate USB serial adapter.

Of course, you can upload sketches by connecting it like an ISP programmer, and doing Upload using programmer, but this erases the bootloader - and that won't give you the serial monitor, which you probably want.

Okay,so if i want to upload sketches with usbAsp i need an extra Usb serial converter?.Then i will be able to program my atmega through Arduino ide without erasing every single time the bootloader?

Budvar10:
You can program already bootloaded chip with USBasp but the bootloader will be lost. If you will need the bootloader again, it can be loaded with USBasp. The device you've posted should be ok but you have to connect it to the ICSP on ATmega (see the datasheet) MOSI, MISO, SCK, RST, VCC and GND (section 2.2 in UG). Forgot TX, RX.

what should i do to program my atmega without erasing bootloader,i mean what component do i need?if i connect it like you told me ") MOSI, MISO, SCK, RST, VCC and GND" to the right pinouts will i be able to program my atmega through arduino ide? even if erase the bootloader..?

As DrAzzy wrote, you need USB/serial converter (e.g. for a dollar from ebay). In this case you have to use RX,TX and DTR<->RESET. It is Arduino native programming via serial port. The bootloader is needed to be loaded.

With the USBasp it is ISP programming without the bootloader need. IDE has an option Tools->Programmer->USBasp.

kaloudis94:
if i connect it like you told me ") MOSI, MISO, SCK, RST, VCC and GND" to the right pinouts will i be able to program my atmega through arduino ide? even if erase the bootloader..?

If this is all you want to do, you can use the Arduino IDE. First select "USBASP" under >Tools >Programmer, then select >Sketch >"Upload Using Programmer".
If using a totally blank chip, with no bootloader, burn a bootloader first to set the chip's fuses, then do as I describe above. The bootloader will be overwritten as explained by Budvar10, but the fuse settings will remain.
Don't forget that you need to connect an external crystal or ceramic resonator to the chip.

Thanks everybody for your answers.but still after all your advises my chip wont program cause i get an error on the communication..i selected evetythink you said and i still cant communicate with my chip to flash the program.one more thing..what are the dissadvantages of not using a bootloader and what the advantages;; how can i use serial monitor without the bootloader;; thaanks for your time

Im getting this erro " avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x03 "

DrAzzy:
I have never heard of a USB Asp that acts as a USB serial converter (and I note that no part of that PDF says anything about it acting as a serial port) - I think it's only able to do ISP programming.

I think you're going to need a separate USB serial adapter.

Of course, you can upload sketches by connecting it like an ISP programmer, and doing Upload using programmer, but this erases the bootloader - and that won't give you the serial monitor, which you probably want.

i had been trying to figure out why the board i designed my self wasnt working i had tried everything i had no idea the bootloader got erased when you uploaded with an isp i had been uploading a blink sketch with the isp to show it was working ( i dont have an led on pin 13 ) . Thank you for your help

kaloudis94:
Thanks everybody for your answers.but still after all your advises my chip wont program cause i get an error on the communication..i selected evetythink you said and i still cant communicate with my chip to flash the program.one more thing..what are the dissadvantages of not using a bootloader and what the advantages;; how can i use serial monitor without the bootloader;; thaanks for your time

Im getting this erro " avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x03 "

If you want to use the serial monitor and keep the projects tied to the PC after you've finished developing them, then perhaps USBASP isn't for you after all. Set up a USB to serial interface, or perhaps you should just stick to the Arduino IDE if you don't know what you're doing.

If you only want the serial monitor for debugging, you can develop your code in Arduino, then load it into a chip with USBASP without a bootloader.

but still after all your advises my chip wont program cause i get an error on the communication.

I think you should draw your schematic diagram and show us if you want more help.

kaloudis94:
what are the dissadvantages of not using a bootloader and what the advantages

i find using isp with usbasp is simpler and easier than bootloader. most arduino people believe the opposite. unlike bootloader it works with all chips and is much faster. to program you use isp wires (miso/mosi/sck/reset). serial wires (rx/tx/dtr) dont work for this which is what you seem to be trying to do.

rx/tx wires on usbasp are used by some chinese for serial monitor but not documented or popular here in the west. afaik never worked for download or with windows.

for arduino bootloader you must use one of the cheap ebay type serial/usb converters. I find cp2102 has advantages over the other 2 types.

john1993:
I find cp2102 has advantages over the other 2 types.

I'll second that. One advantage is that you can very easily run multiple CP2102 devices at once and use the Silicon Labs software tool to give them unique names and serial numbers to avoid conflicts. The unique names are useful in 'Device Manager', to easily identify which is which.

Still, like you John, I like programming with USBASP if I don't need the serial monitor. That's most of the time - my projects usually don't want a permanent PC connection, they're 'stand-alone'.
And the benefit of no bootloader is a little more code space.
(The title of the thread did say "standalone", after all.)

I think it goes little bit to theoretical discussion so I would like also add. We have to remember that serial programming was actual long time before USB. If we compare serial and ISP, serial doesn't require such complicated device as ISP programming does. USBasp is on 'market' just short time and it is cheap but before there were only expensive programmers and it could be one of reasons why Arduino exists. Anyway, Arduino is mainly development platform and in my opinion its use is very simple and very good for beginner but it pay with some memory space. USBasp is very cheap and handy device but ISP programming seems to me little bit more advanced. It better fits by my opinion to 'final' not development board. The bootloader on UNO requires only 512B. Is it much? If somebody requires more memory he can move to other ATmega. I am using ATmega1284P but still never used more than 50% of flash (HVAC applications). I think that many people's programming skills waste a memory. There is still the room for improvement.

Budvar10:
Anyway, Arduino is mainly development platform and in my opinion its use is very simple and very good for beginner but it pay with some memory space.

Yes, it's great for beginners, easy to learn and easy to use.

USBasp is very cheap and handy device but ISP programming seems to me little bit more advanced. It better fits by my opinion to 'final' not development board.

This is true. I personally use the Arduino IDE with a bootloader for development, then use USBASP for uploading the code to the chip for the 'final' version. I made a small board with a ZIF socket to go with the USBASP. I don't like removing and fitting chips in and out of the Arduino's dual-wipe IC socket. A ZIF socket is far easier, with virtually no risk of bending/breaking pins.

I think this thread took a wrong turn :slight_smile: And confused the Original poster more that he already is.

@kaloudis94
While a schematic of your intended circuit would be very helpful, here are some things you should be aware. The reason you need the bootloader in the first place is to be able to program the ATMega chip using the internal UART, ie Rx and Tx pins.
Since you have an external programmer you really do not need the bootloader. In order to program the chip using the external programmer, you need to connect the right pins between the programmer and the chip together. Those being RESET, MOSI, MISO, SCK, 5V and GND.

When you have those connected, load the Arduino IDE, go to Tools and select board Arduino UNO and then select the right programmer. You should now select "Burn Bootloader". This is only required so that the right fuses are burned on the chip (Clock selection, Brown out voltage, Clock speed, etc).
You can now

You can now write and burn your program to the ATMega chip. After you are done, disconnect the chip form the programmer and put it in your own circuit. Note that this way, the chip will need +5V and a 16MHz crystal connected on your board to be able to operate.

Hope it helps,

Nikos

nikosk:
I think this thread took a wrong turn :slight_smile: And confused the Original poster more that he already is.

@kaloudis94
While a schematic of your intended circuit would be very helpful, here are some things you should be aware. The reason you need the bootloader in the first place is to be able to program the ATMega chip using the internal UART, ie Rx and Tx pins.
Since you have an external programmer you really do not need the bootloader. In order to program the chip using the external programmer, you need to connect the right pins between the programmer and the chip together. Those being RESET, MOSI, MISO, SCK, 5V and GND.

When you have those connected, load the Arduino IDE, go to Tools and select board Arduino UNO and then select the right programmer. You should now select "Burn Bootloader". This is only required so that the right fuses are burned on the chip (Clock selection, Brown out voltage, Clock speed, etc).
You can now

You can now write and burn your program to the ATMega chip. After you are done, disconnect the chip form the programmer and put it in your own circuit. Note that this way, the chip will need +5V and a 16MHz crystal connected on your board to be able to operate.
Hope it helps,
Nikos

This has [/b]all[/b] been said already.

lol. i love how posts are parroted in attempt to "clear up confusion" but usually just cause more. tmi is the phrase i think.

just to carry on that policy i will repeat that after trying both programming methods for me isp comes out on top in terms of simplicity and certainly speed. also note that isp is required for ALL chips before a boot can even be installed. for many avr, specially smaller tiny series, bootloaders are not even an option.

so worth noting that cost of a usbasp is less than that of a usbasp plus serial adapter. smart hobbyist of course will stock more than one of each considering how cheap they are.

on those rare occasions when an led does not suffice for debugging then serial does come in handy. even then i personally prefer isp for the programming part for reasons mentioned. i suspect those who disagree do so more out of ritual/tradition than efficiency or economy. "because thats the way its done!"

john1993:
for many avr, specially smaller tiny series, bootloaders are not even an option.

That's the other reason I use ISP programming - I use ATtiny85s a lot, and wouldn't dream of installing a bootloader on them.

on those rare occasions when an led does not suffice for debugging

I come from a PIC programming background, and have used LEDs successfully for debugging for many years. Also, more often than not I'm working away from the computer, too far for a serial cable, so a LED is more suited to the purpose.

ha... great minds think alike.

regarding t85 there are actually some available and ive even written a couple but dont use them myself. t13 with room for only 512 instructions... as the guard said to dorothy, thats a horse of a different color. truth is MOST avrs do not have a bootloader available.

Hello Guys, I think the original question resides on the pinout of UISBASP. It HAS a txd and a RXD. If we have a TXD, RXD and a RST (hope it can be a DTR...) Has anyone tried this way? I recently bought a USBASP board and confess never used it yet. I use to do it with a "big" programmer or a buffered TX/RX/DTR to USB adapter.