avr

Posted on 07-04-2008 under avr

As promised, here come the schematics.

Porgrammer Schematics v2 [pdf]

If you want to run this cable with PonyProg, in the Setup->Interface Setup dialog choose Serial. In the drop-down box choose SI Prog API. In the check-boxes below you’ll have to check all except RESET.

Pony Prog Settings

If you’re using avrdude, you’ll have to add the following to your avrdude.conf file.

# SIPROG Inverted programmer
# reset=!txd sck=rts mosi=dtr miso=cts

programmer
  id    = "siprogn"; 
  desc  = "Inverted Lancos SI-Prog “;
  type  = serbb;
  reset = ~3;
  sck   = ~7;
  mosi  = ~4;
  miso  = ~8;
;

More information on the programmer is in the README.

A shot of the cable is below. Its short, but thats because we had already converted the serial port signals to TTL. Of course this is really too short. You can make it a bit longer. Ideally of course, you the longer length should be before the level conversion stage. If you can get your hands on a serial cable, that would allow and instead of plugging the programmer into the computer, you plug it into one end of the cable, you can really extend its operating distance.

Programming Cable

REFERENCES:
LancOS’ site has a few nice serial schematics but all of them use discrete components to do level conversion, and frankly, I dont trust discrete components. At least, not the ones available in our maket. This schematic shows the pin connections on the serial port for the SI Prog programmer. Using this allows us to program using PonyProg.
This page uses a similar Max232 connection. We got the idea to use 10nf capacitors from here, thus reducing the size of the ciruit.

NEXT STEP:

USB. woo!! This is gonna be really easy actually because some circuits are already available online. One of these I really like is ladyada’s circuit. Although I think I can do away with the buffer. And I might have to replace the ATTiny with an ATMega8 because I might not be able to find it in the market.

EDIT [ 14th July, 2008 ] : Corrected a problem with the RESET circuit.

Posted on 07-03-2008 under avr

Our brand new office PCs didn’t have serial or parallel port in them. USB is great for normal people, but we NEED serial and parallel ports to do our work. We then have to buy extra hardware to add serial ports via USB.  Which is getting more and more expensive and less and less reliable.

For example, we bought a PCI parallel and serial port adapter which looked promising enough. Unfortunately it refused to budge. After much scratching of chins, and a lot of poking around, ranging from loading userspace drivers on Windows, to installing Debian and trying to access the port from there; we found that the chip on the board was faulty. Similar problems lie with almost all converters that are available in the market, or so I’ve heard.

We had to actually “make” a serial port by pulling lines directly from a header on the motherboard.

So we banged up a simple RS-232 programmer that uses the serial port to program an AVR. Simple and minimal, it uses only a MAX232, a transistor and diode, and a couple of resistors thrown in for good measure. Estimated price, under Rs. 100. See the pic below. (All the soldering is credited to Qaiser Hussain who is amazing with an iron).

Avr Serial Programmer Front

More details, including schematics and programming instructions coming soon :)

Posted on 08-07-2007 under avr, electronics

Found a wonderful little C helper library for the AVR. Its called, simply enough, AVRlib. The poackage includes a lot of useful functions for interfacing various devices with the AVR. Here’s some of the more interesting ones.

It even has some cool networking code: drivers for running ethernet cards and chips, and a network stack.

What I think will be most useful is the software UART code, using which you can have more than one UARTs on your AVR. Albeit you’ll have to let go of one whole timer. This probably wont work with FreeRTOS.

Haven’t used it yet, but I’m sure it should compile on gcc. Although the library does use some pretty old coding constructs ( seriously, who uses sbi() these days?).