gpollice

Archive for February, 2011|Monthly archive page

Arduino Part 3

In embedded software on February 19, 2011 at 8:10 pm

Learning More–getting ready for the class

I’ve learned a bit more about the Arduino in the last couple of weeks, since my last Arduino post. Most of the information has been about using Eclipse and the Arduino Uno. The basic project I completed last time was the simple blinking example on the Decimilia board. This is an ATmega168 processor and runs just fine. However, when you go to Eclipse, you need to make sure that you set the clock frequency to 16000000 and not 1000000 as in some of the documents. Other than that, everything works just great.

Enter the Uno

The Arduino Uno is the latest version of the Arduino. I ordered a starter kit from Amazon. It was a duemilanove kit, but shipped with the Uno. It has the ATmega328p processor. It worked just fine with the Arduino IDE, but when I tried to duplicate the steps to get it working with Eclipse, I failed miserably. It’s taken a while to track things down, but I think I’ve got it pretty much sorted out now.Here are some of the things that I’ve found helpful.

  1. When you set up the AVRDude configuration for the Uno, the baudrate should be 115200 instead of 57600 as some of the documents indicate. This will get rid of the annoying “stk500_recv(): programmer is not responding” message when AVRDude runs.
  2. In order to see what’s going on with the Arduino IDE, you can modify the preferences.txt file to add some verbose options. The file is in the Library/Arduino directory under my home directory on the Mac. A couple of the useful things I’ve found are adding the following lines:
    • upload.verbose displays the command line used for invoking AVRDude.
    • build.verbose=true displays the output of the build process.
  3. I’ve copied the Uno core.a library created by the Arduino IDE and am going to just use it rather than trying to create an Eclipse project for building such a library like I did for the Diecimilia. This will reduce the number of things I have to work with and it is the preferred way of getting the library according to the installation. One of the problems is finding the library on the system on the Mac. The location of the libraries is specified for other platforms in the Eclipse installation instructions from the Arduino playground. It took a little while, but after putting in the “build.verbose” file in the Arduino IDE’s preferences.txt file, I found the directory. It was in /var/folders/7A/… . Not the most obvious place. I moved this into my a lib/arduino directory in my home directory.

After all of this, I still am not getting the program to execute. It compiles, loads, but does not run on the Uno.

Finally: Success

So, it was back to the drawing board. I went back and recreated a separate project for the Uno core library. Then I compiled that and created a new project for the Uno blink program, and it worked. It’s still not the easiest thing to make sure you get all of the settings correct, but it is nice to see the light blink.

Next, I think I’ll work on building the project in a more simple environment, like a text editor, command line compilation, and make.

First, it’s probably worth recording the settings I’ve got on the two projects.

Uno Core Library Project

I simply copied all of the sources from the …/cores/arduino directory to the top level of this project. I deleted the main.cpp as the Eclipse installation directions said. Next, I followed the directions from the Eclipse installation page exactly. The relevant preferences settings for the project are:

  • AVR>Target Hardware: ATmega328p, 16000000 MHz.
  • C/C++ Build>Seettings: no debugging information, and optimize for size on both compilers (C and C++). Also, the other optimization flags for the C++ compiler are”-ffunction-sections -fdata-sections -Wl,–gc-sections”.

I have both the debugging and release configurations set for this, but it only needs release. We’re not really worrying about debug configurations at all here.

The Uno Blink Project

Again I followed the instructions in the Eclipse installation directions. There was one thing not covered which got the library included in the linking. Here are my settings:

  • AVR>AVRDude: Uno programmer configuration. No switches set under Advanced tab.
  • AVR>Target Hardware: same as above.
  • C/C++ Build>Settings
    • Additional Tools in Toolchain: Generate Hex Files for Flash Memory and Print Size are checked.
    • AVR Compiler>Directories: “${workspace_loc:/UnoCore}”, where UnoCore is the name of my Uno core library project.
    • For both compilers (C and C++), no debugging and size optimizations.
    • AVR C++ Compiler>Directories: same as for the AVR Compiler.
    • AVR C++ Compiler>Optimization: -ffunction-sections -fdata-sections -Wl,–gc-sections
    • AVR C++ Linker>Libraries: Libraries (top): UnoCore, which is the name of my library for the Uno core. Libraries Path (bottom): “${workspace_loc:/UnoCore/Release}”.

Dragon Dictate

In Technology on February 7, 2011 at 7:12 pm

I’m writing this post using Dragon Dictate which I ordered last week. I have to admit that I’m really impressed by how easy it is to install and get started using. When I got home today it took me about 15 min. from the time I got the box opened  until I was ready to start  training it to recognize my voice. After about 5 min. it was ready to go.

This post is the first document that I’m actually writing with my voice. The accuracy is, to me, uncanny. There’ve been very few errors in (except for the word errors that I just had to try several times to get right). But this is just with the basic training of my voice. I can go back later a innd train it in a more advanced way so that even “errors” will be no problem.

I’m hoping that this will give me the ability to write better by not editing as I write. When I type documents, especially for books and articles, I tend to edit as I write. Almost every book or article on writing says that editing as you write is a bad practice. If I can break myself of that habit I should be able to express my thoughts better and then go back and edit the document for correctness and clarity.

My hope is that this will help me get back to writing my software engineering book and maybe even finish it this summer. It’s only been 2+ years that I’ve been working on the book and I’m still only a chapter 5. Part of the problem is that I simply take too long to get something on paper and then have to go back and review the things I’ve written every time I try and start again. Perhaps this will get me into  a regular routine to keep current on my writing.

Whatever, there is no doubt in my mind that the technology used in Dragon  Dictate is quite advanced. Right now, after a short trial, I would heartily recommend anyone use, or at least try, Dragon Dictate or the Windows version of the Dragon product.

I’ll keep you posted.