Million-and-one noob q:s about Programmers, Programs, Programming and Pragmatism

tl;dr - scroll down

Basically I want to start programming microcontrollers. My final plan is to do a take on the drones America uses to kill people abroad without consequence, using no weapons, no killing, a remote car, and using the Internet instead. So basically no resemblance whatsoever :slight_smile:

I've been researching for some days now but have reached no conclusion whatsoever of what this Arduino stuff is about.
Can someone explain what the Arduino IDE is all about? Mind you, I will use exclusively C for my initial stage of the project, do you code in C in the Arduino IDE? No information is available on this. All the code I've seen uses some sort of setup-loop-scheme that I don't want to get involved in.

My earlier projects include context-switching "kernels" in C on an AVR Butterfly, assembler-programming of the same kind on a MIPS-emulator and a remote controlled car (without the remote controlling) that follows a line, black tape on the floor, using LEDs and recievers and an AT90CAN128 Olimex board. There were no "Olimex IDE"'s back then? So what's the deal?

In the case of the AVR Butterfly I used windows, AVR Studio (or atmel studio whatever) and the AVRISP MkII.
In the case of the AT90CAN128 I used ubuntu, Code Blocks and some programmer for the board, JTAG-something not sure.

tl;dr starts here

Questions:

How do I connect the (for instance) Arduino Pro Mini 3.3V to my computer? If I want to use Atmel Studio (windows)? If I want to use Code Blocks or something with AVRDuDe I presume (linux ,or unix och whatever)? Can I use the AVRISP MkII? If so, how do you plug it in? What's the difference between that and the FTDI Basic Breakout?

What is a bootloader? I've never used it before, not consciously at least. What does it do? What's it tied to, who makes it? Atmel, Arduino, Sparkfun?

What language do you use in the Arduino IDE? C? Some sort of blend? Do you use Atmel-datasheets at all, interrupts and pwm-registers etc? Is the arduino IDE better than writing C in Atmel Studio for instance? Does it simplify things or obscure?

So many questions.. Would be grateful if you answered anyone of them, thanks in advance

~tck

Tickstart:
My final plan is to..

So that would make you some potential terrorist.
Good luck with that.

So you're a great coder already and are now considering to start over or what ?
I guess you would understand RTFM then..
How about clicking the Learning and Reference links in the banner you see on top of this very page ?

Mmm, gotta love the snideness on this forum :slight_smile:

