1

So I have 2 Arduinos, and im wanting to remove the chip from one and reset it to like it came from the factory and then breadboard it and attempt to program it using an AVR programmer (Or maybe an Arduino AS a programmer).

Why? Mainly because I want to make sure I can and understand how to program the chips when I order them standalone and on a breadboard.

Is this possible? I imagine the Arduino bootloader will be on the chip and the fuses will be different, but can I over-write them if I decide to just program it as a standalone AVR chip?

Thanks!

1
  • You don't have to do anything. The first time you try to upload a program with an external programmer you will overwrite what was on the atmega
    – frarugi87
    Commented Dec 23, 2016 at 14:10

4 Answers 4

3

Im just trying to learn AVR programming without the I guess "handholding" of arduino functions/etc.

You don't actually need to do anything. You don't need any breadboard, any programmer, nothing.

You can use the Arduino environment, upload facility, and board to learn low-level AVR programming.

Just because the Arduino helper functions exist it doesn't mean you actually have to use them.

The first step on your progression to professional embedded developer is to get to grips with low-level registers. You can do all that from within the Arduino environment. You have access to everything in the Arduino IDE that you have in any other IDE in the way of low-level chip functions. They are functions of the chip, not the IDE.

If you want to progress to a professional IDE and use hardware debugging you can still use an Arduino board. After all, it's just an MCU on a PCB. Just plug your hardware programmer into the hardware programming connector on the board. Why mess around with breadboards and all the trouble that they give with dodgy connections? Just because an Arduino has an Arduino logo on it you aren't forced to use it with the Arduino IDE.

3
  • Cool! So.... I just upload to the Arduino like it was a breadboard, and the arduino bootloader will be overwritten like normal?
    – msmith1114
    Commented Dec 23, 2016 at 16:59
  • The ICSP port is no different to using ICSP on the breaboard. You do exactly the same things. You can (with care) tweak your fuses to suit how you want to work, and flash whatever you want to flash.
    – Majenko
    Commented Dec 23, 2016 at 17:01
  • +1 This is a great way to get into embedded for anyone coming from a software background.
    – shredalert
    Commented Nov 27, 2018 at 11:11
1

I have a sketch that uploads data to various Atmega chips (including the 328P).

Even without an SD card attached you can do things like erase the chip and set fuses. So what I would do is erase the chip (thus the bootloader and any other code are gone), and then set the fuses to the factory defaults.

For the Atmega328P I believe these are:

  • Low: 0x62
  • High: 0xD9
  • Extended: 0xFF
  • Lock: 0xFF

Source: http://www.engbedded.com/fusecalc

1

"and im wanting to remove the chip from one and reset it to like it came from the factory " "Is this possible? "

Yes you can rewrite the atmega328 (used or blank) to reset arduino to factory condition. Yes you can use arduino as a programmer as other answer before implies. If you are using blank new atmega328 you burn new bootloader from arduino IDE to make factory reset arduino uno.

"I imagine the Arduino bootloader will be on the chip and the fuses will be different, but can I over-write them if I decide to just program it as a standalone AVR chip? Is this possible?"

The arduino is a microcontroller development board which of course means you can make the arduinos atmega 328 as standalone on breadboard; in addition to that you can change the fuses to work with different speed crystals-which is what you seem to be asking.

4
  • The thing is im wanting to get away from the arduino environment completely, and run it as an AVR chip on it's own (and only using AVR commands with the AVR IDE)
    – msmith1114
    Commented Dec 23, 2016 at 6:40
  • What you trying to do on AVR that cant be done with an Arduino? Commented Dec 23, 2016 at 6:42
  • Im just trying to learn AVR programming without the I guess "handholding" of arduino functions/etc..
    – msmith1114
    Commented Dec 23, 2016 at 6:46
  • If your just using it to learn AVR then you can use a cheap attiny 13 for one ore two dollars you can get 2 or 5 attiny 13a chips-that maybe a good idea for you. But if you have something more specific in mind-which you dont state in the question- then maybe you need a different atmel chip Commented Dec 23, 2016 at 6:50
0

You can initialize any Arduino compatible MCU easily, the procedures are well documented on the Arduino website.

There is even documentation to allow you to build based on the ATMega8L for a minimal system with no external crystal oscillator. This is a little harder to do, but not much.

2
  • I guess the thing is, im not going to be using the arduino system to program it AT ALL, im going straight AVR.
    – msmith1114
    Commented Dec 23, 2016 at 6:39
  • @msmith1114. If you remove the Arduino bootloader you will need either an ICSP or HV programmer.Just go to Atmel and download their tools, their development environment will default all the fuses. Commented Dec 23, 2016 at 6:57

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.