Edit Translation
by Transposh - translation plugin for wordpress
IPv6 logo

Tools VUSiBino


Arduino environment

Easy to use and install, but a little convoluted when we started to do some complex things. If what we want is a simple and easy installation when using external components, it is the ideal.

v-USB libraries for alpha Arduino 5. It would suffice to extract the files in the directory “libraries.

A “fork” of these libraries.

USBasp configuration for use with Arduino. Simply remove the tablets in the directory “hardware” Arduino installation.

IDEs Arduino. The last work well with USBasp, but do not libraries v-usb. To this should be used versions of 1.01 to the 1.05

This is an example of using libraries v-usb Arduino, If we want to simply use the environment without using USB capabilities VUSiBino, simply install the configuration files.

Windows, AVR toolchain.

The first is to download the necessary programs, winAVR, Atmel studio (Use version 5, the most advanced go well, but not n) and avrdude or its GUIs AVRDudess or bitBurner. In addition to the VUSiBino Necesitarremos drivers and libraries v-usb firmware to act as a USB device.

Installation is very simple programs, I recommend installing first WINAVR, Atmel Studio after we choose, the gui of AVRdude. The install drivers with Zadig, is an executable that has everything you need, It is a good idea to copy it somewhere comfortable and create a shortcut (ctrl + May and drag the icon). The v-usb libraries need are within the archive, In the address book “USBdrv”. The draw in an easy site to remember to use them for convenience.

Riding a firmware v-usb from scratch.

Let's take a walk through AVR Studio to see the main options when compiling a firmware v-usb. Empezarremos creating a new project (File->New->Project). A window opens, choose “C Executable Project” and fill the fields similar to the one shown in the screenshot. When choosing the chip touch, write in a field top right ours, in this case atmega168.

The project created, and before doing anything else, we will prepare the environment to use libraries v-usb smooth. First we create a “virtual directory” in our project, to have some things organized, press the right mouse button, on the name of our project window “Solution explorer” and select “Add->New folder”, le lamaremos “USBdrv”. After that and in our project folder (see second and penultimate catches to locate), create a subfolder called usbdrv. We will open the tablet with the v-usb libraries that have lowered us from the page obdev, and sail to open a folder that is also called “USBdrv”, select and decompress the files in the folder of your project usbdrv. This fact added to the virtual folder three files, “usbconfig.h”, “usbdrv.c” y usbdrvasm.S” They found in the folder “physical” “USBdrv”. To do this click with the right mouse button on the name of the folder window “Solution Explorer”, and in the dropdown select “Add-<Existing Item”, cruise the control files to the folder “USBdrv” and pressed ctrl can select files to add.

Done this we can only set a couple of parameters of the project, and you're ready to compile. rimero, in the window “Solution explorer” we click with the right mouse over the project name and select the last option from the dropdown “properties”. The properties window will show a series of tabs, select “toolchain”, and this tree, “Directories”. We click on the icon with a symbol “+” verde, we wrote “../USBdrv” in diáologo that will show us and accept.

Depues click on “Symbols”, this is not necessary but it is good to know that there. With the Add button (+ verde) It shows us a diáologo, We write the frequency of the microcontroller, in case aand “F_CPU=16000000UL”, but remember that the ATMEGA support frequencies up to 20MHz external clock as you say (Crystal oscillator u).

