Pages: [1] 2   Go Down
Author Topic: Serial Programmer Atmega328p  (Read 4304 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 524
Posts: 26420
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

"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.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 201
Posts: 8684
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 524
Posts: 26420
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

But if you do, you can deliver a lot faster then delivery from China.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 524
Posts: 26420
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Makes perfect sense now, thanks for the clarification!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 524
Posts: 26420
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Which one did you get?
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

http://item.mobileweb.ebay.com/viewitem?itemId=170912513888
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 524
Posts: 26420
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
usbasp.name=MDFLY
usbasp.protocol=usbasp

I don't know what it'd be for yours.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

South Africa
Offline Offline
Newbie
*
Karma: 1
Posts: 46
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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).
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1] 2   Go Up
Jump to: