5

I have ATmega168a on a breadboard. I am programming it via the Arduino IDE and a FT232RL USB adapter. When I select my board for 168 and upload, I get the following error:

stk500_getsync(): not in sync: resp=0x00

Normally this error means that either:

  1. My wiring is not correct
  2. I choose the wrong board

So to double check my wiring, I replace the 168 with a 328p. I am able to program the 328, so I think its the board selection.

I have tried Ardiono Diecimila or Duemilanove w/ ATmega168 and I also have a custom board entry:

atmega168bb.name=ATmega168 breadboard (16 MHz internal clock)
atmega168bb.upload.protocol=stk500
atmega168bb.upload.maximum_size=14336
atmega168bb.upload.speed=57600

atmega168bb.bootloader.low_fuses=0x62
atmega168bb.bootloader.high_fuses=0xDF
atmega168bb.bootloader.extended_fuses=0xF9
atmega168bb.bootloader.path=arduino:atmega
atmega168bb.bootloader.file=ATmegaBOOT_168_atmega328_pro_16MHz.hex
atmega168bb.bootloader.unlock_bits=0x3F
atmega168bb.bootloader.lock_bits=0x0F

atmega168bb.build.mcu=atmega168
atmega168bb.build.f_cpu=16000000L
atmega168bb.build.core=arduino:arduino
atmega168bb.build.variant=arduino:standard

Also, I am able to program the 168 via my AVR Programmer/Debugger. If you are wondering why I should just use the AVR Dragon, there reason is that I a sometimes don't want to remove the chip from the bread board while developing and programming.

Any suggestions I can try?

  • 4
    Did you program an Arduino bootloader into the chip? Also, jumper wires. – Ignacio Vazquez-Abrams Oct 27 '14 at 4:01
  • Yes - with ATmegaBOOT_168.hex - And by jumper wires, what do you mean? – PhillyNJ Oct 27 '14 at 10:44
  • 1
    The internal oscillator is 8mHz, not 16mHz. That means serial runs at half the speed. So you could try atmega168bb.upload.speed=28800 – Gerben Oct 27 '14 at 15:18
  • @Gerben Thanks but that didnt work either. I'll continue to work on it. I can use the SPI/ISP programmer, but this is killing me why it won't work! – PhillyNJ Oct 28 '14 at 0:08
1

Have you burned a bootloader? The standard Arduino IDE upload requires that you have a bootloader on the chip. You can burn a bootloader with the Arduino IDE and your AVR dragon

0

Try adding a 1k resistor on the TxD and RxD pins to your chip. And a 100nF capacitor like the schematic below. And a 10k Pull-up resistor to the reset pin.

Target processor                                 USB to Serial converter
(Atmega 168)                               
GND   ------------------------------------------ GND

5V    <----------------------------------------- 5V
RX    <--- 1K ---------------------------------- TX
TX    ---- 1K ---------------------------------> RX
RESET <----||----------------------------------- DTR_PIN
  |       100nF    
 10K
  |
 5V

This will help stabalizing the signals.

  • 1
    This will not "stabalize" things. What you are showing is a mix of ideas - some resistors for pin sharing or lazy level conversion, and an auto reset circuit. The auto reset might be useful, but unless the ATmega and USB serial solution are running at different voltages, the resistors will not help. – Chris Stratton Oct 19 '16 at 16:37
  • I see. If I wasn't wrong I had some like the same problem as the person who asked this question and fixed it using my answer. Found that on the arduino website back then. Can't really remember it clearly though.... – Handoko Oct 19 '16 at 18:47
0

There is another possibility, which I have had in the past.

My AVR was brand new, and it was set to use the internal resonator, at 1/8th speed, for a total of 1mhz. This was too slow to program using the default settings.

I had an USBASP, and it very conveniently had "SLOW SCK" jumper option, to slow down the programming. This was enough to program it, and if I'd wanted to use an external crystal clock (which I didn't, and 1mhz was fast enough for the specific project), I could have changed the fuses Check out http://www.engbedded.com/fusecalc/ to calculate new fuse settings. Be careful, I managed to set one chip to the wrong fuses, and am no longer able to change it.

P.S. - I used AVRDUDE to program the fuses. You should be able to read the current values, before you start - again, at slow speed. AVRDUDE has the '-B' option to slow down the programming, if you do not have the "SLOW SCK" jumper option, option -B10 should be plenty (default = -B1 I think).

When checking what the current fuse settings are, I think the main ones that slow down the clock are: CKSEL and SUT (the top dropdown list on the calculator website), and CKDIV8 - divide clock by 8; the second tickbox on the list. The defaults for these for AtMega 168 should be: Internal RC Oscillator: 8mhz, and the "Divide clock by 8" option selected.

  • This is indeed a possibility in other settings, but keep in mind that the question here concerns programming via serial communication with a bootloader, not ISP, and that the poster has reported that ISP is working. – Chris Stratton Apr 27 '15 at 15:21
0

. If you are wondering why I should just use the AVR Dragon, there reason is that I a sometimes don't want to remove the chip from the bread board while developing and programming.

Your dragon is an ISP so you don't have to unplug and replug it for programming.

I would check if your ftdi board an indeed function as a stk500.

Another alternative is to burn the bootloader and go down the regular Arduino route.

-2

you should be selecting the Arduino NANO board as the original Arduino Nano board is equipped with the FT232RL, rest all have either atmega chip for usb to ttl conversion or CP2302 chip. So select Arduino Nano and try.

  • Which serial converter is in use does not matter. It is appropriate to select a proper board configuration, but not for that reason. In fact historically and even today for the boards concerned here, the boards.txt doesn't even contain any information about the USB serial solution in use. A few entries such as for the Uno do now contain USB/VID information but that is probably only to help the user find the right serial port - it wouldn't change behavior in how avrdude talks on that port. – Chris Stratton Oct 19 '16 at 16:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.