Programming Methods

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello everyone,

I have one of the crappy AVRISP mkI programmers with a prolient usb-rs232 chips in it and it worked, then didn't, then did, and now its dead. The prolient chip is terrible so I will just rob the mcu off it for some random project.

Now im faced with how I am going to program my chip (mega146). I have seen the paralel port one with 4 resistors but im worried without any buffers it would be dangerous. Helpful for fuse resetting but since im using a laptop and pcmcia card im not even sure if my 9V will do HVPP properly.

Their is the serial/ICSP methods, I have seen one with two zeners and a transistor but im not sure of its quality. I have a max232 breakout board with rx/tx/cts/rts available but im not sure how to hook it up to the avr to program this way. (I know the max232 inverts its signals but ponyprog can compensate for that)

Alternative method is to use a bootloader and the max232 hooked up to the avr's usart. I have seen STKLoad http://hubbard.engr.scu.edu/embe... but it doesn't have a hex for my atmega164 is their another one I can use?

So can anyone recommend a good cheep solution for me? Im in school now and only have the parts at my local store so only 74 series cmos and zeners really.

Thanks

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A bootloader would probably be the most reliable solution. There are several in the project section here. Two really good ones from "danni" and "stevech". You should be able to rebuild either for a 146.

As for the parallel thing - to see the potential pitfalls and solutions are given here:

https://www.avrfreaks.net/index.p...

But as you seem to be located in a western country wouldn't the simple idea be to just spend US$34 on a real AVRISPmkII?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
A bootloader would probably be the most reliable solution.

But then you will still need to get the bootloader into the chip, so you will need something else at least once.

Regards,
Steve A.

The Board helps those that help themselves.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you still have a real parallel port, the parallel port programmers with a buffer chip are not that bad. Just take care of cable length and similar things. But this is likely only a temporay fix until the next PC. There is a very lengthy tutorial on these:
https://www.avrfreaks.net/index.p...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the replies, Im going to make a parallel port programmer with the buffer in Plons post. the most expensive part will be the 25pin connector but my laptop is 18" away from my avr so I don't think I will have any problems with cable length. (im using the well filtered and current limited schematic)

The reason I can't buy an AVRISP mkII is im in school and the mkII equates to not having eggs and cheese for three weeks while $3-4 I can get from the dryer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I just started building the serial programmer from olimex and hooked it up on my laptop with my usb-rs232 (with full rts/cts capabilities) and ponyprog wont read or write anything.

So I went to my desktop that has two onboard serial ports. I found COM1 by plugging in my max232 breakout and shorting rx/tx and I get loopback.

I plugged in the avr-pg1B and put my scope (Tek 2225 - 2ch 50mhz) applied power to my programming board without a chip. I get 5V at ICSP pin 2 and GND on ICSP 4/6/8/10 as one wants. I put my scope on pin7 (SCK) and pin1 (MOSI)

I then load pony prog and ignore the errors and do read/writes and watch the pins and I get nothing but noise on SCK and MOSI toggles from -12 to +12 about 10times then goes to +12 and alot of noise.

What am I doing wrong here? pony prog is set up as spi prog api - com1 and im using a 3ft serial cable.

Does anyone know a good serial port checker that will allow me to set each pin individually to make sure my port works correctly? Other than that I can only guess that pony prog cant access the hardware right.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I then load pony prog and ignore the errors and do read/writes and watch the pins and I get nothing but noise on SCK and MOSI toggles from -12 to +12 about 10times then goes to +12 and alot of noise.

SCK and MOSI toggles from -12 to +12(V)?

It appears that Zeners Z1 and Z2 are not connected, as shown in the olimex schematic avrprog_sp.gif
and the AVR was not in circuit during the test?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The avr was not in the cct no. The zerners are there to clamp the voltages to +5.1V I was just measuring before them to verify the ports output. With an avr is in the socket it gives the same VERY noisy signals and CLK only runs a few times then stays high.

Whats the usual sequence for programming. I would imagine RESET is held low, clock is a consistant square wave for the duration and serial data in on MOSI then reset. on the read command same thing except data on MISO.

Right now Reset is always high (serial pin 4 doesn't toggle) serial pin 6&7 (CLK) toggle ~10times irradicly on the scope and then fuzzy noise on MOSI while the clock stays high.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Whats the usual sequence for programming. I would imagine RESET is held low, clock is a consistant square wave for the duration and serial data in on MOSI then reset. on the read command same thing except data on MISO.

Read the data sheet? Look for the section titled "Serial Programming Algorithm."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hmm RTFM sometime I forget that one... Didn't actually learn much from it but I didn't even know that section was in there...

I found a terminal program called VBHexTerm that has all 9 pins with lights on them and 3 user settable and I discovered that my serial cable is nowhere near wired standard. I have all the pins on one end out of the header for easy breadbording so I tested and shorted pins and found their right spots.

I now have CLK, MOSI, MISO and RST in their proper places but their is still a few issues them being:

RST - Pin 3 never changes state. It pulses quickly ~100kHz but with like a 1% duty so its probably just noise. To program I know i need to pull RST low so I just jumpered it to gnd.

The CLK and MOSI signals are terribly noisy here is a pic with what im getting out of my scope. Ive tested a knowen signal and scope displays it fine so I know this is actual noise. I have scopes front ground to the sheath of the serial cable and my probe ref to pin 5 (gnd)

Bottom line is SCK, DC coupling, 2V/div upper is MOSI, DC Coupling, 2V/div, 50us/div

Attachment(s):