শ্রেণীঅনুসারে আর্কাইভ: ইলেক্ট্রনিক্স
Compiling a V-USB (AVR-USB) example program with Visual C++
সাজিদ মুহাইমিন চৌধুরী কর্তৃক এ.ভি.আর, টিউটোরিয়াল, মাইক্রোকন্ট্রোলার এ প্রকাশিত - আগস্ট ২৫৩৯;, ২৫৩৬;২৫৩৪;২৫৩৫;২৫৩৪; , ২১ শ্রাবণ ১৪১৭
Well, I used MinGW / MSYS to compile some AVR-USB programs when I was working for IICT. Setting up MinGW is in windows is extremely tedious, especially if you live in a country where 30kBps download speed is considerably high. The offline installation of MinGW is equally confusing. I was considering an alternate development environment for windows, and Visual C++ can be considered as a great option.
Some of my students today visited me with some problems compiling a V-USB commandline example. Although I managed to solve it, I had to do it with considerable amount of hacks to the v-usb libraries. They were using visual C++ version 6. Now I am going to show some steps to compile an example of V-USB from Microsoft Visual C++ 2010 Express Edition.
Both online and offline installer for Visual C++ express edition is available from the website. The express edition is free to download and use for evaluation and education: http://www.microsoft.com/express/downloads/
In case you don’t know yet, v-usb can be downloaded from obdev’s website at: http://www.obdev.at/products/vusb/download.html
To set up the VC++ environment, you’ll also need libusb-win32 drivers. Download them from: http://sourceforge.net/projects/libusb-win32/
For this blogpost, I am using these files:
vusb-20100715.tar.gz
libusb-win32-bin-1.2.1.0.zip
downloaded from the respective sites, and the latest version at the time of writing this blogpost. I’ve also downloaded and installed Microsoft Visual C++ 2010 Express edition.
I am using 32 bit version of Windows 7, with intel processor. If you use 64 bit version of windows or AMD processor, you have to select apropriate libraries.
Open the libusb-win32-bin-1.2.1.0.zip with 7-zip and extract contents of folder libusb-win32-bin-1.2.1.0.zip\libusb-win32-bin-1.2.1.0\lib\msvc\ to C:\Program Files\Microsoft Visual Studio 10.0\VC\lib , (note, the library folder to be copied for 64 bit version is msvc_x64). Also extract the content of libusb-win32-bin-1.2.1.0\include\ to C:\Program Files\Microsoft Visual Studio 10.0\VC\include
Read this file: libusb-win32-bin-1.2.1.0\bin\libusb-win32-bin-README.txt to know how to install the bin folder content.
Open Microsoft Visual Studio Express edition, and create a new Win32 Console Application Project using the wizard. Use all default settings of wizard.
Now, using windows explorer, open the folder where the project is created using the wizard. My project title is ledcomm. By default, it will be in \Documents\Visual Studio 2010\Projects\ledcomm\ledcomm
Open the vusb-20100715.tar.gz and browse to this folder:
Copy the contents of commandline folder into the folder where you created the project (X:\Documents\Visual Studio 2010\Projects\ledcomm\ledcomm). The folder should now look like:
Copy the folder “firmware” vusb-20100715.tar\vusb-20100715\examples\custom-class\ to X:\Documents\Visual Studio 2010\Projects\ledcomm\ (note: it is one level up the folder where we copied command line). You can use this folder to create a AVR studio project later.
In the project explorer, remove all source and header files from the project:
Now add the following source files and header files to the project
ledcomm\set-led.c
ledcomm\opendevice.h
ledcomm\opendevice.c
firmware\requests.h
firmware\usbconfig.h
The project explorer window now looks like this:
Go to project properties and check if the Pre Compiled header is disabled:
At this point, if you hit F5 (Run), you’ll get this debug result:
1>—— Build started: Project: ledcomm, Configuration: Debug Win32 ——
1> set-led.c
1>X:\documents\visual studio 2010\projects\ledcomm\ledcomm\set-led.c(84): warning C4013: ‘strcasecmp’ undefined; assuming extern returning int
1> opendevice.c
1> Generating Code…
1>opendevice.obj : error LNK2019: unresolved external symbol _usb_control_msg referenced in function _usbGetStringAscii
1>set-led.obj : error LNK2001: unresolved external symbol _usb_control_msg
1>opendevice.obj : error LNK2019: unresolved external symbol _usb_get_string_simple referenced in function _usbGetStringAscii
1>opendevice.obj : error LNK2019: unresolved external symbol _usb_close referenced in function _usbOpenDevice
1>set-led.obj : error LNK2001: unresolved external symbol _usb_close
1>opendevice.obj : error LNK2019: unresolved external symbol _usb_strerror referenced in function _usbOpenDevice
1>set-led.obj : error LNK2001: unresolved external symbol _usb_strerror
1>opendevice.obj : error LNK2019: unresolved external symbol _usb_open referenced in function _usbOpenDevice
1>opendevice.obj : error LNK2019: unresolved external symbol _usb_get_busses referenced in function _usbOpenDevice
1>opendevice.obj : error LNK2019: unresolved external symbol _usb_find_devices referenced in function _usbOpenDevice
1>opendevice.obj : error LNK2019: unresolved external symbol _usb_find_busses referenced in function _usbOpenDevice
1>set-led.obj : error LNK2019: unresolved external symbol _strcasecmp referenced in function _main
1>set-led.obj : error LNK2019: unresolved external symbol _usb_init referenced in function _main
1>X:\documents\visual studio 2010\Projects\ledcomm\Debug\ledcomm.exe : fatal error LNK1120: 10 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I just pasted this error message so that people who have a hard time finding a solution quickly hits this page.
Firstly, VC++ doesn’t have strcasecmp, so replace the strcasecmp command with strcmp command. There goes the case insensitivity!
Now project>project properties, Configuration Options>Linker>Input>Additional Dependencies
Click on the additional dependency box and click on <Edit…>
In the additional dependencies dialogue, type in libusb.lib. Then press ok, and again ok from the properties dialogue.
Now Press F7 to build the project.
1>—— Build started: Project: ledcomm, Configuration: Debug Win32 ——
1> set-led.c
1> ledcomm.vcxproj -> x:\documents\visual studio 2010\Projects\ledcomm\Debug\ledcomm.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Now you can run the created exe file:
In this way, you can use Visual C++ 2010 Express Edition to compile the
Auto Routing in Single Layer – Proteus Isis and Ares
সাজিদ মুহাইমিন চৌধুরী কর্তৃক পি.সি.বি বিন্যাস এ প্রকাশিত - এপ্রিল ২৫৪০;, ২৫৩৬;২৫৩৪;২৫৩৫;২৫৩৪; , ২৩ চৈত্র ১৪১৬
A Tutorial of Proteus Isis and Proteus Ares
সাজিদ মুহাইমিন চৌধুরী কর্তৃক ইলেক্ট্রনিক্স, টিউটোরিয়াল, পি.সি.বি বিন্যাস এ প্রকাশিত - এপ্রিল ২৫৩৫;২৫৪২;, ২৫৩৬;২৫৩৪;২৫৩৪;২৫৪৩; , ৫ বৈশাখ ১৪১৬
This tutorial shows you how to create circuits in Proteus Isis, simulate them and then create PCB with Proteus.
Proteus is software for microprocessor simulation, schematic capture, and printed circuit board (PCB) design. It is developed by Labcenter Electronics.
The Proteus Design Suite inludes:
* ISIS -- A schematic capture tool with the possibility to simulate programmable ICs like Microchip PIC, Atmel AVR (ATmega8, ATmega32, or ATtiny2313) etc.
*ARES -- for PCB layouts.
The URL for Proteus is http://www.labcenter.co.uk/
Unfortunately, there are few / no good tutorials for Proteus out there, and therefore I took the trouble of making one myself. The tutorial has 3 parts. First part demonstrates Drawing circuits in Proteus Isis. Second part shows how to simulate circuits in Proteus ISIS, and how to export to ARES for making PCB layout. The third video shows Routing and how to print masks for PCB making.
ইউ এস বি এ এস পি এর জন্য নতুন মাস্ক
সাজিদ মুহাইমিন চৌধুরী কর্তৃক ইউ. এস. বি, এ.ভি.আর, প্রোগ্রামার, মাইক্রোকন্ট্রোলার এ প্রকাশিত - ফেব্রুয়ারি ২৫৩৬;২৫৩৪;, ২৫৩৬;২৫৩৪;২৫৩৪;২৫৪৩; , ৮ ফাল্গুন ১৪১৫
এই মাস্ক গুলো থমাস ফিচ্যাল এর বানানো ইউ এস বি প্রোগ্রামার এর জন্য আমি বানিয়েছি। (http://www.fischl.de/usbasp/)
Creating a PCB: The Toru Bhai Style
সাজিদ মুহাইমিন চৌধুরী কর্তৃক পি.সি.বি বিন্যাস এ প্রকাশিত - ফেব্রুয়ারি ২৫৩৬;২৫৩৪;, ২৫৩৬;২৫৩৪;২৫৩৪;২৫৪৩; , ৮ ফাল্গুন ১৪১৫
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:
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.
USBASP Programmer for AVR is working on Windows Vista
সাজিদ মুহাইমিন চৌধুরী কর্তৃক ইউ. এস. বি, এ.ভি.আর, প্রোগ্রামার এ প্রকাশিত - ফেব্রুয়ারি ২৫৩৫;২৫৪১;, ২৫৩৬;২৫৩৪;২৫৩৪;২৫৪৩; , ৫ ফাল্গুন ১৪১৫
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:
I tried to search 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
Beginner’s Microcontroller Programming-IV: Absolute minimalistic approach to the modified SIProg
সাজিদ মুহাইমিন চৌধুরী কর্তৃক এ.ভি.আর, এস. আই. প্রোগ, প্রোগ্রামার, মাইক্রোকন্ট্রোলার, সিরিয়াল পোর্ট প্রোগ্রামার এ প্রকাশিত - নভেম্বর ২৫৩৬;২৫৩৬;, ২৫৩৬;২৫৩৪;২৫৩৪;২৫৪২; , ৮ অগ্রহায়ন ১৪১৫
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.
Microcontroller Based Automatic Object Sorting by Length
সাজিদ মুহাইমিন চৌধুরী কর্তৃক এ.ভি.আর, প্রকল্প, মাইক্রোকন্ট্রোলার এ প্রকাশিত - নভেম্বর ২৫৪০;, ২৫৩৬;২৫৩৪;২৫৩৪;২৫৪২; , ২২ কার্তিক ১৪১৫
External Crystals and Ponyprog
সাজিদ মুহাইমিন চৌধুরী কর্তৃক এ.ভি.আর, তালিম , মাইক্রোকন্ট্রোলার এ প্রকাশিত - নভেম্বর ২৫৩৬;, ২৫৩৬;২৫৩৪;২৫৩৪;২৫৪২; , ১৮ কার্তিক ১৪১৫
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
সাজিদ মুহাইমিন চৌধুরী কর্তৃক ইউ. এস. বি, এ.ভি.আর, প্রোগ্রামার, মাইক্রোকন্ট্রোলার এ প্রকাশিত - অক্টোবর ২৫৩৬;২৫৪১;, ২৫৩৬;২৫৩৪;২৫৩৪;২৫৪২; , ১২ কার্তিক ১৪১৫
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.
![[Bloglines]](http://www.sajidmc.net/wp-content/plugins/bookmarkify/bloglines.png)
![[del.icio.us]](http://www.sajidmc.net/wp-content/plugins/bookmarkify/delicious.png)
![[Digg]](http://www.sajidmc.net/wp-content/plugins/bookmarkify/digg.png)
![[Facebook]](http://www.sajidmc.net/wp-content/plugins/bookmarkify/facebook.png)
![[Google]](http://www.sajidmc.net/wp-content/plugins/bookmarkify/google.png)
![[Twitter]](http://www.sajidmc.net/wp-content/plugins/bookmarkify/twitter.png)
![[Yahoo!]](http://www.sajidmc.net/wp-content/plugins/bookmarkify/yahoo.png)
![[Email]](http://www.sajidmc.net/wp-content/plugins/bookmarkify/email.png)














সাম্প্রতিক মন্তব্যসমূহ