Go Down

Topic: Trying to use Arduino IDE to program Standalone ATmega328P (Read 260 times) previous topic - next topic

mygodetjy

Current I am working on a project, I was using Promini with ATmega328P inserted on the board to do my test. However, in the real situation I do only have a ATmega328P without the Pro Mini board. I would like to still use Adruino IDE to develop my code base and program the code to the stand alone ATmega328P chip.

I have successfully burned the boot loader into the ATmega328P by using Arduino Uno board. I need some suggestions regarding how to program the code into the ATmega328P.

 

spycatcher2k

Mrs Drew
-=-
http://www.uk-pcb.co.uk - UK PCB Fab Company
I will design & code for you, but I will also charge you (PM me)
If you don't like my answers, realize : I'm not being cheeky, I'm Just trying to prompt you to use your own brain/google etc.

pert

You have two options:
  • Upload over serial. This requires a bootloader installed on your ATmega328P and a USB-serial interface (AKA "FTDI"), such as the one you're using on the Pro Mini.
  • Upload using programmer. This requires an ISP programmer connected to the ATmega328P, as you did when you burned the bootloader. You will need to use the Sketch > Upload Using Programmer method to do the upload.

Robin2

Two or three hours spent thinking and reading documentation solves most programming problems.

mygodetjy

You have two options:
  • Upload over serial. This requires a bootloader installed on your ATmega328P and a USB-serial interface (AKA "FTDI"), such as the one you're using on the Pro Mini.
  • Upload using programmer. This requires an ISP programmer connected to the ATmega328P, as you did when you burned the bootloader. You will need to use the Sketch > Upload Using Programmer method to do the upload.

(1)I tried this method, but I have a difficulty controlling the reset pin. I have to manually ground the reset pin at very proper time otherwise it won't let the chip to upload the code. 2 out of 10 times I was able to do the reset exactly at the right timing. From my understand, each time when the code  finished up the compile, the reset mechanism should take place to tell the chip you are able to upload now after the compilation is done. Could you explain a little bit more on this?

(2)I tried this method too but it shows an error:
avrdude: Error: Could not find USBtiny device (0x2341/0x49)

Do I have to use USBtiny as a ISP programmer since I am using bus pirate from Spark Fun with SPI MOSI,MISO interfaces, maybe plus CS too.

mygodetjy

Have a look at this Arduino on a Breadboard tutorial

...R
Thanks I did exactly the same by following it in the first place with RX TX mechanism, I add the capacitor as required, still I can hardly control the reset timing thing.

Robin2

add the capacitor as required, still I can hardly control the reset timing thing.
Please explain that in a lot more detail - I have never had a problem uploading code to an Atmega328

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

pert

(2)I tried this method too but it shows an error:
avrdude: Error: Could not find USBtiny device (0x2341/0x49)

Do I have to use USBtiny as a ISP programmer since I am using bus pirate from Spark Fun with SPI MOSI,MISO interfaces, maybe plus CS too.
You need to select Tools > Programmer > Bus Pirate as ISP. This option is only available with relatively recent versions of the Arduino IDE/Arduino AVR Boards.

mygodetjy

You need to select Tools > Programmer > Bus Pirate as ISP. This option is only available with relatively recent versions of the Arduino IDE/Arduino AVR Boards.
That works very well. Thanks!

Go Up