Hello world!

March 3, 2009

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!

New masks for the USB ASP

February 20, 2009

These masks are designed by me for the USB ASP Programmer designed by Tomas Fischl (http://www.fischl.de/usbasp/)

http://www.esnips.com/web/USBASP/
I used series resistors with MOSI MISO SCK and RST lines. They are used for protection of the ATmega8 of the programmer. They can be replaced with short circuits like the original design.In my design, the resistors probably causes some rise time issue, so the programmer will not work unless the slow sck jumper is shorted out. And power is not drawn from the USB port, and taken from the external circuit. Reversing polarity of Vcc and GND will certainly cause the programmer to die. I included a Zener Diode in my design to limit the reverse polarity voltage, but don’t know how effective it would be. I’ll try to make another design with 5 wire-output, that draws power from USB port.



Creating a PCB: The Toru Bhai Style

February 20, 2009

Today, I went to make the PCB of my AVR USB Programmer (USBASP). BUET Students usually go to ‘Toru Bhai’  for making PCBs. I did my design in Proteus Isis and Ares. I talked to Toru Bhai, and he asked me to bring print out of the masks I designed. Basically 3 masks are required for single layer PCB:

Bottom Copper
Top Components (Silk Screen)
Solder Resist

Although, Toru Bhai is reluctant to do the Solder Resist, as he claims it is too expensive. As I went today in his ‘factory’, in 6/1/F, Ram Krishna Mission Road, he didn’t have much work load and insisted me to wait and take my PCB with me. So I watched the fabrication process. Surprisingly, the screen printing is very much similar to VLSI fabrication. 

Basically, a thin fabric with tiny holes in it is first covered in paint, and the tracing paper with the print out of the pattern is held in front of it. The screen is enclosed in glass, and exposed to solar light. The region covered by ink in the tracing paper remain unchanged, but the region exposed to light hardened. The screen is then washed, and the region covered by ink on tracing paper during solar exposure has its paint removed. 
Then the screen is used to imprint the pattern of the tracing paper on copper board. The paint has to be insoluble to water. After the print, the board is submerged to FeCl3 (Ferric Chloride). Regions not covered by paint has its copper removed, as Copper reacts with FeCl3 to produce Cu-Chloride.
Afterwards, the paint is removed. Then holes are drilled to it, and the top layer patterns are drawn accordingly.
I got some pictures of the process:
The lab:
A screen looks like this:
Fitting the screen
Screen ready for action
Patternizing
FeCl3 Etching
Drilling Holes

Grinder used to smoothen the sides

USBASP Programmer for AVR is working on Windows Vista

February 17, 2009

Finally I could get my USB programmer to work with windows vista. Firstly, I stripped of the breadboard from all previous connections, and reconnected the circuit. This ofcourse proved fatal to two of my microcontrollers, as I accidentally connected +12V to Vcc rail, instead of the input to the 7805 IC. I connected the programmer to PC, and it said unknown device. I knew I connected the D+ and D- wires from USB port wrong. The final bread board looks like this:

So I swapped them and replugged the USB. This time the device was recognised as usbasp, and windows vista asked for driver. I supplied the libusb driver given with the fischel’s package (http://www.fischl.de/usbasp/). Windows said something about device compatibiliy. I chose to ignore, and the device installed successfully.
Now I opened command prompt and typed  avrdude -c usbasp -p t2313
 Command prompt returned  error: could not find USB device “USBasp” with vid=0x16c0 pid=0x5dc


I tried to s
earch the forums. They suggested to use 2007 build of winavr, I tried that (replaced avrdude.exe in the C:\winavr\bin directory with the 2007 version). Some of them also suggested to use an older version of libusb. So I did that too. After spending an hour, I did some thing I should have done a long time ago. I clicked on the orb (start), typed ‘cmd’, so Vista start menu searched cmd.exe. I right clicked on it and selected “Run as Administrator”. Now when I typed

C:\Windows\system32>avrdude -c usbasp -p t2313
found 8 busses
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x1e910a
avrdude: safemode: Fuses OK
avrdude done.  Thank you.

 

Wow, the device actually worked!! I tried several times and it was working. I started the AVR8-Burn-O-Mat and changed some settings.
Burn O Mat seems to work fine too. Just too bad it doesn’t have the buffer of ponyprog, and the hex display. It is just great otherwist, and has a lot better fusebit editor.



Beginner’s Microcontroller Programming-IV: Absolute minimalistic approach to the modified SIProg

November 22, 2008

Ok, before I startered this project, I tried to construct the USBasp and USBtiny, and was not successful with bread board. I am planning to make a better version of the USBasp in PCB, but at the moment I tried to make a really small  SI Prog. It will be so small that the entire veroboard will fit into a standard serial port connector casing. I just bought one from Patuatuli:

To fit the veroboard into the small casing, you can maximum fit a 6×6 hole veroboard piece into it, by properly polishing the sides, the central piece could be two hole longer. As the header is inserted into the box, the backside of the header blocks the first row. With only five holes, I thought, at first it would be impossible to fit my circuit (http://sajiduc.blogspot.com/2008/04/beginners-microcontroller-programming.html) here.

Then it occured to me, if I used the extra holes in the middle row to connect the densedly connected ground line, and use the ends of resistors to get connection from the MOSI, SCK, and RESET lines, it will be possible to accomodate the circuit in the header box. And so, here it is, I present you the smallest possible (with non-SMT components) SI Prog. It supports most popular microcontrollers like ATmega16, ATmega32, ATmega8, ATtiny2313, but you probably already know that from my third blog. Circuit diagram is available there:
http://sajiduc.blogspot.com/2008/04/beginners-microcontroller-programming.html

ভিস্তা বাণিজ্যিক সংস্করণ পেলাম বিনা মূল্যে

November 19, 2008

IEEE এর সদস্য হওয়াতে আমি ভিস্তা বাণিজ্যিক সংস্করণ পেলাম বিনা মূল্যে। মাইক্রোসফট এখন শিক্ষার্থীদের বিনামূল্যে বিভিন্ন সফটওয়্যার দিচ্ছে। তারউ ধারাবাহিকতায় আমি IEEE এর শিক্ষানবিশ সদস্য হওয়ায় ভিস্তা বাণিজ্যিক সংস্করণ পেলাম। আসল সফটওয়্যার ব্যবহারের অনুভূতিই আলাদা।

Microcontroller Based Automatic Object Sorting by Length

November 6, 2008

I’ll give you the circuit description and codes later.

External Crystals and Ponyprog

November 2, 2008

We are now working on a project that requires external crystal. I borrowed a microcontroller from my friend today. We were using external crystal for our project, and I thought that was no big deal. I brought the microcontroller home, and tried to program it. Ponyprog said it is an unknown device. I was quite anguished and thought that it the microcontroller was fried. Suddenly just for curisity, I plugged in a 12MHz crystal. And wow, ponyprog started working again!

Moral (!!!!) : When you have programmed fusebits for external crystals, you MUST use one to program the microcontroller.

USBasp: The USB based AVR programmer

October 27, 2008
Update: My Programmer is working now. Read Here.

My laptop does not have serial port. And ponyprog, up until now, have not provided support for any USB programmers. Today, I constructed my first USB programmer on a breadboard. I had a old USB extenstion cable which was out of order as the header was slack due to wear. I cut of that part and soldered breadboard wires.

My first goal was to make a ponyprog compatible programmer that emulates parallel port. I started with: USB2LPT

Afterwards, I realized that the emulation makes programming too slow. Thus I had to move to a dedicated programmer. But I really like a GUI for inputting, especially the fusebits. AVRdude is a command prompt based programmer. A wrong fusebit setting can lock the microcontroller irrepairable by a Serial Programmer.

Then I found AVR8 Burn-O-Mat: GUI for avrdude . The interface is even better than pony prog for fuses. It actually has small comments beside fusebits. AVRdude even supports my simplified SIProg. So I proceeded to make the famous USB ASP (http://www.fischl.de/usbasp/) I forgot to connect the ICP and INT0 at first, and kept getting “Unknown USB device”. I reflashed 4 times. Finally the programmer was operational and the driver was installed successfully.

I’ll give details of my schematics later. Here is a picture of the circuit.

Update: My Programmer is working now. Read Here.

(Really) Beginners Microcontroller Guide (Part-II) Configuring Ponyprog properly and writing program to uC

October 25, 2008

(A Continuation from (Really) Beginners Microcontroller Guide (Part-I) Compiling the first program)

(alpha version. Very unstable, still editing)

Writing program to Microcontroller

We will be using ponyprog from lancos. Although it is possible to program directly from winavr, I like the interface of the program very much.

Construct the simplified SI Prog. You’ll need:
1. A serial port DB9 Female Connector,
2. 5V1 Zener Diodes x3
3. Resistors: 15K, 10k, 4k7 x 3
4. Bread board wires

Connect the circuit on veroboard. To see how it looks go to my blog http://sajiduc.blogspot.com/2008/04/beginners-microcontroller-programming.html

To connect the programmer always consult the datasheet of the microcontroller. Connect the Mosi, MISO, SCK, Reset lines of the programmer to the corresponding pins of microcontroller, and connect GND to 0V. Connect the serial connector to the serial port of your mother board. Please do not use a usb-serial converter, and connect only to true serial port.

Goto http://www.lancos.com/prog.html and download ponyprog from there. Install ponyprog, and open ponyprog from startmenu.

After the annoying neigh sound, click ok. Pony prog will say

Click ok again

Now do the bus timing calibration:


Afterwards, it is important. Click Setup>Interface Setup. Select Serial radio button. From drop down select SI Prog API / SI Prog IO. Select the COM port in which the programmer is connected. It is COM1 if you have only one serial port, but for multiple ports, you have to select the appropriate one. Please note that 90% cases, the SIProg does not work because of not proper configuration in this dialog. So if the SI Prog does not work, try to change the COM port, or switch between SI Prog API and IO

Select the appropriate device name

Now to test if the programmer is working, Click Command>Read All. From my experience 70% cases, people don’t get a smooth read operation at the first try. See below for common problems


If every thing is ok, (Which actually did in my first experimental SIProg) Then reading will start.

Now click File>Open, and open the testprog.hex file generated by the compiler.

Now select write all


And then the write will be successful!

Then play with your microcontroller circuit:

Ofcource the write may not be successful.
This might be due to
1. Circuit connection error (Check if you have connected power to microcontroller, check if the breadboard connections are loose, if the programmer are connected to the proper pins, if the programmer is soldered properly.)

2. Check if the BC547 transistor is working by testing if 0.7 V drop occus between Emitter and Base.

3. Check if your serial port is working and you are not using a USB-serial converter

4. Play around with the interface setup (in ponyprog) to find another suitable setting for you. (Try SIprog API, SIProg IO, Check if you have selected correct serial port)

5. This is very common for me:- the microcontroller is dead!!!!

Well, no 5 can result from 2 cases, a) a heart attack of the microcontroller (Fry out, like connecting Vcc of microcontroller to ground and ground to Vcc, microcontroller, at 90% cases just fry) b) Accidental programming of the fusebits of the microcontroller can result the SPI interface to be locked out. This can be overcome by a universal programmer. If you happen to have access to one, ask some one clear the lock bits.

6. You forgot to select the right device (I also sometimes forget to do that)


Follow

Get every new post delivered to your Inbox.