Show Posts
Pages: [1]
1  Development / Other Software Development / Updated tutorial: Using Atmel Studio 6 with Arduino on: September 17, 2012, 07:59:31 pm
There are already a few excellent resources out there for using Atmel Studio with Arduino code and libraries, including Jaycon Systems' tutorial series and Omar Francisco's Arduino Installer.

Our tutorial on using AVR Studio 5 with Arduino has been around for almost a year now, and we thought it was time to bring it up to date. Without further ado, EngBlaze presents:

Using Atmel Studio 6 with Arduino Projects

It's a step-by-step guide to setting up Atmel Studio to use, compile, and flash Arduino code.

We've incorporated a lot of feedback from our readers and forum users here, as well as lessons learned from the previous version. We also try to explain the reasoning behind most of the tutorial steps - since Atmel Studio and the Arduino toolchain are complex beasts, we figure it's better to learn how to walk before trying to run with an automated installer or similar.

We'd love to get your feedback on the new version and make it an even better community resource. Let us know what you think!
2  Development / Other Software Development / Re: Atmel Studio 6 on: September 17, 2012, 11:46:36 am
A couple more things - if you got the blink example to compile but it doesn't perform as expected, can you check the compiled hex filesize vs. the result from the Arduino IDE? Often, a successful compilation but strange behavior at runtime is due to compiler and linker optimization settings that differ from the defaults.

Also, I didn't realize you mentioned debugging with the simulator in your first post - that's a different beast than debugging on-chip, and we've had trouble getting consistent results (plus, it's sloooow). Not sure if you have a programming tool, but using DEBUGWIRE with a Jtag or AVR Dragon has been a better experience.

If you're looking to try again and would like instructions to cross-reference with Jaycon's tutorial, we've updated our AVR Studio 5 tutorial for using Arduino with Atmel Studio 6. It can't account for every variation in people's setups, but a good number of users have found the previous version helpful. Let us know if you make progress and we'll share any other insights we have!

3  Development / Other Software Development / Re: Atmel Studio 6 on: September 13, 2012, 10:00:10 pm
Have you tried checking the fuses on your chip to make sure they match Arduino's default settings? If it was not an Arduino board to begin with, some products come with different configurations. This has caused us problems in the past. Be careful with setting fuses, you can flash configurations that "soft-brick" the chip, requiring high voltage programming to reverse. Some can be changed without issue.

The Atmel Studio debugger is not foolproof under any circumstances, but we've gotten it to work with Arduino with some degree of success. Hard to say what might be causing the problems you describe without more detail though.
4  Development / Other Software Development / Re: AVR Studio 5.1 - doing it the hard way on: April 24, 2012, 09:34:29 am
Have you checked your Makefile to make sure the core libraries are being linked in the right place?  AVR Studio 5 has a bug which places the "-Wl,-lcore" reference too early in the linker command, before it's actually needed.  The linker decides those files are irrelevant, doesn't link them, then when it reaches a later library that depends on them, can't find what it needs.  If you are linking with that method, you need to edit the Makefile by hand and move those flags to the very end of the command.  I'm fairly certain this wasn't fixed in 5.1.

Not sure if you've seen it but we have more background on that issue in our tutorial here: http://www.engblaze.com/tutorial-using-avr-studio-5-with-arduino-projects/#setup

Unfortunately, we use the pre-compiled strategy in that article because people tend to run into enough configuration issues already, without trying to get the core to compile.

If you really want to be device agnostic, have you tried adapting techniques #2 and 3 in the core library section for setting up Eclipse?  http://arduino.cc/playground/Code/Eclipse#Arduino_core_library

The interface steps will be different but Eclipse and AVR Studio use the same toolchain under the hood.

5  Using Arduino / Programming Questions / Re: Trying to get good with Programming Arduino on: April 16, 2012, 11:57:42 am
Hi Vik,

As cyclegadget suggests, Tronixstuff is an excellent free resource, it will serve you well.

If you're interested in further options, we maintain a list of our favorite Arduino books here: www.engblaze.com/best-arduino-books/

Several of them go in-depth on basic C++ programming concepts and most have an array of projects to help you apply your skills.  Good luck learning!
6  Using Arduino / Programming Questions / Speed of math operations (particularly division) on Arduino on: February 18, 2012, 05:31:44 pm
We ran into some performance issues on a recent project and were curious as to how various operations affected execution time.  The common wisdom is that division is slower than multiplication or the other standard operations.  We looked around for some Arduino-specific data but didn't find much, so we decided to run some brief tests ourselves: http://www.engblaze.com/faster-code-fridays-understand-division-and-speed-of-operations/

Interestingly, division is much slower than other math.  As one of our commenters points out, the 8-bit AVRs handle integer multiplication, addition, and subtraction in hardware, but have to generate code for division.

Normally there are other things to worry about first when you're tackling code optimization, but the difference is so stark that it's something to keep in mind if you're doing serious number-crunching.
7  Using Arduino / Programming Questions / Re: Make a LED blink while doing some heavy number crunching on: February 18, 2012, 05:12:34 pm
Elegant solution Nick.  For more information on timer interrupts and how they are set up, we have a tutorial here: http://www.engblaze.com/microcontroller-tutorial-avr-and-arduino-timer-interrupts/

It covers configuration and the pros/cons of each timer that Jack mentions.
8  Using Arduino / Programming Questions / Re: Time controlled Interrupt on: February 09, 2012, 10:52:57 pm
Hi mattallen,

Take a look at our tutorial on timer interrupts here: http://www.engblaze.com/microcontroller-tutorial-avr-and-arduino-timer-interrupts/

