3

I think the arduino board is awesome. Though I'm not interested in the library and IDE at all... Is there a way, to use an AVR 328p, as you normally would, on an arduino board?

I like how arduino's can be programmed through serial, can get powered through serial and I often use serial as a debugging option. Making my own board (with ICSP programmer) would not be able to do this (withouth bootloader).


The Question

Do I have to use all the stuff from arduino?

  • Can I use my own compiler for an arduino board? (GNU-GCC / AVR)
  • Can I use my own IDE for an arduino board? (Eclipse / Atmel Studio)
  • Can I still program through serial then? (Does the bootloader care which compiler I used? Does Eclipse/AVR studio have the options to program through serial?)
  • Other stuff I should take in mind. (Annoying things like AVR studio not having a COM port window, though that's an easy fix.)

Edit: We've programmed an AVR 328P (GNU-GCC / Eclipse / ICSP) in school, so I know it takes quite some work to get the compiler set up, working with Eclipse. You don't have to completely describe the proces :) Just to avoid someone spending hours on an answer that's easily found on the internet. (On my search for this subject I could only find people doing the other way around, getting an 328p chip to work with arduino)

  • Hope this helps. If my answer is insufficient, you can suggest me improvements for the comments. – Avelino Mar 23 '15 at 20:27
  • FYI, the Arduino IDE works on top of avr-gcc, the GNU binutils and avrdude. The Arduino core library is built on top of avr-libc. If you wish, you can use the library without the IDE and vice-versa. – Edgar Bonet Mar 23 '15 at 21:35
  • I actually didn't know that, sounds interesting. I just don't want too much overhead. The bootloader is okay I think as it enables the serial uploading of code, which is great for my user experience. But apart from that I try to make it as "professional" as possible, how people in real companies work. (Please don't take this as an 'insult'). I believe Eclipse is easier to use, but was worried it might not work as well with the arduino (uploading through serial). And personally I don't like it to use libraries (though I probably will for some things) but mostly from the chip manufacturer self. – Paul Mar 23 '15 at 21:49
2
  1. Do I have to use all the stuff from arduino?

A = No!

  1. Can I use my own compiler for an arduino board? (GNU-GCC / AVR)
  2. Can I use my own IDE for an arduino board? (Eclipse / Atmel Studio)
  3. Can I still program through serial then? (Does the bootloader care which

Of Course! I use Eclipse IDE and I programming boards with Arduino bootloader directly in C/C++ using avr-gcc and avrdude.

Configuring Eclipse

First, let's download a plug-in for integrating AVR GCC and Avrdude + Eclipse IDE

To install the plug-in, point to the menu "Help> Install new software":

enter image description here

We will set a new location to download the plugin. Click the "Add ..." and type: AVR - Eclipse and the URL: http://avr-eclipse.sourceforge.net/updatesite

enter image description here

Now select the plugin that appeared in the list and click "Next":

enter image description here

Next, next, "I Acept the terms...", restart...

Now we install the plug-in, we will set it up. Point to the menu "Window> Preferences." Click in "AVRDUDE". The following screen:

enter image description here

On the next screen "AVR DUDE" let's set our recorder. Click "Add" to "Programmer configuration". Search for "Arduino".

enter image description here

Or, if you prefer, you can program making use of avr libraries in own Arduino IDE. Try to upload the following code into an Arduino board! While a blink costs almost 1,056 bytes of memory using an Arduino Uno, the following code uses only 164 bytes and does the same thing :)

#define F_CPU 16000000UL    
#include <avr/io.h>         
#include <util/delay.h>     

#define set_bit(Y,bit_x) (Y|=(1<<bit_x))    
#define clr_bit(Y,bit_x) (Y&=~(1<<bit_x))   
#define tst_bit(Y,bit_x) (Y&(1<<bit_x))     
#define cpl_bit(Y,bit_x) (Y^=(1<<bit_x))    

#define LED PB5         

int main( ){
    DDRB = 0xFF;        

    while(1){               
        cpl_bit(PORTB,LED); 
        _delay_ms(200);     
    }
}

If you use Linux, you can take a sudo cat/dev/ttyACM0 to detect what lies serial and echo "string" >> /dev/ttyACM0 to send data.

  • This is (I believe) exactly how we did it at school. Though would this still enable me to program the arduino through the serial connection? Withouth an ICSP/USBasp programmer? – Paul Mar 23 '15 at 20:27
  • Yes, you can program it without a ICSP/USBasp programmer. Just change the recorder's type to "Arduino" on Eclipse IDE. I did not have another example of photo, in my photo is "USBasp" but just search for Arduino and exit programming. You can also use the Arduino IDE typing code directly in C ++. Test my example :) What is your Arduino board? Well, she must have a conversion circuit Serial/TTL. Sometimes is a ATmega8 sometimes one FTDI chip. (Sorry my english) – Avelino Mar 23 '15 at 20:34
  • I've not yet bought an arduino board. Though I think of going for an arduino nano breadboard (USB), one of those you can put on a breadboard. They seem to have ICSP header also, but I think it's inconvenient to have 2 USB's going to your PC (one for serial and one for uploading code) But if it's so that I can upload code through serial, this is/will be the answer? (It was more towards a theoretical question, though you did really give in-depth explanation, might save me (and others) some time :D) – Paul Mar 23 '15 at 20:37
  • I recommend you buy an Arduino Uno. You can take the ATmega328P and put it on a breadboard and can write the bootloader in other chips (bootloader is a firmware header responsible for writing the code for serial). What about the upload, you'll use only one USB. When recording via ICSP is used SPI communication. But the Arduino can be recorded by the same Serial and Serial port is for communication. In my projects I use Eclipse and I record my atmegas using an Arduino board. Then just take them out and add the PCB project. – Avelino Mar 23 '15 at 20:50
  • See this and this – Avelino Mar 23 '15 at 20:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.