Arduino Forum

Using Arduino => Microcontrollers => Topic started by: Matti on Jan 31, 2017, 09:07 pm

Title: Atmega328P standalone
Post by: Matti on Jan 31, 2017, 09:07 pm
Short question.

Can I upload a sketch to my Arduino Uno with a Atmega328P, unplug the chip, transfer to breadboard and proceed like nothing happend?
Obviously I will add a crystal, a resistor and two capacitors.

With is the minimum build if I prefer to unplug-n-play like that?

Best, Mathias
Title: Re: Atmega328P standalone
Post by: CrossRoads on Jan 31, 2017, 09:13 pm
Yes you can.
Minimum recommended hardware (what I use):
328P
16 MHz crystal
two 22 pF caps
4 100nF (0.1uF) caps - Vcc, Avcc, Areft to Gnd (Do Not connect to 5V), DTR from FTDI Header
10K pullup resistor
ICSP header
You can see the parts here on a 40-pin '1284P test board - 328P is the same, just a smaller 28-pin part.
(http://www.crossroadsfencing.com/BobuinoRev17/1284_test_board_ICSP_FTDI.jpg)
I've since soldered a ZIF socket on top of the machine sockets for bootloading parts.
Title: Re: Atmega328P standalone
Post by: Matti on Jan 31, 2017, 09:18 pm
Thank you for a quick reply.
Exactly the answer I hoped for.

I just can't make my Atmega328P's work as standalone.

I felt like I tried every single tutorial out there, and nothing works, now my 3 microcontroller doesn't even seem to work anymore.

You know of a good way to check if the chip is dead or it's just the bootloader (again)?
Title: Re: Atmega328P standalone
Post by: CrossRoads on Jan 31, 2017, 09:27 pm
Does it (they) work when reinstalled back in the Uno? If so, then it's a wiring issue.

I've wired up plenty of boards just like this, usually without the diode (it keeps any high voltage spikes on the reset from kicking the part into High Voltage (12V) programming mode and looking like its hung).

Check your Rx/Tx, pins, make sure they're not swapped, and that Reset is actually at Vcc.

(https://forum.arduino.cc/index.php?action=dlattach;topic=452291.0;attach=196999)
Title: Re: Atmega328P standalone
Post by: Matti on Jan 31, 2017, 09:35 pm
Looks like a really interesting scematic you got there. If you upload the sketch while the chip is in the board, doesn't that make Rx/Tx, SCK, Mosi and Miso redundant? I mean, I just wanna run a seriously low power blink sketch for starters.

No, the chips doesn't seem to respond when plugged back into the Uno. I get a:
Code: [Select]
Sketch uses 1,028 bytes (3%) of program storage space. Maximum is 32,256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2,039 bytes for local variables. Maximum is 2,048 bytes.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x3a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x3a
avrdude: stk500_recv(): programmer is not responding


I tried holding the Uno's reset button, but get no reply of any sort.
Title: Re: Atmega328P standalone
Post by: CrossRoads on Jan 31, 2017, 09:44 pm
Redundant - depends what your plans are for the pins. Not too many projects get programmed and work without needing some tweaking.
Interesting? This is basically the Promini in DIP format and without the voltage regulator.  Nothing special about it.\

Are you sure the parts are bootloaded?  You need a Programmer to do that (Uno running bootload installing sketch, or a real Programmer - I use Atmel AVR ISP MKii, others use USBASP, or something like this
https://www.sparkfun.com/products/9825 (https://www.sparkfun.com/products/9825)
Title: Re: Atmega328P standalone
Post by: CrossRoads on Jan 31, 2017, 09:49 pm
Lot on amazon too.
https://www.amazon.com/s/ref=nb_sb_ss_c_2_12?url=search-alias%3Delectronics&field-keywords=usbasp+programmer&sprefix=usbasp+progr%2Caps%2C714&crid=TK8IJ3PYS0W7 (https://www.amazon.com/s/ref=nb_sb_ss_c_2_12?url=search-alias%3Delectronics&field-keywords=usbasp+programmer&sprefix=usbasp+progr%2Caps%2C714&crid=TK8IJ3PYS0W7)
Easier to have a dedicated tool vs messing with setting up the Arduino every time.
I used an Atmega8 based one for a while, until I misplaced it, then got the AVRISP MKii and have never gone back (despite having found it again eventually).
Title: Re: Atmega328P standalone
Post by: Matti on Feb 01, 2017, 09:41 am
I should probably get me a real programmer.

My lack of patience usually results in too many workarounds.

Thanks for the replies, I will try to set up a "bare minimum".