Serial Bit-bang Programmer w/ MAX232

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

I'm trying to make a serial + parallel port programmer. The parallel port is just the schematic taken from here:

http://www.xs4all.nl/~sbolt/Images/icp_interface.gif

The serial port addon just connects the reset, sck, miso and mosi lines through a couple max232's (the 2nd one is for the 3rd receive line). The reason I wanted to make it this way is because I already had those parts kickin around and by making a serial bitbang one instead of the serial ones that require additional firmware (like the asp910) I'm not limited to the chips that they support as long as avrdude supports them. (Note that both the serial and parallel connections are present at the same time on my programmer)

From the diagram on that page, I also connected

DB9-pin3 -> MAX232(1)-pin13(R1In)
DB9-pin4 -> MAX232(2)-pin13(R1In)
DB9-pin5 -> GND
DB9-pin7 -> MAX232(2)-pin8(R2In)
DB9-pin8 -> MAX232(2)-pin11(T1In)

Reset -> MAX232(1)-pin12(R1Out)
SCK -> MAX232(2)-pin9(R2Out)
MOSI -> MAX232(2)-pin12(R1Out)
MISO -> MAX232(2)-pin14(T1Out)

So basically it's
- DB9(3)->Level Shifter->Reset
- DB9(4)->Level Shifter->MOSI
- DB9(5)->GND
- DB9(7)->Level Shifter->SCK
- MISO->Level Shifter->DB9(8)

Those are the spects that are given in avrdude's configuration for the ponyser serial bit-bang programmer.

The problem is that the serial connection doesn't seem to work. The parallel one works fine on my desktop. However, the parallel port on my laptop is busted so I want the serial support as well.

I put the programmer on a scope and the SCK signal seems nice and clean at ~20kHz. The MOSI also seems clean and is adjusted properly relative to the clock. The reset also is driven low during the programming period. However, the MISO line looks like it isn't being driven properly. The scope traces from it look like it just gets bumped around a little on each SCK pulse (ie. oscillates with SCK to <1V) and isn't driven to the proper voltage by the avr.

Another thing I noticed is that the programmer seems to invert the signals on MOSI. The programming command is 0xAC530000 and on the line I see 01010011101011001111111111111111 or 0x53ACFFFF which is the inverse of the command in the spec. Is the pin supposed to be driven high or low to signify a 1? I assume high and this is somehow inverted, but I've tried switching the avrdude.conf to show ~4 to invert MOSI and still have no success.

Can anyone see any other problems with setting up the programmer this way or doesn't anyone know of another serial-bb programmer using level shifters instead of transistors that's known to work with avrdude?

Clancy _________________ Step 1: RTFM Step 2: RTFF (Forums) Step 3: RTFG (Google) Step 4: Post

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

Has anyone made a serial bitbang programmer with a max232? If not, any recommendations for a serial programmer with support for the newer avr's? (specifically tiny84, tiny85, mega48/88/168)

Clancy _________________ Step 1: RTFM Step 2: RTFF (Forums) Step 3: RTFG (Google) Step 4: Post

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

One option would be to go grab a Butterfly now that they're in stock over at Smokey's site.

Your US$20 gets you a fantastic development platform to play with (integrated LCD, joystick, buzzer, etc) which in itself is invaluable, but it can also be made into a very fast AVRStudio compatible programming using my ButtLoad firmware. Only a level shifter circuit is needed (schematics included), can be built without another programmer and supports the entire AVR range.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

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

I appreciate the help, but I wanted more to make one myself. Hopefully I can figure out what's making the one I have fail. Don't see why it shouldn't work.

Clancy _________________ Step 1: RTFM Step 2: RTFF (Forums) Step 3: RTFG (Google) Step 4: Post

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

Isn't it kind of unsual to put a MAX232 on a serial bit-bang ISP interface? You do realise that the MAX232 will invert the signals don't you? I think most programming software driving RS232 pins from the PC to do ISP to an AVR (such as avrdude) will not expect the signals to be inverted.

The link you gave above only shows a parallel interface ISP programmer, where is the schematic for the serial interface you've built?

Cliff

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

The schematic is basically described above. It's just:

Quote:
- DB9(3)->Level Shifter->Reset
- DB9(4)->Level Shifter->MOSI
- DB9(5)->GND
- DB9(7)->Level Shifter->SCK
- MISO->Level Shifter->DB9(8 )

I didn't realize until now that the max232 translates positive voltage on the rs-232 line to logic low and vice versa. However, even with that, I should be able to just invert all the pins with avrdude, no?

I've tried pretty much all the combinations of inverting pins with no success =/

Is there a problem using the max232 assuming I can invert the pins with avrdude? The only reason I built it that way instead of using transistors is that I had the 232's kickin around already.

Clancy _________________ Step 1: RTFM Step 2: RTFF (Forums) Step 3: RTFG (Google) Step 4: Post

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

Also, what's the advantage to using one of the other serial isp's instead of a serial port bitbang? The serial bitbang involves less hardware and is fully controllable by the software so wouldn't it be just as good as the same simple parallel port bitbang programmers?

Clancy _________________ Step 1: RTFM Step 2: RTFF (Forums) Step 3: RTFG (Google) Step 4: Post

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

I am currently trying to get an essentially identical setup to that working, and am also having no success. My plan is to rebuild my parallel programmer and use it to program an attiny to use with a single max232 as a programmer. I'd rather not do that, but I guess I don't have much of a choice.

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

I eventually gave up on the max232 and went to the 5v1 zener solution. Works like a charm. I don't know exactly why the max232 wasn't working, as since you can invert pins with avrdude, it should be fine with the correct setup.

In any case, the serial one I ended up making was this:

http://www.olimex.com/dev/images/avr-pg1b-sch.gif

I put that one and this one:

http://www.xs4all.nl/~sbolt/Images/icp_interface.gif

into the same programmer so I can switch between serial and parallel ports as I wish (reason being parallel port is faster, but only my desktop has it and my laptop needs serial).

For the cost of a few zeners and a few resistors, it ended up being much smaller at a fraction the price and works like a charm with avrdude (use "ponyser" programmer).

Clancy _________________ Step 1: RTFM Step 2: RTFF (Forums) Step 3: RTFG (Google) Step 4: Post

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

clpalmer wrote:
Also, what's the advantage to using one of the other serial isp's instead of a serial port bitbang? The serial bitbang involves less hardware and is fully controllable by the software so wouldn't it be just as good as the same simple parallel port bitbang programmers?

Yes, with caveats.

First, bitbanging programmers are all more sensitive to noise (interference, ringing, etc) than the intelligent serial programmers. The cables cannot be allowed to get as long as they could be with an "intelligent" programmer on the other end. And extra care may be needed for designing the hardware to behave reliably.

RS232, when used in conjunction with the oversampling receivers in most UARTs, results in very good performance despite moderate amounts of noise. With the bitbangers, any unexpected zero-crossing may potentially be misinterpreted as a clock or reset pulse, thus corrupting the ISP process.

Second, many computers (especially laptops) are shipping today without any legacy ports (parallel or serial) at all.

For those machines, you could buy a real serial or parallel ports which are installed through (eg) PCMCIA cards. Such a solution should be indistinguishable from communicating using a built-in legacy port.

Or you could go for a USB device.

USB->parallel port dongles really only work well for connecting to printers; you typically cannot use them to for bitbang AVR programming.

USB->RS232 dongles are *mindblowingly* slow for ISP bitbanging. They run at nearly full-speed for the more "intelligent" ISP programmers.

Of course, your best performance on a USB-only system would probably come from a native USB solution such as the Dragon, AVRISP mkII or JTAGICE mkII.