Don't throw away those banned USB-Serial just yet! Part 2!
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Don't throw away those banned USB-Serial just yet! Part 2!

by eventhorizon on Wed Jan 09, 2013 2:01 pm

Okay, now this is much more interesting than my previous post. Before, it was a fact that when you want to use a USB-to-Serial adapter to be able to use a serial programmer such as "ponyser", "dasa3", etc.. you'd have to use a PL2303 based USB-Serial adapter, and banned based adapters are a no-go. Recently I have been playing with mine, and, to my surprise, I was able to program an AVR. The problem is that banned based adapters are "TTL" and because of this, it uses the "inverted logic" that of an RS-232 (+12v = 0, -12v = +5v).

The big question is how did I do it? First, I made a new programmer entry to the avrdude.conf:

Code: Select all | TOGGLE FULL SIZE
#banned based USB-Serial/TTL adapters.
  id    = "banned";
  desc  = "ttl port banging, reset=txd sck=!rts mosi=!dtr miso=!cts (invert signals using 74ls04)";
  type  = serbb;
  reset = 3;
  sck   = 7;
  mosi  = 4;
  miso  = 8;

If you notice the description, the inverted pins are *not* actually inverted on the configuration, this is because you need to invert it using a NOT Gate (TTL-Logic is inverted RS-232 remember? So I used a 74ls04 on mine). The reason why the inversion of the pins are done by hardware, and not by the config file, is because the pin-state of the 2 important programmer outputs (SCK and MOSI. RST can be manually set.) are HIGH by default. I also noticed that the signals are not giving a clean HIGH and LOW states while the programmer is reading the AVR (with the 74ls04 it somehow gives an honest HIGH and LOW states). Of course there are still drawbacks. Sometimes it takes a few tries to be able to read the AVR with this (maybe a driver issue?), it almost always returns a wrong device signature, but with the -F option, I was able to program and set the fuse-bits (I don't suggest setting fuse-bits using this) of the AVR even with the wrong signature. But I noticed that at 14400 baud, being able to read the AVR properly is about 40/60. So I suggest that you use 14400 baud when using this programmer.

What is this good for then? This is good for those one-time programming such as flashing a bootloader. Once you have a bootloader in your AVR, you can use thie banned as the UART for uploading your sketches ( Also try FBoot). Also, banned adapters are WAY cheaper than those PL2303 based adapters.

I really hope this would help others, as I have not seen programmers that use the banned based USB-Serial adapters.
Out of one hole, and into another.
Posts: 114
Joined: Tue Jan 25, 2011 6:09 pm
Location: Quezon City, Philippines

Please be positive and constructive with your questions and comments.