Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Should I begin with Arduino?

Status
Not open for further replies.
Hi misterT,
Did you mean the Atmel Studio 6.2 Beta? I have Win 8.1 on my laptop.
I bought 3 extra 328 uControllers. The one that was on the board I boot loaded with the Arduino IDE.
I want to boot load a different chip for the Atmel Studio 6. All I see on the webpage is 6.1 & 6.2.

The Atmel Studio 6.2 Beta is good. Go with that. I have not found any problems with it so far.. only improvements.

If you do not have a programmer, then you need a bootloader in the uControllers and then use the arduino software to program the hex into the uC.. or you can use the arduino as an In System Programmer..
 
Hi there misterT,

What would you say the learning curve looks like for the Atmel Studio 6 or whatever? I am new to the Atmel chips more or less coming in from a PIC background.

Can you program Sketch's from the Arduino library with that too? How about the bootloader, can you burn a bootloader from Arduino?
 
Hi there misterT,

What would you say the learning curve looks like for the Atmel Studio 6 or whatever? I am new to the Atmel chips more or less coming in from a PIC background.

Can you program Sketch's from the Arduino library with that too? How about the bootloader, can you burn a bootloader from Arduino?

That is difficult to answer because I have not used that arduino stuff. Atmel Studio is really good IDE (Integrated development environment). It uses the same compiler as Arduino IDE (avr-gcc). Just create your project using the wizard (just select "GCC C Executable project" and what AVR you are using).. and start coding. When you compile your project you get an .hex file that you can program into the avr with the arduino tools, or some other tool.. no worries. It is the same kind of .hex file you get if you use Arduino IDE. The Atmel Studio also has some pre-set projects for Arduinos.. I have not tried them.
I feel I am rambling.. ask more if something was confusing. The Atmel Studio is free (no limitations).. try it. And you will love the avr-libc documentation.
 
Last edited:
Hi misterT,

Actually, thanks for the information even if it seems like too much to you because i would rather have more information than not enough. This sounds like just the right amount though :)

The Studio sounds very interesting now. I was thinking about it for awhile and was wondering if it would work with the Arduino as ISP, which is really an ICSP. Right now that's the only programmer i have for the AVR chips. The Arduino board is set up to be a programmer with the ArduinoISP sketch, and after that it programs external chips jumped to the headers on the board. If that works with the Studio too that would be nice so i dont have to buy another programmer.

I also wanted to look into the Xmega chips as they have some features i can use. Have you worked with any of those yet or do you know if they can be programmed the same way with the same programmer?
 
I also wanted to look into the Xmega chips as they have some features i can use. Have you worked with any of those yet or do you know if they can be programmed the same way with the same programmer?
Xmega works with same programmers and compilers, but the chip is different from other "mega". It is really clever design.. the registers for all peripherals are structured so that you can easily map C structures in a standard way to them etc... but I would not jump to xmegas until you really want to or really need to.. For Xmegas you really need to change some fundamental ways of thinking.. but xmega is a really nice uC design.

I changed to xmega when I needed very fast and good random number generator.. I got up to few tens of kHz if I don't remember exactly.. may have been over hundred kiloherz.. and that was with the hardware.. so while the random numbers were generated I could do some other stuff. I can try to find some details about the rng if you are interested how I did that. I used the crypto-engine, DMA, and event-system to accomplish very efficient hardware rng.
 
Last edited:
The Atmel Studio 6.2 Beta is good. Go with that. I have not found any problems with it so far.. only improvements.

If you do not have a programmer, then you need a bootloader in the uControllers and then use the arduino software to program the hex into the uC.. or you can use the arduino as an In System Programmer..
Hi misterT,
Thanks for the info. I haven't tried using the Studio6.2 yet.
Right now I'm just learning the Arduino with the books and learning. I'm new to all of this and also disabled so it will take a little while. I can't put in the time like I used to be able to do.
As far as programmers, all I have are a MiniPro TL866CS and another cheap Chinese made EEPROM programmer that I bought to program EEPROMs for TVs. The MiniPro doesn't seem to work right, and the support is in Chinese......
It worked for Dave on eevblog, but he was using Win7.
This Arduino seems real cool!
 
Hi misterT,
Thanks for the info. I haven't tried using the Studio6.2 yet.
Right now I'm just learning the Arduino with the books and learning.

That is good. I agree with Ronsimpson in post #4.. it is important to have fun and play. The Arduino is a good board because you get to go straight to doing something that gives you that feel of "accomplishment". And you do not have to buy any tools.. just plug in the arduino to your usb-port and you are set. You can also go "pro" (from programmers point of view) when you feel like you want to take that step. You can learn C, Basic, Assembly etc. to program the chip.