Done this we can only write the code, do not forget to include (#include “usbdrv.h”) “usbdrv.h” at the beginning of the program so you can use v-usb.

to compile, select the type of compilation in a drop-down menu the second line, default can choose from “Debug” to debug the program in the built-in simulator or with a suitable hardware, the “Release”, which cleans and optimizes the program to occupy little and be as fast as possible. After that you can press “F7”, use one of the menu options “Build”, or with right mouse button on the project name choose from “Build” and “Rebuild”. Once the compilation, we see that in the window “Solution explorer” They have populated the trees “Dependencies” and “Output files”, we can see in the second list that there is a file with extension “hex”, which it is the climb to VUSiBino.

To locate the binary file climb to device, firmware, we go to the directory where our project is located, we can select the main code (in our case “newtest.c”) right mouse and select “Properties” the pop. We will see that shows the name and path to the file, you can select this and copy it into a browser window or the command line to change directory. We will see that we have created a directory “Debug” and one “Release”, in the second we find the file “newtest.hex”, which it is the firmware.

Raising the firmware.

The most popular program is AVRDude, although we can use Kazhama or other. We explain here several options for use with AVRDude and GUIs, AVRDudess and bitBurner AVR programs.

If we use AVRDude from the command line should use this command.

We can also copy the command option “Post Build” tab “Build Events” in the project options. I personally find it more comfortable to wear AVRdudess, and if I want to see the firmware, bitBurner, which has a hex editor dropping down we see the values ​​of the EEPROM memory or firmware binary.

I will explain how to upload the .hex circuit with AVRDudess. After installation must configure it to use USBasp, the drop drown (“Programmer (-c)”) we seek and select. We do not mind the chip is selected in “MCU (-p)”, Later we'll configure.

Before we should ensure that our VUSiBino is in programming mode by pressing “prog” while we pressed “reset” and that the system is properly detected. We will use the Zadig to see if your device is connected, select Options view all devices (“Options->List all devices”). Should appear in the drop-down USBasp, select what. In the list of “Target driver” must select “libusbk” the “lib usb win32” and if it is not installed, on the left indicates the driver installed, will install. At the end we will notify the result of the operation.

If you have successfully installed, we can detect the chip bearing the VUSiBino withthe button “Detect” de AVRDudess. If we have not already hacho, select the binary to rise by clicking on the three points “…” the field “Flash”, After that we make sure that option is selected “Write” and clicking on the button “Program!” the program up. To activate press the reset button on our plate and start running the program.




I chose Windows, moment for using CODE::Blocks as programming environment in C ++. It is simple to install and use. Devcpp It is somewhat outdated, CodeLite, It is the latest, but I have not finished try and QT is extremely unnerving me.

Installation Code::blocks is very simple, with the default options we get perfectly, brings including the compiler and the necessary utilities, but we can always use other compilers. Once the program is installed, we can create unnuevo project, to use libraries Libusb and windows indows, however it will take a few preliminary steps, simple but not very clear if you have not used this IDE before.

On the menu “File” we choose new project “New->Project”, This will open a dialog where you choose the type of project, as we will make a dialogue windows, choose “Win32 GUI project”, and we choose “Dialog based”. After that we will ask the project name and location, fill and note the directory where you saved. Later we were asked by the compiler you want to use, if not already chosen will choose “GNU GCC compiler” and accept.

Now let's put the libraries used in the examples, If we have not targeted the project directory, We can find it with the right mouse over “main.cpp” and select properties, where we will open a dialogue with the file paths. then Abrimoe the project capeta, We create a directory and call “libusb”. We open the fichero de libusb win32, and select directories “include” and “lib” to put them into the directory “libusb” of our project and within the subdirectory “include” rename “lusb0_usb.h” a “usb.h” to make as examples of v-usb.

Now we turn to finish configuring the IDE to include the libraries in the compilation and “linked”. Raon right on the project name, we choose “Build options”, We select the name of our project and the first tab, “Compiler flags” we check “Have c++ follow the C++11…” to use some functions that would otherwise would compile. In the tab “Linker settings” we add “-L ./libusb/lib/gcc -lusb” in the window “Other linker options:”. And finally, tab “Search directories” we add “libusbinclude”. With this you can compile a program that uses the libusb libraries to communicate with our device.

To edit dialogue, bajaremos Resedit or the like as included resed “mingw developer studio” the Resource hacker. Its use is very intuitive, simply open the file with extension “.rc” the project directory with one of these programs and adding the controls we need to then cash them using as explained in shipments dedicated to programs “host.

The next post will be to demonstrate how to use four fans, pins three two, and read your speed in case they have a tachometer DSE. The host software will be in C ++, but the following will already be in Pascal, it is easier to carry and use than C ++ and using Lazarus Free Pascal Compiler.


Links of interest:


AVRfreaks, great forum with countless resources and manuals

Obdev V-USB, the origin of these shipments.

The plate based VUSiBino

excellent tutorial to program an AVR with v-usb

Excellent and very detailed guide on electronics and programming AVRs, aparatejos my inspiration comes from here.

Leave a Reply