Nope I'm not planning on committing any terrorist acts, altough it's wholesome of you to deem America as terrorists (:
Niether am I very experienced or proficient at coding, as the title says, n00b. I just can't find any straight answers to my questions.

Are you as ignorant as me or do you just refuse to tell me? If there are any stupid or weird questions then please clarify why so, these particular boards are a new experience for me.

cheers!

~tck

Me being ignorant would mean not replying at all.
Arduino is for a large part about learning.
To do so, you can ask questions.
If the answer is already available and not too hard to find, you will be directed to that answer.

Wikipedia can help too:

wikipedia:
Integrated development environment, a software application for software development

Questions:

How do I connect the (for instance) Arduino Pro Mini 3.3V to my computer?

Use an FTDI Basic to connect USB.

If I want to use Atmel Studio (windows)?

Use AVR ISP MKii, connect to SCK/MISO/MOSI/Reset pins with breakout cable from the MKii's 2x3 header.

If I want to use Code Blocks or something with AVRDuDe I presume (linux ,or unix och whatever)?

I don't know what Code Blocks is, I've only been using the IDE.

Can I use the AVRISP MkII? If so, how do you plug it in? What's the difference between that and the FTDI Basic Breakout?

Yes. See above.
MKii programs memory directly via the SPI interface pins.
FTDI Basic uses the bootloader to move code into flash memory.

What is a bootloader? I've never used it before, not consciously at least. What does it do? What's it tied to, who makes it? Atmel, Arduino, Sparkfun?

Bootloader interfaces with PC to receive data and store it in flash memory. If data is received, it starts the existing sketch.
Atmel datasheet includes a bootloader example. Arduino/Sparkfun/Adafruit/Nick Gammon/others have written them.

What language do you use in the Arduino IDE? C? Some sort of blend?

C++. There are libraries, macros, functions available so you don't need to rewrite them.

Do you use Atmel-datasheets at all, interrupts and pwm-registers etc?

Yes.

Is the arduino IDE better than writing C in Atmel Studio for instance?

Depends. I can't stand waiting for Atmel Studio to open up, so I don't use it.

Does it simplify things or obscure?

Yes and no.
I'll use digitalWrite sometimes, but if I'm concerned about speed I'll use direct port manipulation.
Same for SPI.transfer( ) of data, I'll write at lower assembly commands if I want it really fast.
Serial comm's with the PC? I'll use Serial.read & serial.print commands all the time mostly for debugging, then comment them out for the final embedded program.

As for your dislike of setup, loop, etc. you can always rewrite main.cpp (main.h? main.c? one of those) to not call them out.

Thanks man, I've glanced over most material I've come over, didn't really read the wiki page all that carefully either.

wiki:
As the Arduino platform uses Atmel microcontrollers, Atmel's development environment, AVR Studio or the newer Atmel Studio, may also be used to develop software for the Arduino.

Right, so I figured, but then how do I connect it? MkII or FTDI? I really have tried to find an answer.

Ok I read up on the bootloader (I did search the archices before, must've skipped that part), it's only relevant when using the Arduino IDE if I'm not mistaking.

Yeah so that basically rules out the FTDI BB? I guess so, but I'm still not sure how to connect the Pro Mini to the AVRISP. This does the trick? (: Just need to find the ISP specs and schematics too..

CrossRoads:

If I want to use Atmel Studio (windows)?

Use AVR ISP MKii, connect to SCK/MISO/MOSI/Reset pins with breakout cable from the MKii's 2x3 header.

Thanks a bunch!! I'm not exactly sure what this means as of yet but.. Will keep for reference!

CrossRoads:

If I want to use Code Blocks or something with AVRDuDe I presume (linux ,or unix och whatever)?

I don't know what Code Blocks is, I've only been using the IDE.

Code Blocks is just another IDE :wink:

CrossRoads:

What language do you use in the Arduino IDE? C? Some sort of blend?

C++. There are libraries, macros, functions available so you don't need to rewrite them.

Can I look up their definitions if I want to use them in my own project outside of the Arduino IDE?

CrossRoads:

Is the arduino IDE better than writing C in Atmel Studio for instance?

Depends. I can't stand waiting for Atmel Studio to open up, so I don't use it.

What do you mean? :smiley: You're that intolerant to load times? x) Get an SSD :wink:

Anyway, thanks guys, you've been very helpful :slight_smile:

Tickstart:
Thisdoes the trick?

Not really.
See the remark there:

Note that this chart is for the DIP-package chip. The Arduino Mini is based upon a smaller physical IC package that includes two extra ADC pins, which are not available in the DIP-package Arduino implementations.

Go to the product page, and find the pro mini.
You will find schematics and all other information.

Atmel Studio will need to use an ISP programmer - connect the AVR programmer header pins to the board -


If there's no header, such as the promini's, then you need 6 wires to from the header to Vcc, Gnd, Reset, D13, D12, D11 for programming.
You can find the header signal locations on the Uno schematic.

Atmel Studio would take minutes to start up vs 30 seconds for the IDE.
Not really being a programmer, I have found the IDE to be sufficient for all my projects over the last 3+ years.

Yes, you can look up the code for the various libraries, etc. They're all included in the IDE files.

As for loop and setup, there is no need to re-write main.h/.cpp if you use the IDE or .cpp files in another compiler. C++ supports function overloading so you can simply provide your own int main() in your local files.

I have started an article on using int main() in relation to the IDE: http://arduino.genx.biz/FAQ/content/2/2/en/can-i-use-int-main-with-arduino.html

Tickstart:
Mmm, gotta love the snideness on this forum :slight_smile:
~tck

I think that if you come here to this forum and start being a bit of a, dare I say it, smart arse with provocative comments like

Tickstart:
Basically I want to start programming microcontrollers. My final plan is to do a take on the drones America uses to kill people abroad without consequence, using no weapons, no killing, a remote car, and using the Internet instead. So basically no resemblance whatsoever :slight_smile:

that you might expect a mixed response. This isn't Facebook ]:slight_smile:
Yet despite this you are still offered help and advice so to continue in this vain have a look at this

Code Blocks is just another IDE

"Arduino" is also "just another IDE", plus a set of libraries (sorta like ASF, only at a different level of abstraction.)

Can I look up their definitions if I want to use them in my own project outside of the Arduino IDE?

Yep. The IDE won't automatically look them up for you; it's pretty minimalist as IDEs go. But there's the Arduino web site "reference page", and all the source code is buried somewhere in the in the code you downloaded (and also on github, if that's easier.)

then how do I connect it? MkII or FTDI? I really have tried to find an answer.

MkII is a programmer, so it would connect to the ISP programming connector. FTDI things are USB Serial ports, suitable for talking to the bootloader. For the former, you'd use the "upload using programmer" option, for the latter, just "upload" (in the Arduino IDE.) For other IDEs, you would have to configure them differently depending on which one you were using.

Ok I read up on the bootloader, it's only relevant when using the Arduino IDE if I'm not mistaking.

A "bootloader" is generally a mechanism for loading code over an "arbitrary" interface, rather than the specific programmer interface implemented by the chip. Code running in the chip implements the interface, and "self programs" the flash. In the case of the arduino chips, the interface used is an Async Serial interface ("UART") In theory, you could set up Atmel Studio with an "external programmer interface" that use the AVRDude application, and program Arduinos over serial interfaces using the bootloader, instead of requiring a real programmer. (This is exactly what the Arduino IDE does.) The elimination of the cost and complexity of separate programmer hardware is one of the "features" of Arduino. Most Arduino boards have the standard atmel-defined 6-pin ISP programming connection, so you can use them with all sorts of Atmel and third party hardware. (However, the Arduino HW interferes with "debugwires", and few arduino boards have JTAG connections (even if they use a processor that supports JTAG.)

The Butterfly was one of the first Atmel Dev boards to have/support a bootloader, BTW. I'm surprised you didn't become familiar with the concept when you were working with it. The concept and code (for butterfly) was described in Atmel App Note AVR109 (the Arduino bootloader is somewhat different.)

Atmel Studio 5 was about 2.6GB of code (for windows.) (I should try that again with 6.1...) Arduino is about 350MB; they use basically the same C/C++ compiler (avr-gcc) (AS has a newer version.)
( http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=116011&start=all&postdays=0&postorder=asc )

Pedro147:
This isn't Facebook ]:slight_smile:
Yet despite this you are still offered help and advice so to continue in this vain have a look at this
Freematics Arduino Builder download | SourceForge.net

Granted :blush:
Thanks for the tip with Code Blocks, The AVRISP MkII is expensive as all hell (like 70 bucks, yeah I don't live in a tax haven precisely..) so I was considering the Pocket AVR Programmer from Sparkfun, but that seems to be limited to 5V-stuff, I'm interested in the 3.3V Pro cause I can use a Li-Po with that one :frowning:
I have no hardware at all at this point, I'm just speculating. So I'm open for suggestions! :open_mouth:

westfw:
there's the Arduino web site "reference page", and all the source code is buried somewhere in the in the code you downloaded (and also on github, if that's easier.)

Cheers, might prove useful.

westfw:
The Butterfly was one of the first Atmel Dev boards to have/support a bootloader, BTW. I'm surprised you didn't become familiar with the concept when you were working with it. The concept and code (for butterfly) was described in Atmel App Note AVR109 (the Arduino bootloader is somewhat different.)

This was my first experience with microcontrollers, for some labs in a realtime systems course at university, so I basically just concentrated on the assignments, the AVRISP worked just fine :cold_sweat: Could've sworn I've seen this document before though... :blush:

westfw:
Atmel Studio 5 was about 2.6GB of code (for windows.) (I should try that again with 6.1...) Arduino is about 350MB; they use basically the same C/C++ compiler (avr-gcc) (AS has a newer version.)
( http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=116011&start=all&postdays=0&postorder=asc )

If you read what I said just above this, with my considerations to batteries and voltage and AVRISP vs Pocket AVR Programmer (like, USBtinyISP or something-rather whatever it was called? Open source stuff), can you give me some suggestions on a good setup..? I've heard that you can get Sparkfun's Pocket AVR Programmer working with Atmel Studio, which is what I'd rather use as far as IDE's are concerned.. But then again, that's designed for 5V, whereas the AVRISP is dynamic in that respect.

Anyways, thanks for the support!

FWIW I use AS6.1 (with the Visual Micro plugin) now for most Arduino code writing (not that I've done much lately), it works just fine and downloads to the bootloader the same as the Arduino IDE, no extra hardware required.


Rob

The Arduino IDE is such a horrid code editor (IMHO) that I avoid it as much as I can. I use Atmel Studio 6 and plain AVR C most of the time now, but the Arduino platform (plus all the third-party libraries for every device under the sun) is undeniably fast and convenient to get from idea to proof-of-concept.

I'm working on my own abstraction framework because I like being able to choose from a wider selection of AVRs. I know there are Arduino "cores" available for a lot of them (probably all the ones I use even), but the Wiring / Arduino core was written to fit a particular era of micros... trying to impose it upon Tinys and larger Megas is not particularly elegant. (Again, IMHO.) No idea if my approach will be any better -- Atmel hasn't made it easy to move code around their portfolio -- but I thought I would give it a try just for kicks.

Cosa is a HAL that is looking very promising, I think it works down to ATtin85 as well and is supported by the UECIDE IDE. Both still being developed but they look pretty nice.

UECIDE is not a full-on IDE like AS, it's more like the Arduino IDE with the stuff it should have.


Rob

The AVRISP MkII is expensive as all hell (like 70 bucks

Where are you shopping? It's only $37 at Mouser.com
http://www.mouser.com/ProductDetail/Atmel/ATAVRISP2/?qs=sGAEpiMZZMv256HIxPBQcA8%252bsNH3cLLR

  • $5 or $7 for shipping.

I think I got one in Oz for ~$20. Either way they cost almost nothing.


Rob

Atmel Studio 5 was about 2.6GB of code (for windows.) (I should try that again with 6.1...)

Ah. Up to 3.4GB. No we're talking!

Yep, none of your wussy little IDEs here, this is the full bloat. I start in in the morning just in case I'll need it after lunch :slight_smile:


Rob