Offline
Newbie
Karma: 0
Posts: 8
|
 |
« on: August 20, 2012, 02:05:50 pm » |
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
Online
Brattain Member
Karma: 242
Posts: 16504
Available for Design & Build services
|
 |
« Reply #1 on: August 20, 2012, 02:25:37 pm » |
"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
|
|
|
|
|
Massachusetts, USA
Offline
Tesla Member
Karma: 96
Posts: 6367
|
 |
« Reply #2 on: August 20, 2012, 02:26:10 pm » |
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
|
|
|
|
|
Global Moderator
Boston area, metrowest
Online
Brattain Member
Karma: 242
Posts: 16504
Available for Design & Build services
|
 |
« Reply #3 on: August 20, 2012, 02:30:37 pm » |
But if you do, you can deliver a lot faster then delivery from China.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 8
|
 |
« Reply #4 on: August 20, 2012, 07:10:08 pm » |
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
Online
Brattain Member
Karma: 242
Posts: 16504
Available for Design & Build services
|
 |
« Reply #5 on: August 20, 2012, 07:46:19 pm » |
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
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 8
|
 |
« Reply #6 on: August 20, 2012, 08:19:54 pm » |
Makes perfect sense now, thanks for the clarification!
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 8
|
 |
« Reply #7 on: September 23, 2012, 06:21:59 pm » |
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
Online
Brattain Member
Karma: 242
Posts: 16504
Available for Design & Build services
|
 |
« Reply #8 on: September 23, 2012, 07:58:37 pm » |
Which one did you get?
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 8
|
 |
« Reply #9 on: September 23, 2012, 08:16:16 pm » |
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Boston area, metrowest
Online
Brattain Member
Karma: 242
Posts: 16504
Available for Design & Build services
|
 |
« Reply #10 on: September 23, 2012, 10:01:12 pm » |
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=415usbasp.name=MDFLY usbasp.protocol=usbasp
I don't know what it'd be for yours.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 8
|
 |
« Reply #11 on: September 24, 2012, 12:03:49 am » |
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
Newbie
Karma: 0
Posts: 30
|
 |
« Reply #12 on: September 24, 2012, 05:56:47 am » |
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: 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
Newbie
Karma: 0
Posts: 8
|
 |
« Reply #13 on: September 24, 2012, 11:15:00 am » |
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
Newbie
Karma: 0
Posts: 8
|
 |
« Reply #14 on: September 25, 2012, 12:35:48 pm » |
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
|
|
|
|
|
|