By properly configuring the built-in timers on your Arduino, you can trigger an interrupt after almost any specified time interval.  If you want to change the interval in between interrupts, you'll need to disable interrupts, then reconfigure your timer settings with the right values.  The tutorial examples configure the timer in the Arduino setup() routine; for your project, you'd likely want to move that code into a custom timerSetup() function so you can call it multiple times.  You could write it to take a certain parameter, for example timerSetup(interval), and have the function set the timer registers to count for that amount of time.

Out of curiosity, what's the Arduino doing in between interrupts?  If there's nothing critical going on, it might be easier to have it focus only on sending pulses at the right times using micros() or similar.  Interrupts will allow for more precision and asynchronous events, but will be more work to get running.
9  Topics / Education and Teaching / Re: Mike McRoberts - Beginning Arduino on: February 06, 2012, 03:45:42 pm
@Engblaze
I like it that you put 6 books in your top five booklist smiley-wink

Haha nice catch! That last one was a last-minute addition.  Someone *cough* wasn't performing their editing duties very well...

As for the book source code, I was able to download it at that link and unzip fine using WinRAR.  Maybe try a different archive program?  WinRAR is worth the shareware nagging IMO, but you could also try the open-source 7-zip.
10  Topics / Education and Teaching / Re: Mike McRoberts - Beginning Arduino on: January 14, 2012, 08:37:57 am
We spotted a few code errors in our copy as well, which is a bummer.  However, the book is an excellent resource overall, and avoids the extremes of other Arduino books.  Many beginner texts go for the "cookie cutter" approach, where the examples are self-contained and dry, while others go for the "zany basement project" path, where the whole book is dedicated to building only a few complex projects step by step.  Beginning Arduino strikes a good middle ground, building on previous examples to do more interesting things, but keeping concepts modular so you can use them elsewhere.  If you don't mind debugging the occasional typo, we'd still recommend this one.

Beginning Arduino is McRoberts only Arduino book as far as we know... Apress publishes a number of similar texts, but we prefer this over Practical Arduino or the like.  If you're looking for more info on some popular choices for Arduino books, we also have an article on our website, Engblaze: http://www.engblaze.com/best-arduino-books/
11  Topics / Education and Teaching / Re: Changes in the Arduino 1.0 release: How to migrate your existing projects on: January 14, 2012, 08:24:27 am
Hi Liudr,

Thanks for the additional resources.

One note about your blog post: the NewSoftSerial library is now the default SoftwareSerial library included in Arduino 1.0. No need to stop using it or go to Mikal’s website because it’s packaged with the core installation. Anyone who was using it can upgrade and simply change the relevant #include statement (though he actually renamed the latest version “SoftwareSerial” in preparation for the release).
12  Topics / Education and Teaching / Changes in the Arduino 1.0 release: How to migrate your existing projects on: January 11, 2012, 10:30:29 am
For anyone that hasn't made the switch to Arduino 1.0 yet, we've put together a guide on what needs to be changed in your existing code to get up and running:

http://www.engblaze.com/changes-in-the-arduino-1-0-release/

This info is available in the release notes and through official sources, but sometimes it's a pain to sift through all of the gritty details.  This article attempts to distill the most important points.  Comments and suggestions are welcome.

Hope you find it useful!
13  Using Arduino / Programming Questions / Re: Waking from sleep mode. on: October 30, 2011, 09:24:57 pm
    goto loop():
Using goto is generally considered poor programming practice because it leads to ambiguous program flow.

Because when I put it to sleep it will be asleep for weeks or months. In that time parameters would have changed. There is no point of the sketch running based on old data. When I want it to wake up I want it to run from the start of the sketch as if power has just been applied to it and reread its inputs.
There should be several ways to accomplish what you're trying to do.  Nick's tip on structuring when sleep is called is one valid method.  Or, how about writing a function that refreshes the variables you need and calling it immediately after sleep? 

If you really needed to start things over, you could do something like this:

Code:
void loop() {
    while (1) {
        doStuff();
        if (sleepyTime) {
            sleepNow();
            break;
         }
    }
}
14  Using Arduino / Project Guidance / Re: Some advice on power efficiency on: October 22, 2011, 11:00:36 pm
In research i came to the conclusion that using Lithium Polymer would be the best battery for long term power- am I correct? and using a single 700mAh LiPo could technically last to 5 years. Is this lifetime of a battery even feasible?

We haven't had any projects run for years yet, but it's feasible, and I know of others that have.  If you use rechargeables, you may lose some of your battery energy just due to normal discharge over time, regardless of whether the Arduino is drawing power.  LiPo/Li-ion is the best option in terms of energy density, but if you don't care about size/weight, other options might do the trick for less money. 700mAh isn't huge, so you have options.

Keep in mind that if you're using a standard Arduino board there will be other components on it that are always drawing power, such as the voltage regulator and FTDI chip.  To get maximum power savings, you'll have to use a custom board.

We've been working on compiling info on sleep modes on our site and just posted our first article on the topic, you can check it out for more info: http://www.engblaze.com/2011/10/hush-little-microprocessor-avr-and-arduino-sleep-mode-basics/

The second part is- Is it possible to store simple small integers inside the Arduino non-volatile memoery somehow to avoid keeping it in RAM and using power?

Yes, with a bit of additional work.  You can use PROGMEM or EEPROM to store data long-term, they're both non-volatile: http://www.arduino.cc/playground/Code/EEPROM-Flash.  However, if your chip is sleeping but still on in order to record ticks from time to time, you can still use RAM.
Pages: [1]