Author Topic: Programming an external ATmega168 with an Arduino Duemilanove  (Read 16464 times)

0 Members and 1 Guest are viewing this topic.

Offline bsiswoyo

  • Contributor
  • Posts: 7
  • Country: id
    • Bambang Siswoyo
Re: Programming an external ATmega168 with an Arduino Duemilanove
« Reply #25 on: July 24, 2012, 01:54:18 am »
First of all; I'd like to apologize if there has been a topic on this already.

My goal is to program the QFP ATmega168 that has been integrated into my product.

I have a standard 6-pin ICSP connector on the rear of my housing that connects to the following pins on the ATmega168:

4,6,18:  +5VDC
17:         SCK
16:         MISO
15:         MOSI
29:         RESET

I also have an Arduino Duemilanove with an ATmega328.

What do I need to do to program the blank ATmega168 and start uploading sketches to my product?

Thank you kindly.

dear,

If you want to create your own ATmega168/328 Arduino with the Arduino IDE of ver 1.0.1 , would fail to upload program using serial.

Due on the arduino of 1.0.1 version setup the configuration upload protocol to  "Arduino. This configuration on folder hardware/boards.txt.

You have to turn it into a STK500, because it uses a USB-to-TTL-serial dongle.

More details visit my blog:
http://bsiswoyo.lecture.ub.ac.id/2012/07/arduino-1-0-1-serial-upload-using-with-handmade-board-of-atmega328/

Best Regard
Bambang Siswoyo
Bambang Siswoyo
 

Offline Randall W. Lott

  • Regular Contributor
  • *
  • Posts: 180
  • Country: us
Re: Programming an external ATmega168 with an Arduino Duemilanove
« Reply #26 on: July 27, 2012, 08:21:31 pm »
What would you guys suggest for a programmer?  Cheaper is better as long as it's consistent.

The USBtinyISP looks good.  Is there a pre-built option?  I can't solder at my apartment.  I could always take a trip home to work on the soldering, though.
- Randy
 

Offline PedroDiogo

  • Regular Contributor
  • *
  • Posts: 62
  • Country: pt
  • EE Student
Re: Programming an external ATmega168 with an Arduino Duemilanove
« Reply #27 on: July 27, 2012, 08:35:26 pm »
Also could be relevant, but I believe for this to work the ATMega on your Arduino can't be flashed with the optiloader bootloader, it must have the previous (slower) one.

I had to flash mine with a bootloader from adafruit and now works perfectly.
 

Offline madworm

  • Frequent Contributor
  • **
  • Posts: 373
  • Country: de
Re: Programming an external ATmega168 with an Arduino Duemilanove
« Reply #28 on: July 27, 2012, 08:38:54 pm »
I've got an usbtiny as well as an avrispmkii-clone.

Assembling the usbtiny was trivial, but it won't work with the newer xmega chips (3.3V) and is limited to writing 64k of flash.

I got the avrispmkii clone off ebay, fully assembled, works with avrdude on linux + winblows and avrstudio. It us LUFA powered and its firmware can be updated easily. It is also much faster than the usbtiny.

http://www.ebay.com/itm/USB-AVRISP-mkII-mk2-clone-ATMEL-AVR-ISP-PDI-TPI-Xmega-/160690475020?_trksid=p5197.m1992&_trkparms=aid%3D111000%26algo%3DREC.CURRENT%26ao%3D1%26asc%3D14%26meid%3D910407045742169129%26pid%3D100015%26prg%3D1006%26rk%3D1%26
 

Offline bsiswoyo

  • Contributor
  • Posts: 7
  • Country: id
    • Bambang Siswoyo
Re: Programming an external ATmega168 with an Arduino Duemilanove
« Reply #29 on: July 28, 2012, 12:14:54 am »
What would you guys suggest for a programmer?  Cheaper is better as long as it's consistent.

The USBtinyISP looks good.  Is there a pre-built option?  I can't solder at my apartment.  I could always take a trip home to work on the soldering, though.

To program arduino boot loader into blank ATmega328, i used USBasp programmer. And set to "Nano w/ ATMega 328".

Best Regard
Bambang Siswoyo
Bambang Siswoyo
 

Offline Randall W. Lott

  • Regular Contributor
  • *
  • Posts: 180
  • Country: us
Re: Programming an external ATmega168 with an Arduino Duemilanove
« Reply #30 on: July 28, 2012, 08:57:08 am »
I am strictly using an SMD (QFP) ATmega168.  I'm sure they'll all work for it.

I think I'll pick up the AVRISP mkII.
- Randy
 

Offline Randall W. Lott

  • Regular Contributor
  • *
  • Posts: 180
  • Country: us
Re: Programming an external ATmega168 with an Arduino Duemilanove
« Reply #31 on: August 02, 2012, 04:40:01 pm »
I bought an AVRISP mkii programmer.

I went into Atmel Studio 6.0, and selected Tools>Device Programming.

