1

I am developing a product, and to ease my job i am planning to use MCU inside the arduino with the library of Arduino.

Since all the registers are already defined inside the library, and all required things to registers of corresponding MCU are done to "make a pin input/output , enable interrupt , enable UART , enable I2C". I think that i can directly use the arduino coding enviroment even if i use MCU seperately.

Is it possible and how? (can i use it in commertial product, i have already prototyped it with arduino)

3 Answers 3

1

Yes, you can. Once you have a .hex file for a specific MCU and environment you can use a programmer to upload it to a discrete MCU.

7
  • Does arduino coding enviroment generate Hex file? Normally i was Pic, Intel user however, i did not see the compiler generate hex file. Should i need to use just its library and insert into another coding environment and how?
    – kara
    Commented Feb 11, 2015 at 1:11
  • Other questions on this site discuss both the .hex file and the use of alternate development environments. Commented Feb 11, 2015 at 1:15
  • Actually, i am not asking hex file issue, i am asking that if we use USB-serial circutry, and just burn bootloader to the MCU via this then just upload the code we wrote... doesn't it work for all arduino used MCU's ??
    – kara
    Commented Feb 11, 2015 at 1:27
  • Why would you add the cost of a serial interface to your product instead of using the built-in ISP capability? Commented Feb 11, 2015 at 1:29
  • Yes actually, i can use my arduino to code the MCU...
    – kara
    Commented Feb 11, 2015 at 1:33
0

Ignacio said everything is needed. Just search on google :) You can use programmer like khazama.

Also you can use arduino board to program atmel chips. Using an Arduino as an AVR ISP

And now you need only .hex file to upload to your chip

How to find .HEX

I just want to point out one thing. Do not play with lock bits:)

3
  • @PeterR.Bloomfield :))
    – Martynas
    Commented Feb 11, 2015 at 11:59
  • I know khazama. Such uploaders also used for PIC microcontrollers 16F877 etc. I have already used them, but i am planning to use the chip in arduino MEGA or Leonardo, which are surface mount... Therefore, it seems that i need to use ISP...
    – kara
    Commented Feb 12, 2015 at 2:35
  • Thats not right. You can use USB-TTL converter like it is done in Arduino. There are many schematics and tutorials how to write bootloader and so on. Surface mount you mean mega2560 TQFP package? I do not understand your argument.
    – Martynas
    Commented Feb 12, 2015 at 6:05
0

You can program an AVR microcontroller easily with an existing Arduino as the programmer. AFAIK there's no easy way around SMD packages. The last time I've gotten them, I have to solder programming wires on them before placing it on the board. If you have space, you can also wire the ISP pins to a connector on the board.

In any case, here are the steps to program your chip, whether DIP or SMD.

  1. Upload the Arduino ISP Sketch to your Arduino board's MCU.
  2. Wire up the Vcc and GND, and the SPI pins (MOSI,MISO,SCL). (The wiring is actually described in the comment section of the sketch. As for the pin out on the ATmega328, go to page 3. You can find similar datasheets if you're using other MCUs.)
  3. Write your code
  4. Click "File>Upload using programmer" or just press Ctrl + Shift + U.
  5. Done!

I think most AVR MCUs come with an internal calibrated resonator, but if you want to drive it at a higher speed (16MHz/20MHz...) you will need to connect the MCU to a crystal oscillator. As always, refer to the datasheet. ;-)

Here's another link you can refer to: link

Hope this helps.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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