EEVblog Electronics Community Forum
Electronics => Microcontrollers => Topic started by: Randall W. Lott on July 19, 2012, 08:08:08 pm
-
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.
-
Hi!
Please see http://arduino.cc/en/Tutorial/ArduinoISP. (http://arduino.cc/en/Tutorial/ArduinoISP.)
Cheers
madires
-
I followed the tutorial here: http://arduino.cc/en/Tutorial/ArduinoISP (http://arduino.cc/en/Tutorial/ArduinoISP)
I get this error:
avrdude: stk500_getsync(): not in sync: resp=0x00
-
Is this after uploading the arduinoISP sktch or when trying to upload it?
-
I followed the tutorial here: http://arduino.cc/en/Tutorial/ArduinoISP (http://arduino.cc/en/Tutorial/ArduinoISP)
I get this error:
avrdude: stk500_getsync(): not in sync: resp=0x00
I've been having issues also programming a chip but,
You need up upload the arduinoISP sketch to the arduino.
Connect up the arduino to the external chip (there's instructions in the header of the sketch).
Then you need to change the board in the arduinoIDE under tools to match your chip.
And it's best to check what oscillator it's going to use by the fuses.
Then it should just be an upload.
-
Here is what I did:
- Opened ArduinoISP sketch under Examples.
- Chose Arduino Duemilanove w/ ATmega328.
- Uploaded sketch. This was successful.
- Wired the ICSP from my PCB, containing the blank ATmega168, to pins 10-13 on the Arduino.
- Selected "Arduino as ISP".
- Chose Arduino Pro under "boards".
- Attempted to Burn Bootloader.
- Got the previously mentioned error.
Thank you for the help!
-
That's what I would have done :P
I was having a similar issue caused by the baud rate specified in the boards.txt file.
For example using
9600baud gave an out of sync error
19200baud worked but my chip wouldn't respond (An issue I think caused by the clock of the chip)
38400baud gave an out of sync error.
I would suggest using a different baud rate.
-
If you use that sketch be sure to fix the bug mentioned here (https://www.eevblog.com/forum/microcontrollers/atmega8-with-arduino-as-isp-programming-issues/msg130315/#msg130315). Otherwise you can fry both the target MCU as well as your Arduino MCU.
-
Thank you all very much. I will try this today and I'll report back.
-
My ATmega168 is still not working after changing the ISP sketch file and adding a custom 8MHz ATmega168 entry in the Board.txt file. I'm getting:
In file included from SerialDisplay.cpp:42:
C:\Users\Randy\Desktop\Arduino\Install\hardware\arduino\cores\arduino/Arduino.h:212:26: error: pins_arduino.h: No such file or directory
Is it possible to upload sketches to an external ATmega168 with just the SPI bus? I'm reading that I need the RX/TX pins to communicate via USB (FTDI interface). My PCB is already designed and I have no header for these extra pins.
This is becoming pretty frustrating. I thought it would be a relatively easy task. I guess Dave had similar issues, but I can't find where he explained his processes and solutions.
I have much of my Arudino source code written. I'm going to love when I can actually send it off to my micro!
-
My ATmega168 is still not working after changing the ISP sketch file and adding a custom 8MHz ATmega168 entry in the Board.txt file. I'm getting:
In file included from SerialDisplay.cpp:42:
C:\Users\Randy\Desktop\Arduino\Install\hardware\arduino\cores\arduino/Arduino.h:212:26: error: pins_arduino.h: No such file or directory
That file could be missing or not found because it's not in the search path. Recently I upgraded to 1.0.1 and had to update some #include statements because the name of a major header file changed.
Is it possible to upload sketches to an external ATmega168 with just the SPI bus? I'm reading that I need the RX/TX pins to communicate via USB (FTDI interface). My PCB is already designed and I have no header for these extra pins.
The ATmega has a serial and parallel interface for flashing. The serial one is simply the SPI bus + Vpp, Gnd and Reset (like the ICSP of the arduino). If you got a Bus Pirate you could also use it as an ISP programmer with avr-dude.
-
I have not read the hole topic but out of sync is most of the time caused by not haveing a capacitator in series with the reset line. Look at the arduino scematic., close at the dtr line from the ftdi to the atmega reset pin. If this is ok or hase been mentioned please ignore this post.:)
Sent from my GT-I5800 using Tapatalk
-
I've come back with more information. Upon upgrading to 1.01, I receive this code when I try to burn the bootloader:
C:\Users\Randy\Desktop\Arduino 1.01\hardware/tools/avr/bin/avrdude -CC:\Users\Randy\Desktop\Arduino 1.01\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega168 -cstk500v1 -P\\.\COM4 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0x07:m -Uhfuse:w:0xD9:m -Ulfuse:w:0xE2:m
avrdude: Version 5.11, compiled on Sep 2 2011 at 19:38:36
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "C:\Users\Randy\Desktop\Arduino 1.01\hardware/tools/avr/etc/avrdude.conf"
Using Port : \\.\COM4
Using Programmer : stk500v1
Overriding Baud Rate : 19200
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
AVR Part : ATMEGA168
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 512 4 0 3600 3600 0xff 0xff
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
flash 65 6 128 0 yes 16384 128 128 4500 4500 0xff 0xff
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : STK500
Description : Atmel STK500 Version 1.x firmware
avrdude: Send: A [41] . [80] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [02]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [81] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [01]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [82] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [12]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [98] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
avrdude: Send: A [41] . [84] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [85] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [86] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [87] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [89] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us
avrdude: Send: A [41] . [81] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [01]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [82] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [12]
avrdude: Recv: . [10]
avrdude: Send: B [42] . [86] . [00] . [00] . [01] . [01] . [01] . [01] . [03] . [ff] . [ff] . [ff] . [ff] . [00] . [80] . [02] . [00] . [00] . [00] @ [40] . [00] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: Send: E [45] . [05] . [04] . [d7] . [c2] . [00] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: Send: P [50] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: AVR device initialized and ready to accept instructions
Reading | avrdude: Send: V [56] 0 [30] . [00] . [00] . [00] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: V [56] 0 [30] . [00] . [01] . [00] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
################avrdude: Send: V [56] 0 [30] . [00] . [02] . [00] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
################################## | 100% 0.07s
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
avrdude: Send: Q [51] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude done. Thank you.
I honestly have no idea what it means or if it's even communicating.
-
It means that avrdude is talking to the programmer (the Arduino firmware) but the programmer isn't talking to the target MCU.
The target MCU needs to be powered (same voltage as the programmer since I'm sure you don't have level converters) and needs to have a common GND with the programmer. Make sure all the ISP-related pins (SCK, MISO, MOSI and RESET#) are hooked-up properly.
Check to see that RESET is being pulled low by the programmer. Check SCK and MOSI for activity.
You should change your command line to NOT program the fuses and instead do something a little less dangerous until you get everything working. Something like this, perhaps:
avrdude -CC:\Users\Randy\Desktop\Arduino 1.01\hardware/tools/avr/etc/avrdude.conf -patmega168 -cstk500v1 -P\\.\COM4 -b19200 -t
This will put you in terminal mode. (Once it communicates successfully with the MCU.) Once in terminal mode you can inspect memory and whatnot to see if everything seems to be working.
-
Do you guys suggest using any passive components?
The guide shows a 10k Ohm resistor across SPI reset and 5V.
I've also seen people mention to use a capacitor. I'll be going to my house today, where my components are, so I am wondering if I need to grab some.
Thanks for the continued support.
-
I've always pulled-up RESET# with a 10k resistor and put a 10nF bypass cap on it as well--as recommended by this (http://www.atmel.com/Images/doc2521.pdf) Atmel app note.
-
Rather strangely, I'm getting an error after typing in the suggested codes in command prompt.
C:\Users\Randy>avrdude -CC:\Users\Randy\Desktop\Arduino 1.01\hardware/tools/avr
/etc/avrdude.conf -patmega168 -cstk500v1 -P\\.\COM5 -b19200 -t
error at C:\Users\Randy\Desktop\Arduino 1.01\hardware/tools/avr/etc/avrdude.con
f:332 unrecognized character: "w"
I'm not sure what to think of it. I freshly installed the Arduino IDE and WinAVR literally 5 minutes before attempting this, although "Google" told me that it could be a corrupted installation of the Arduino IDE.
-
I bet the WinAVR version of avrdude is what is in your path and the configuration file you specified in the Arduino folder is from an older version of avrdude. Try just leaving that -C option out.
avrdude -patmega168 -cstk500v1 -P\\.\COM5 -b19200 -t
-
I'm getting:
C:\Users\Randy>avrdude -v -v -v -v -patmega168 -cstk500v1 -P\\.\COM5 -b19200 -t
avrdude: Version 5.11-Patch#7610, compiled on Aug 31 2011 at 08:02:19
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "C:\WinAVR-20100110\bin\avrdude.conf"
Using Port : \\.\COM5
Using Programmer : stk500v1
Overriding Baud Rate : 19200
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
AVR Part : ATMEGA168
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page
Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max
W ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
-- ---------
eeprom 65 20 4 0 no 512 4 0 3600 36
00 0xff 0xff
Block Poll Page
Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max
W ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
-- ---------
flash 65 6 128 0 yes 16384 128 128 4500 45
00 0xff 0xff
Block Poll Page
Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max
W ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
-- ---------
lfuse 0 0 0 0 no 1 0 0 4500 45
00 0x00 0x00
Block Poll Page
Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max
W ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
-- ---------
hfuse 0 0 0 0 no 1 0 0 4500 45
00 0x00 0x00
Block Poll Page
Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max
W ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
-- ---------
efuse 0 0 0 0 no 1 0 0 4500 45
00 0x00 0x00
Block Poll Page
Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max
W ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
-- ---------
lock 0 0 0 0 no 1 0 0 4500 45
00 0x00 0x00
Block Poll Page
Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max
W ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
-- ---------
calibration 0 0 0 0 no 1 0 0 0
0 0x00 0x00
Block Poll Page
Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max
W ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
-- ---------
signature 0 0 0 0 no 3 0 0 0
0 0x00 0x00
Programmer Type : STK500
Description : Atmel STK500 Version 1.x firmware
avrdude: Send: A [41] . [80] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [02]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [81] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [01]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [82] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [12]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [98] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
avrdude: Send: A [41] . [84] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [85] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [86] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [87] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [89] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us
avrdude: Send: A [41] . [81] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [01]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [82] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [12]
avrdude: Recv: . [10]
avrdude: Send: B [42] . [86] . [00] . [00] . [01] . [01] . [01] . [01] . [03] .
[ff] . [ff] . [ff] . [ff] . [00] . [80] . [02] . [00] . [00] . [00] @ [40] . [00
] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: Send: E [45] . [05] . [04] . [d7] . [c2] . [00] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: Send: P [50] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: AVR device initialized and ready to accept instructions
Reading | | 0% 0.00savrdude:
Send: V [56] 0 [30] . [00] . [00] . [00] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: V [56] 0 [30] . [00] . [01] . [00] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
Reading | ################# | 33% 0.13savrdude:
Send: V [56] 0 [30] . [00] . [02] . [00] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
Reading | ################################################## | 100% 0.20s
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
avrdude: Send: Q [51] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude done. Thank you.
I've done about a dozen Google searches for device signature errors. Someone mentioned that by lowering the SPI clock, it worked. I have no idea what I should try now.
Thanks again.
-
If you're using the latest version of that sketch then the SPI clock is running as slow as it can run unless you change the Arduino's system clock speed.
If you're comfortable with changing the clock to the internal RC then that is one way to slow the SPI clock down. This involves changing the fuse bits of the MCU on the Arduino board. If you get things wrong you can wind up bricking your Arduino.
-
I just did some quick calculations and it looks like the SPI clock speed should be okay. If the Arduino's clock is 16 Mhz then the SPI clock will be set to 125 kHz. This is assuming you're using version 0.4 of that sketch and haven't changed the spi_init() function:
void spi_init() {
uint8_t x;
SPCR = 0x53;
x=SPSR;
x=SPDR;
}
If your target MCU is running at 1 Mhz (factory default) then the 125 kHz should work according to the datasheet:
Datasheet, Page 308:
The minimum low and high periods for the serial clock (SCK) input are defined as follows:
Low: 2 CPU clock cycles for fck < 12 Mhz, 3 CPU clock cycles for fck >= 12 Mhz
High: 2 CPU clock cycles for fck < 12 Mhz, 3 CPU clock cycles for fck >= 12 Mhz
Which is saying the SCK low period needs to be at least 2 us and the high period needs to be at least 2 us. Each of these should be 4 us. You might hook up the scope to SCK and double check, however.
In other words, I don't think the SPI clock is the problem. Can you provide a simple schematic of how you have the Arduino wired-up to the target board?
-
I have a standard ICSP 2x3 connector on the rear of my enclosure. This ties to my SPI bus, which is in a master/slave setup.
My ATmega168's reset line is wired to the connector, whereas each slave devices' "SS" will use a programmed pin on the micro.
I used the suggested resistors in the recommended locations.
Every power pin in my entire design has a decoupling capacitor. My microcontroller has a 1uF and .1uF capacitor on each power pin for reassurance.
I'm operating at 5V and my voltage regulators can handle more than my requirements. The rails are fine under load.
There is an 8MHz oscillator for the micro, which was implemented based on their recommendations. Of course, this is disabled until I can change the fuse to enable it.
I have to be doing something wrong. I can't even burn the bootloader in the Arduino IDE or in AVRdude (cmd).
Is it worth getting a USB programmer for $20? I'm getting a little frustrated with this process. I know it'll be worth the effort later, though. I have an oscilloscope, but I don't know what the signals should look like at what times during the programming.
-
I don't know what the problem might be but someone else had problems trying to use that sketch as well so it might just be a bad sketch. I know they broke a lot of the old sketches when they went to version 1.0 too so that might be the problem.
So long as you have something like the attached schematic for the programming then I would give up and get a real programmer.
-
If you don't value your time, then by all means don't spend the huge amount of 20$ on a programmer that works.
-
USBTiny complete kit:
https://www.adafruit.com/products/46 (https://www.adafruit.com/products/46)
USBTiny preprogrammed chip only:
https://www.adafruit.com/products/54 (https://www.adafruit.com/products/54)
You can then build your own.
I bought the kit, works fine for mega328
Mick M
-
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/ (http://bsiswoyo.lecture.ub.ac.id/2012/07/arduino-1-0-1-serial-upload-using-with-handmade-board-of-atmega328/)
Best Regard
Bambang Siswoyo
-
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.
-
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.
-
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 (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)
-
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
-
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.
-
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.
-
Did you get the atmel one or a clone?
Anyhow, you must have the 'Jungo' driver installed. That can be a bit tricky.
-
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...
ISP connection problems due to wrong ISP clock frequency (https://www.youtube.com/watch?v=vZ4ssr4N0qw#ws)
-
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.
-
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.)
-
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...
-
If there is still a device manager in winblows these days, this is what it should look like with the thing plugged in:
-
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.
-
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.
-
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.