Go Down

Topic: Atmega328pu standalone upload sketch via Usbasp..how can i do it; (Read 1 time) previous topic - next topic

kaloudis94

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%28AC-PG-USBASP-UG-V2.0%29.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 :D

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.
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

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.
Arduino clone with ATmega1284P   http://forum.arduino.cc/index.php?topic=277260.0

kaloudis94

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?

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..?

Budvar10

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.
Arduino clone with ATmega1284P   http://forum.arduino.cc/index.php?topic=277260.0

OldSteve

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.
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

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 "

simon100

 
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

OldSteve

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.

Quote
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.
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

john1993

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.

OldSteve

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.)
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

Budvar10

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.
Arduino clone with ATmega1284P   http://forum.arduino.cc/index.php?topic=277260.0

OldSteve

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.

Quote
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.
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

nikosk

I think this thread took a wrong turn :) 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


OldSteve

I think this thread took a wrong turn :) 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.
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

Go Up