Go Down

Topic: Serial Programmer Atmega328p (Read 5125 times) previous topic - next topic

I'm trying to design a super cheap programmer. I have a USB to RS232 adapter, and a Max232 chip. I used http://chuckontech.com/?p=147 as a guide to configure my Max232, I also put the chip in echo mode (connecting pins 9 and 10 together), sent commands with Putty and got them back. Now I am trying to tie the Max232 to the TXD and RXD pins of my Atmega328p to program it, but it does not seem to work. It is a blank IC (no bootloader or anything). I've tried using AVRDude to write to the chip, read from it, and even erase it, but I cannot seem to get communication going between my computer and the Atmega. Can someone help me out with this? Could my Atmega328p be bad?

CrossRoads

"It is a blank IC (no bootloader or anything). "

Need a bootloader first or it won't talk to the serial port for sketch downloading.

Bootloader is installed over the SPI pins: SCK, MISO, MOSI, Reset, +5, GND.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

johnwasser

You can't upload sketches to the serial port if you don't have a bootloader installed.

If the USB-to-Serial chip you have is an FTDI chip like on the Arduino Diecimila or Duemilanove then you might be able to use the FTDI chip as a "bitbang" serial programmer:  http://arduino.cc/playground/Hacking/AvrdudeFTDIBitbang

It's going to be hard to produce a programmer that can sell for less than $4 like the USBasp programmers available from HongKong.  Yes, that $4 includes shipping to the USA:

http://www.ebay.com/sch/i.html?_nkw=usbasp&rt=nc&_pppn=r1&_mPrRngCbx=1&_udlo&_udhi=4
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

CrossRoads

But if you do, you can deliver a lot faster then delivery from China.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

I was under the impression that the boatloader was only needed if you wanted to program wit the Arduino IDE. If I just want to upload HEX files made from AVR-C with AVRDude I still need a boatloader installed?

CrossRoads

You would load that HEX file thru the same SPI pins as installing a bootloader: SCK, MOSI, MISO, Reset, +5, GND, using an AVR ISP programmer and the IDE's File:Upload Using Programmer selection (or perhaps AVRDUDE can do that too).
Easier (in my opinion) to just select File:Upload Using Programmer in the IDE after compiling/error checking.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Makes perfect sense now, thanks for the clarification!

I finally got my USBASP (the one from China never came so I ordered one from within the US) but now I am having trouble with it. I connected it and got the drivers installed, but when I tell AVRDude to use it, it comes back and says: avrdude: error: could not find USB device "USBasp" with vid=0x16c0 pid=0x5dc
When I go into device manager and look at the properties of the USBASP it does indeed have vid 0x16C0 and pid 0x5DC, so I am not sure what the problem is.

CrossRoads

Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.


CrossRoads

You may have to add an entry to programmers.txt.

This is what I needed for this programmer:
http://www.mdfly.com/index.php?main_page=product_info&cPath=5&products_id=415

Code: [Select]

usbasp.name=MDFLY
usbasp.protocol=usbasp


I don't know what it'd be for yours.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

That didn't do anything. I've tried burning the bootloader with the Adruino IDE, I've even tried running AVRDude from command prompt just sending the erase command. Is there something I can do to test my programmer to make sure it is even working? Like I said before Windows 7 detects it fine and the drivers are installed.

Christo


That didn't do anything. I've tried burning the bootloader with the Adruino IDE, I've even tried running AVRDude from command prompt just sending the erase command. Is there something I can do to test my programmer to make sure it is even working? Like I said before Windows 7 detects it fine and the drivers are installed.

You could ask AVRDUDE to list some signatures of the chip:
Code: [Select]
avrdude -p m328p -c usbasp -U lock:r:lock.txt:h -U efuse:r:efuse.txt:h -U hfuse:r:hfuse.txt:h -U lfuse:r:lfuse.txt:h -U signature:r:signature.txt:h

I'm not sure whether you need to specify the port for a USB device (-P usb).

Still nothing :-/
I also noticed if I launch AVRStudio and open its burning tool it does not list anything but the virtual testing tool.

I plugged my programmer into a Linux machine and tried running it from there, same error. So it doesn't seem like a driver issue. Could my programmer simply be bad?

Go Up