Your first goal could be to set up UART communication so that you can send messages to your computer. I can recommend a good terminal program: Putty https://www.putty.org/
 
Last edited:
Thanks misterT. I appreciate the help and good links.
 
Why turn your back on Arduino IDE? It comes with a lot of code for various example mini-projects to help the learning experience. The code from these can become a basis of projects of your own. Lots of the examples demonstrate libraries you can download which will help interface with lots of nice (often cheap ebay etc) hardware sensors, displays, motor drivers etc.

The IDE comes with a serial monitor to display serial output from your program which can be invaluable for debugging, and can pass PC keyboard input to your code. An Arduino board comes with a boot loader already installed which works with the IDE. On the Arduino forums there's a very active community of users who can provide help.

It seems a shame to make life more difficult for yourself by ignoring half the stuff people have worked on to make it easy for everyone.

PS The IDE supports three major platforms: Mac, Linux and MS Windows, not just the latter.
 
Last edited:
Why turn your back on Arduino IDE?

...

It seems a shame to make life more difficult for yourself by shunning half the stuff people have worked on to make it easy for people.

But than again, why bother with Arduino IDE when you can buy a pre-made device which will be way cheaper and will work better than the one you design on your own.

It seems a shame to make life more difficult for yourself by shunning the stuff engineers have worked on to make it easy for people.
 
Why turn your back on Arduino IDE? It comes with a lot of code for various example mini-projects to help the learning experience. The code from these can become a basis of projects of your own. Lots of the examples demonstrate libraries you can download which will help interface with lots of nice (often cheap ebay etc) hardware sensors, displays, motor drivers etc.

Yes, the IDE is good for getting things done and having fun, but still, it is a toy.

The IDE comes with a serial monitor to display serial output from your program which can be invaluable for debugging, and can pass PC keyboard input to your code.
You mean a terminal? Putty is the best terminal program I know. And it is free. With it you can log your output data into a file, copy-paste it into excel and plot into a graph.. Nice way to debug and use ADC data.. test digital filters etc.

On the Arduino forums there's a very active community of users who can provide help.

I don't think Arduino forums can answer questions like "why is both brown-out and external reset bits set after ISP programming the chip". Or, "how can I find out my stack size?". Ask that in the AVR-freaks forum and you'll get your answer.

Have you tried the free Atmel Studio? Simulator is only one good reason to use it. It is just far better IDE than the Arduino "IDE" (which is essentially only a text editor).

The board is good basic board. Comes with a bootloader, gets its power from USB, and the usb acts as virtual serial port.. perfect for beginners and hobbyists.
 
Last edited:
Hi again,

Im still playing around with the Arduino platform in an attempt to evaluate this interesting tool for writing code for some microcontrollers. For now my opinion is divided a little. On the one hand there is lots of example code. On the other hand if you want to do anything special you really have to understand the whole library.
Interrupt support may be limited. It appears that there are interrupts for pins but not for peripherals, so i have not found out yet how to use an interrupt for the ADC after putting the chip to sleep. It might be simple or more complicated, but i just havent found out how to do that yet. I've only written one application so far too, but if it is just basic stuff it's pretty fast and relatively easy.
Supposedly you can enter asm code too just like with a regular C language, but it may be limited im just not sure yet.
 
... just like with a regular C language, but it may be limited im just not sure yet.

The Arduino IDE uses the same tool-chain (compiler is avr-gcc with AVR-Libc library) that comes with Atmel Studio. That is pure C. Very good compiler and library.

Only thing is that the Arduino framework, which is build on top of avr-libc, makes it look like it is not "regular C".

Arduino "framework" hides the "scary" main() function from the user by hiding this piece of code:
C:
#include <Arduino.h>

int main(void)
{
   init();
   #if defined(USBCON)
      USBDevice.attach();
   #endif
   setup();
   for (;;) {
      loop();
      if (serialEventRun) serialEventRun();
   }
   return 0;
}

And the worst thing with arduino framework is that it is C++

I hate movies that think the audience is stupid.. and Arduino sketch does just that.. it thinks that you are stupid. Use the board, it is good. Have fun with arduino sketch. Code seriously with "vanilla" C. Atmel Studio is good IDE for that. When things get really serious, whip out inline assembly.. Atmel Studio is good for that job too. If you want to write pure asm programs.. Atmel Studio.

When you go down the "arduino road" you end up with all this "**broken link removed**"; You think you are being smart when you are only discovering the basics.
 
Last edited:
Hello again misterT,