The Tool, Device, and Interfaces were selected.

When I click "Read" under Device signature, I get:

Severity:      INFO
ComponentId:   20100
StatusCode:   0

Unable to enter programming mode. Verify device selection, interface settings, target power and connections to the target device.


The programmer flashes red and it says it's unable to enter programming mode.

I have external power applied to my device and I'm almost certain that there are no connection issues.
- Randy
 

Offline madworm

  • Frequent Contributor
  • **
  • Posts: 373
  • Country: de
Re: Programming an external ATmega168 with an Arduino Duemilanove
« Reply #32 on: August 02, 2012, 04:49:38 pm »
Did you get the atmel one or a clone?

Anyhow, you must have the 'Jungo' driver installed. That can be a bit tricky.
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1306
  • Country: 00
Re: Programming an external ATmega168 with an Arduino Duemilanove
« Reply #33 on: August 02, 2012, 04:57:46 pm »
Your programmer's clock may be set too fast for the chip.  Until you change the chip's fuses the programmer's "ISP clock frequency" can't exceed 250 kHz.

This video shows you how to change it...

 

Offline Randall W. Lott

  • Regular Contributor
  • *
  • Posts: 180
  • Country: us
Re: Programming an external ATmega168 with an Arduino Duemilanove
« Reply #34 on: August 02, 2012, 05:28:05 pm »
My clock frequency is set to 125kHz (less than 1/4 of 8MHz) and I have an official programmer (in the clear blue case).

Also, the Jungo driver was apparently installed with Atmel Studio as it asked if I would like to allow it.

The red LED is blinking whenever I click read.  I followed their design guidelines.

I thought it'd be a cakewalk, but of course Murphy likes me.
- Randy
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1306
  • Country: 00
Re: Programming an external ATmega168 with an Arduino Duemilanove
« Reply #35 on: August 02, 2012, 05:50:56 pm »
There are a couple of ways to attack the problem that I can think of.

First, you might simplify the hardware side of things.  You might pop a MCU in a breadboard and provide it with the appropriate voltage and bypass caps and connect the programmer to that.  This will factor-out your hardware and tell you (hopefully) whether the problem is on the hardware or programmer side of things.

If you suspect Atmel's software is the issue then you can completely factor it out by using avrdude.  avrdude may also give you some more meaningful error messages.  (Use the -v option.)
 

Offline madworm

  • Frequent Contributor
  • **
  • Posts: 373
  • Country: de
Re: Programming an external ATmega168 with an Arduino Duemilanove
« Reply #36 on: August 02, 2012, 05:59:39 pm »
Using avrdude is of course an option, but on winblows this requires to remove the jungo driver and install a libusb driver. After that you can't use avrstudio anymore until you switch back to jungo.

It's a shame atmel don't offer a cross-platform ide for their 8-bit micros... dick-heads. That would be much nicer than having to run the ms-bloatware studio in a virtual machine. But now we have many colorful buttons to click on...
 

Offline madworm

  • Frequent Contributor
  • **
  • Posts: 373
  • Country: de
Re: Programming an external ATmega168 with an Arduino Duemilanove
« Reply #37 on: August 02, 2012, 06:03:36 pm »
If there is still a device manager in winblows these days, this is what it should look like with the thing plugged in:

 

Offline Randall W. Lott

  • Regular Contributor
  • *
  • Posts: 180
  • Country: us
Re: Programming an external ATmega168 with an Arduino Duemilanove
« Reply #38 on: August 03, 2012, 03:13:46 am »
If there is still a device manager in winblows these days, this is what it should look like with the thing plugged in:

That is exactly what it shows.  I like avrdude, but it seems like avr studio could be nice.

Since this is a SMD part on a highly populated design with multiple devices on buses, I'll solder a fresh ATmega168 on one of my blank PCBs, leaving only a header.  The other SPI devices could be causing problems.  That would suck, because this board is about $300 worth of parts.

I have an Ethernet controller, Wi-Fi module, LCD, and UART module.  That would be a real pain to work with.  I followed the correct guidelines by using pull-up resistors on the said lines.
- Randy
 

Offline Randall W. Lott

  • Regular Contributor
  • *
  • Posts: 180
  • Country: us
Re: Programming an external ATmega168 with an Arduino Duemilanove
« Reply #39 on: August 03, 2012, 04:02:45 am »
Oh, and I consistently get a Device signature reading as 0x535353.  I have no idea what that means.  There are no good resources about this that I can find.
- Randy
 

Offline Randall W. Lott

  • Regular Contributor
  • *
  • Posts: 180
  • Country: us
Re: Programming an external ATmega168 with an Arduino Duemilanove
« Reply #40 on: August 03, 2012, 05:32:31 am »
I found a short that was very difficult to see by eye, since there is .65mm pin pitch.  I can't believe it!

Thank you all so much for all the help.  You showed me just how great this forum is.
- Randy
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf