2

I'm having trouble getting the atmega328p chip to upload sketches using my ftdi. It always comes up with an error saying not in sync.

I have an 8Mhz crystal with 22pf capacitors. The weird thing is I could flash the bootloader using my avrispmkII @ 3.3v. AFAIK this tells me the chip is running. I have an led connected to pin7. It doesn't flash when turn the power on. However it does flash when powered from 5v and everything is working fine. I could upload sketches using the ftdi.

I have the ftdi on a breakout to pin headers. I have the reset pin wired up to the DTR via a 100nf capacitor. The reset has a 10k pull up. CTS pin is grounded. The usart is as follows tx (atmega) ---> rx(ftdi) and rx(atmega) to tx(ftdi). I have also switch between 3.3v and 5v logic using the vccio pin on the ftdi. I.e. vccio = 5v if atmega is 5v.

I know the programmer need to know what voltage am using, how critical is it, since I don't have a 3.3v regulator to hand. I used a lm338 and it's coming out as around 3.2

I selected arduino pro/mini @ 8mhz 3.3v atmega328p when I flashed the bootloader

##############################################################

pro328.name=Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328

pro328.upload.protocol=arduino
pro328.upload.maximum_size=30720
pro328.upload.speed=57600

pro328.bootloader.low_fuses=0xFF
pro328.bootloader.high_fuses=0xDA
pro328.bootloader.extended_fuses=0x05
pro328.bootloader.path=atmega
pro328.bootloader.file=ATmegaBOOT_168_atmega328_pro_8MHz.hex
pro328.bootloader.unlock_bits=0x3F
pro328.bootloader.lock_bits=0x0F

pro328.build.mcu=atmega328p
pro328.build.f_cpu=8000000L
pro328.build.core=arduino
pro328.build.variant=standard

##############################################################

output from avrdude

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e950f
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as 5

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as 5
avrdude: safemode: Fuses OK

avrdude done.  Thank you.

migrated from electronics.stackexchange.com Dec 2 '14 at 12:05

This question came from our site for electronics and electrical engineering professionals, students, and enthusiasts.

  • pin 7 of the 328P is VCC. Per the ATmegaBOOT_168.c "/* onboard LED is used to indicate, that the bootloader was entered (3x flashing) */". Where this pin is PB5, pin 19 of the 328p or D13. Or is YOUR code attempting to blink a pin. – mpflaga Dec 2 '14 at 16:34
  • once programmed voltage is very flexible. See SFE's BigTime Watch Kit it runs directly on a coin cell with oscillator. which runs with "Arduino Pro or Pro Mini 3.3V/8MHz" bootloader. Where the Battery drops over time. Note your fuses are BrownOut below 2.9V so your 3.2 should be fine. – mpflaga Dec 2 '14 at 16:49
  • To clarify: it reads as if you are saying it ALL works when using the FTDI, even programs. But it does not when the FTDI is connected through the Breakout board. Are you saying FTDI is directly connected and the Reset circuit is not present. – mpflaga Dec 2 '14 at 16:59
  • To clarify the atmega 328 is on the breadboard. The ftdi has its auto reset in tact and connected. I used a bench supply at our lab. I t actually starts working at 3.5 and above. Why? – Ageis Dec 2 '14 at 17:27
  • is it 3.2V at 328's VCC or at the LMN338. Is there any AC to it? – mpflaga Dec 2 '14 at 18:55
1

I would suspect that the 328P's fuses were not programmed as defined in the boards.txt This needs to be explicitly done.

uno.bootloader.low_fuses=0xff
uno.bootloader.high_fuses=0xde
uno.bootloader.extended_fuses=0x05
uno.bootloader.path=optiboot
uno.bootloader.file=optiboot_atmega328.hex
uno.bootloader.unlock_bits=0x3F
uno.bootloader.lock_bits=0x0F

if not done. several things can go wrong.

  1. oscillator won't start on external crystal
  2. oscillator will be at wrong speed code
  3. wont start at bootloader
  • Thats not for the bootloader am using. I'm using the arduino pro mini bootloader. That is for the newer uno. I have checked they match what's in the boards.txt – Ageis Dec 2 '14 at 13:33
  • Fuses are correct. See avrdude output at the bottom of the question – Gerben Dec 2 '14 at 16:36
  • yes, that was added to the question after – mpflaga Dec 2 '14 at 16:59

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.