Hey guys, I went out and bought an Atmega328p chip that contains the Uno Bootloader. I didn't have enough for an Arduino board or anything, I have it in the Breadboard at the moment with the two caps and crystal. Is there any way to play with it, program it, with a few jellybean parts and the serial/parralel port? I don't know if it would help at all, but I have a Picaxe serial->3.5mm Jack programmer. But yeah, dunno when I can get my hands on a programmer board, so if I could get it programmed by any means now, that would be awesome.
All you need is some way of connecting a serial (RS-232) signal to the chip.
Most people use a cheap USB->TTL RS-232 dongle (about $2.50 on eBay). The other option is an RS-232 to TTL converter, which consists of a DB9 connector, a MAX232 chip, and some capacitors.
Do not connect the chip directly to an RS-232 port on a computer. Those ports can generate up to +/- 12V which will blow up your chip.
So there's no way to program it with jellybean parts? I was kind of hoping I could just hook it up via serial directly with a resistor or two, but I guess not. How about the parallel port?
Or will I just have to wait until I purchase a Uno bored?
You can make an RS-232 to TTL converter with "jellybean" parts, but it's not a simple task.
The RS-232 protocol uses -5 to -12V for a HIGH, and +5V to +12V to +12V for a LOW. TTL uses +5V for a HIGH and 0V for a LOW1. So you'd need to invert the signals somehow, and limit the voltages. Tricky to do properly, which is why the MAX232 chip exists.
I would suggest hitting eBay and getting a USB->TTL dongle. There's millions of them out there and they're dirt cheap. Basic ones just provide the TX and RX signals, so you will have to manually reset the chip at programming time to enter the bootloader (takes practice to get the timing right). More expensive ones based around the FT232 chip can have the DTR signal available, which you can connect to the reset pin of the ATMega328p chip through a 100nF capacitor to auto-reset the chip to make programming easier.
1 Yes, I know, <0.8V for LOW and >1.2V for HIGH is the real TTL values, but 0V and 5V is enough for most people on this site to know. Terry Pratchett calls this "Lies To Children"
haha thanks. I will save up for one, but I'll build this circuit now!
Could you maybe give me a quick summary of programming it? I know how to write my first program, I assume I just connect the Tx and Rx up to the chip, and hit program on the PC?
I'm downloading the IDE now, I've never even used that. Do I just ground the reset pin or something to initiate programming?
I know these answers are probably available, but I'm not sure if it would be the same for the method I'm using, and just wanted to be sure. Any help appreciated.
Connect RESET to +5V through a 10K? resistor, and to ground through a pushbutton.
Press the button to reset the chip and enter the bootloader at the right time just after pressing the "upload" button in the IDE (as soon as it tells you how big your sketch is).
Oh, and don't forget the 100nF decoupling capacitors on the power pins of the chip.
Looong time back I used similar circuit with one exception (and maybe an issue with your above design): the -12V for transmitting (or better to say something around -6V) was generated from PC's side Tx signal via a diode and a 100uF capacitor.. So the Tx signal from the interface towards PC was +5/-6V. I think you may still google it somewhere..
Yea - still alive: https://web.archive.org/web/20210506195922/http://www.uchobby.com/index.php/2007/06/11/ttl-to-rs232-adaptor-explained/
Edit typos
Ok I have completed the circuit... As expected, I can't seem to get it to upload. I'll continue to check things, but do I have to configure the IDE for serial at all?
I just opened the blinking LED example program, and I get:
avrdude: stk500_getsync(): not in sync: resp=0x30
I'll continue to look for issues with the circuit, but yeah... Hmm..
For uploading you only actually need the Rx part of the serial circuit.
Have you confirmed that your circuit correctly converts the RS232 active and inactive states to the corresponding TTL states?
Do you know what frequency the 328p is running at? (Do you even know for sure that your circuit is complete? If it's configured to use an external clock and you don't provide one, you're wasting your time.)
I've built the exact circuits, for the programming and building it on the breadboard. Every component is exact, and I don't know if a /8 fuse is set or not, not even sure what that is yet (Second day with Arduino today)
All I know is I have built both circuits exactly the same (Programming and running the chip on the BB) and that I'm using a Uno chip pre-loaded with the boot loader that came with the 16Mhz Crystal.
He may have other issues there as well. His PC rs232 may not accept positive only serial, looping via the interface is not a validation it works. I had spent ages with pushing the reset button, but resigned finally. One record of mine was 35 minutes of messing with the reset button in order to push single upload over (via a BT I must admit)..