Oh so it's the same compiler then?

What is wrong with using C++ ?

I take it that main() function is in the bootloader? If so then i guess the bootloader would have to be changed for some things.
All i really want to do is set an interrupt routine that is called when the ADC done interrupt is generated. Any ideas without modifying the whole bootloader?

I find the platform interesting but yes it's mostly basic. Still i have already found it useful making a couple timer programs with LED's and four digit seven segment display.

Compared to PIC asm, after fooling around with a low end PIC chip for maybe an hour i was reasonably sure i could get it to do whatever i wanted it to do. But somethings were not going to be easy. After fooling around with the Arduino platform for a few weeks now im still not sure what i can and can not do without too much trouble doing it.
 
What is wrong with using C++ ?
C++ is an extension to C. The goal of C++ is to be Object Oriented language. The main use of C++ is in really large and complicated software projects. When you program microcontrollers, plain C is "lean and mean".. C++ is just uselessly complex. Use C++ only when you have a good reason to use it.. most times the reason is that you have no other option.


I take it that main() function is in the bootloader? If so then i guess the bootloader would have to be changed for some things. Any ideas without modifying the whole bootloader?
No, no, no.. bootloader is just a piece of code that helps you download the actual code (that you have written and compiled) in the AVR program memory. After that the bootloader does nothing. The code you wrote and uploaded is executed and main function is the entry-point of that program.
 
Last edited:
Hi again,

Im still playing around with the Arduino platform in an attempt to evaluate this interesting tool for writing code for some microcontrollers. For now my opinion is divided a little. On the one hand there is lots of example code. On the other hand if you want to do anything special you really have to understand the whole library.
Interrupt support may be limited. It appears that there are interrupts for pins but not for peripherals, so i have not found out yet how to use an interrupt for the ADC after putting the chip to sleep. It might be simple or more complicated, but i just havent found out how to do that yet. I've only written one application so far too, but if it is just basic stuff it's pretty fast and relatively easy.
Supposedly you can enter asm code too just like with a regular C language, but it may be limited im just not sure yet.
I'm interested in using the interrupts too and found this useful page from Nick Gammon: https://gammon.com.au/interrupts
It lists the interrupts available and the vector names to use for each.
 
Last edited:
Hi again,

elfcurry:
That link looks very helpful, that could be just what i was looking for. Thanks for posting that link.

misterT:
I take it you dont like C++ at all. I dont mind it as long as it wont make the code much bigger.
Also, C++ is nice when someone else writes a program as they can encapsulate it for others to easily use.

I had thought that maybe the bootloader was part of the Arduino system, like for built in function calls too.
But what you are telling me is that ALL of the program code is built and uploaded on a case by case basis. I dont mind that at all, so all i would have to do then is find the 'main()' program entry point in one of the header files i guess, right?
I also wonder now if i am even using the bootloader because i switched to using the three wire programming interface, using the Uno to program external chips.

Thanks for the info BTW, i'm very new to this system coming from a mostly PIC asm code base. In asm if i wanted an interrupt geeze i just told it to interrupt (enabled ints) and then did a little decoding in the ISR.
 
I had thought that maybe the bootloader was part of the Arduino system.

Yes and no.. If the chip has a bootloader in it, then you can use it to download code in the program memory. You just need to know how to communicate with the bootloader. Professional bootloaders take data in encrypted form etc. But the arduino bootloader is very simple and there are many PC programs that can upload a hex file to it.

I also wonder now if i am even using the bootloader because i switched to using the three wire programming interface, using the Uno to program external chips.
You are not using the bootloader then.. Your external chips probably do not have a bootloader.
 
Hi misterT,

The 328P chip does have a bootloader because i had burned that into it thinking at first that this was mandatory. But then i was thinking about the ATTiny which i programmed which does not have a bootloader, yet that programmed just fine too and the program runs normally. I can also tell that the 328P has a bootloader because there is a small delay during startup.

So maybe my guess that the bootloader is only needed when we want to program the chip using the Rx and Tx terminals (two wire). I had not tried that yet but it might be interesting too. I probably dont need that functionality however.

After reviewing yours and elfcurry's links i am starting to see that maybe the Arduino issues are just a matter of documentation. The Arduino site is not as helpful as it looks like it is at first or else maybe the stuff is too hard to find. It is also misleading sometimes. Some of that info might be outdated. It does get you started, but for the real story you need to look elsewhere too.
For example, if those interrupts work the way it looks (in this new documentation) then using an interrupt for an on chip peripheral will be pretty simple. I'll have to try that soon.

Thanks again for your information and if you have anything else to add that might be helpful please do.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top