Pages: [1] 2   Go Down
Author Topic: Custom Atmega328p AU "avrdude: stk500_getsync(): not in sync: resp=0x00"  (Read 5151 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Guys,

I designed and build a Custom Atmega328p au  Board... Resembling a Arduino FIO. In the spirit of things I decided to use the Fio's Bootloader and upload it via the ARDUINO IDE.

I uninstalled the driver from AVR studio 5 and used the libusb-win32-bin-1.2.6.0 drivers as the other ones don't seem to work in arduino. So all goes well I select the board

FIO.... Select my COM.. "By this time I gave up on the atmega16u2 from my other post and used a FTDI which I had laying around" And click burn bootloader with AVRISP MK2.

All goes accordingly.. Done burn bootloader..... Now the part where I pull out my hair... When I want to upload a sketch I get this error

"avrdude: stk500_getsync(): not in sync: resp=0x00" I have tried 2 diffrent FTDI boards and hacked a UNO board but all of these give me the same error.

I see this issue is fairly common. But the strange thing is that I can upload sketch to both my UNO and MEGA boards without an hiccup..

So not being able to upload sketch I thought well lets try to upload using programmer and boom it worked.... So the board works it can blink its little lights but the serial doesn't work.

:/
Any help ?
Logged

Anchorage, AK
Offline Offline
Edison Member
*
Karma: 42
Posts: 1176
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Every time that's every happened to me it's because the FTDI serial lines were crossed, or I didn't have the reset pin hooked up right.  (10K to +5, 100nF cap between DTR and reset.)  Double-check that, or just try swapping them and see if it gets you any further.  Failing that, can you post more of the log?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi SirNickity,

I checked my circuit after your recommendation. I have a 100nF cap between my reset and DTR and a 47k pullup for my reset line.

The log you are referring to is that in the lower part of the Sketch screen. If so this is all that is shown:

Binary sketch size: 2468 bytes (of a 30720 byte maximum)
avrdude: stk500_getsync(): not in sync: resp=0x1e


O wait it changed a bit now..

This is what im using to test.. Again I can upload this with programmer

Quote
void setup() {               
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(A0, OUTPUT);
Serial.begin(9600); 
}

void loop() {
  digitalWrite(A0, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(A0, LOW);    // set the LED off
  delay(1000); 
Serial.print("TEST");  // wait for a second
}
Logged

Anchorage, AK
Offline Offline
Edison Member
*
Karma: 42
Posts: 1176
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah, the log output from avrdude during upload.  Usually there's a section where it tries to detect the chip or start sending STK commands or whatever, and then it gets an unexpected response and stops.  Copy the relevant portion up to and including where it dies.  If you run it three times and get different responses, copy all three.

Inconsistent results are an entirely different failure mode, so that's definitely something to watch.  Could be flaky cabling, like a loose breadboard socket, long cables, bad solder joint, that sort of thing.

EDIT:  Forgot to say, you can turn on more verbose logging in the Options menu.  This should give you more detail as to what went wrong.  Then, copy that. smiley
Logged

Austin, TX
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6144
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Fio runs at 8MHz.  What fuse settings did you use, what bootloader did you burn, and what board are you selecting in the IDE?
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@ SirNikity... I have activated the verbose logging for both compile and upload; I ran it multiple times and got the same results see below:

In the middle of compilation i get this random warning

Quote
C:\Users\Leon Mckenzie\Desktop\CanSatDuino\Ardiuno\arduino-1.0\hardware\arduino\cores\arduino\Tone.cpp:108: warning: only initialized variables can be placed into program memory area


Quote
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\Leon Mckenzie\Desktop\CanSatDuino\Ardiuno\arduino-1.0\hardware/tools/avr/etc/avrdude.conf"

         Using Port                    : \\.\COM2
         Using Programmer              : arduino
         Overriding Baud Rate          : 19200
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Recv: . [1e]
avrdude: stk500_getsync(): not in sync: resp=0x1e

avrdude done.  Thank you.

I changed the baud rate in my board file as well.

@ James C4S... Yes My board runs 3.3v at 8Mhz. I selected the FIO board and burned its bootloader. But I have also tried
arduino pro and pro mini 3.3v 8Mhz with the similar results.



Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So I just verified that everything on my serial lines are working by using the guide from SPARKFUN http://forum.sparkfun.com/viewtopic.php?f=32&t=27960 Which basically lets you connect a FDTI to an UNO board  and try the upload.

Quote
Program another Arduino using the FTDI board:
So I happen to have an Arduino Uno handy and this really saved my behind. Since I never had any issues uploading sketches to the Uno at any point during this headache Sparkfun tech support suggested I attempt to upload a sketch to the Uno using my FTDI board. I was hesitant at first thinking the Uno required 5v and the FTDI board that I had only supplied 3.3v. To my surprise, it worked!

    You only really need to connect the RX, TX, VCC, and GND for the communication to work and this is how I did it:

    FTDI ----Arduino Uno
    RX-------TX (pin 1)
    TX-------RX (pin 0)
    3v3------3.3V
    GND-----GND
    connect the FTDI via USB to my computer
    open the Arduino IDE and selected the correct COM port and Board (Uno in this case).
    This next step is important because I did not connect the RESET between the FTDI and Uno. When I clicked on upload i watched the FTDI board intently, when the TX LED (the red one and may be rather dim) flashed the first time I pressed the RESET button on the Uno.
    If all goes well you should successfully upload the sketch to the Uno.
Atleast one thing out of my equation.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok So after the FTDI test, I went on with the Guide as mention in my previous post and tried to use the UNO as an ISP. I did the following:

Quote
To resolve the errors I tried to burned the bootloader to the Custiom FIO using my functioning Arduino Uno as an ISP. For the most part I followed the instructions here: http://www.sparkfun.com/tutorials/247 adhering to Option 1 but using the Arduino IDE to burn the bootloader. Here is what I did step by step:
1. Connect the Arduino Uno via USB to the PC
2. Open the Arduino IDE
3. Select the correct COM port and board (Arduino Uno)
4. Open the ArduinoISP sketch (File>Examples>ArduinoISP)
5. Upload the sketch. once complete your Arduino Uno is now programmed to be an ISP programmer. This is great because I really didn't want to buy a seperate programmer.
6. Power the Uno off and wire the Uno to the Custom Fio in the following fashion:

Uno---------------FIO
3.3v-----------------------VCC
GND------------------------GND
Digital Pin 11(MOSI)---- (MOSI)
Digital Pin 12(MISO)---  (MISO)
Digital Pin 13(SCK)----- (SCK)
Digital Pin 10----------RST

7. Power on the Uno
8. Select the correct COM port
9. IMPORTANT: Select board FIO as the board we are uploading to
10.from the Tools menu, select Burn Bootloader > w/Aduino as ISP

 After a few seconds the IDE said:

Quote
C:\Users\Leon Mckenzie\Desktop\CanSatDuino\Ardiuno\arduino-1.0\hardware/tools/avr/bin/avrdude -CC:\Users\Leon Mckenzie\Desktop\CanSatDuino\Ardiuno\arduino-1.0\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -cstk500v1 -P\\.\COM14 -e -Ulock:w:0x3F:m -Uefuse:w:0x05:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xFF: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\Leon Mckenzie\Desktop\CanSatDuino\Ardiuno\arduino-1.0\hardware/tools/avr/etc/avrdude.conf"

         Using Port                    : \\.\COM14
         Using Programmer              : stk500v1
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Recv:
avrdude: stk500_getsync(): not in sync: resp=0x00

avrdude done.  Thank you.

So another big SIGH.... ohhh... SIGH

JUST TO ADD.... If select my avrmk2 as my programmer in stead of UNO as ISP I can succesfully upload the sketch !! What does this mean ?
« Last Edit: March 02, 2012, 02:54:05 am by jacqueskleynhans » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Dont want to, but have to ... BUMP
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Guys,

Has anyone solved this problem before ??

Logged

Anchorage, AK
Offline Offline
Edison Member
*
Karma: 42
Posts: 1176
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm still betting this is a cabling problem.  To make everything painfully clear:

(I am assuming your FTDI cable outputs 3.3v on Vcc -- mine is 5v, so you might check this on a voltmeter first, or you will need a regulator.  Alternatively, use the 3.3v output from the Uno and tie the grounds together from the Uno, FTDI, and your slave chip.)

- FTDI Vcc to Vcc and AVcc pins
- FTDI Gnd to all Gnd pins
- Couldn't hurt to put a 100nF cap between Vcc and Gnd next to the slave chip
- FTDI DTR through a 100nF cap to reset pin
- 10k (you used 47k, which is OK) between reset and Vcc
- FTDI TX to RX pin
- FTDI RX to TX pin (also try reversing these in case they are labeled from the "other" perspective)
- Xtal1 to one side of an 8MHz oscillator of your choice
- Xtal2 to the other side of the oscillator
- If your oscillator is the 2-pin type, you probably need 22-27pF caps from each side to ground
- If your oscillator is the 3-pin type, tie the middle pin to ground

Select your target board (FIO) from the IDE and upload the blink sketch.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

HI,

Thank you for responding. I love it when ppl speak basic !!

All right let me define my project a bit. I am currently building a little CanSat.. Ask Google if you don't know..

The main hardware contains a ATMEGA2560v 3.3v @ 8Mhz, UHF transmitter, Two temperature sensors, digital Barometric Pressure sensor, Analog Humidity sensor, GPS , little VGA camera and a 2gb SDCARD to log all of the mentioned before tx. All of which I have coded, tested and works perfectly.

The Receiver part contains a UHF receiver and a ATMEGA 328p 32 pin TQFP type which also works perfectly also running at 3.3v 8Mhz

Now the part that doesn't work... Both the  Bootloaders.. In AVR studio I programmed both the bootloaders via my AVRISP MK2..

In Arduino I am uploading the sketches via the MK2 programmer. Changing the driver from jumbo to libusb win 32.. to switch from avr stud to arduino ide.

Also selecting the  correct boards.. using a board-file from sparkfun for the atmega2560v and fio for my receiver board.

I know my ftdi works because I have been using it to send my received data back to the PC.

I have also done a loop back test to test tx and rx of my ftdi.

The only thing that I have not implemented from your list is to connect the FTDI dtr >> CAP >> RESET . I have it currently on my board as switch with 47k pullup >> RESET  >> mega328p.

So it might be the reset circuit?

Kind Regards and thanks for the reply !!
« Last Edit: March 06, 2012, 03:49:11 pm by jacqueskleynhans » Logged

Anchorage, AK
Offline Offline
Edison Member
*
Karma: 42
Posts: 1176
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It's quite likely.  I had some issues the one time I tried it without the cap.  It's easy enough to check.  :-)

Anyway, I know my hand-holding checklist was a bit on the elementary side, but I was just hoping there would be one little thing that would spark an idea.  It's so easy to overlook something obvious.  Hopefully that cap will do the trick.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I tried the cap but unfortunately it didn't work.

The search continues..

Regards

Jacques
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

SO CLOSE TO FINALLY GIVING UP !!

I cant get this F'in Bootloader to work !!

Quote
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\Leon Mckenzie\Desktop\CanSatDuino\Ardiuno\arduino-1.0\hardware/tools/avr/etc/avrdude.conf"

         Using Port                    : \\.\COM2
         Using Programmer              : arduino
         Overriding Baud Rate          : 19200
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Recv:
avrdude: stk500_getsync(): not in sync: resp=0x00

avrdude done.  Thank you.

As allways.

I have tried everything in every forum/blog/guide etc... Dont think this ATMega is geared for this bootloader.

The most frustrating is that the board works perfectly... I burn the Fio bootloader (with my AVRISP MK2 in Arduino IDE) to it and program my sketch also via the MK2 then it works. But with my serial board NEA... And don't get me wrong the serial board works.. I did the loop test and I can get a serial stream from the board and display it in serial monitor. But I always get the sync error when I try to upload a sketch.

Any Suggestions ????


Just to Add I know both TX and RX works because I successfully loaded this sketch and it worked.

Quote
//PCtoArd
//ver 26Jly10

//#include <avr/pgmspace.h>
//#include <sensor_pff.h>

//SENSOR_PFF sd;
//byte sensor_start = 0;

#define LEDpin A0 //no ; here
char buff[128];   /* i/o buffer, for get_line */
boolean boFlashQuickly=false;

void setup()
{
     pinMode(LEDpin,OUTPUT);
     delay(300);//let system settle
     Serial.begin(9600);

     Serial.println("\n\nDemo of control of Arduino from PC\n");
   Serial.println("See http://sheepdogguides.com/ardino/ahttoc.htm\n");
     Serial.println("for latest details.\n");
     Serial.println("\nPress the enter key after pressing s or q.\n");
   Serial.print('>');
}

void loop()
{
  char *ptr;

  if(Serial.available()==true){//Cmnds waiting

    get_line(buff, sizeof(buff));
    ptr = buff;

    switch (*ptr++) {//switch

    case 'q':   // Quickly flash
       //Serial.print("\nWill flash quickly\n");
       boFlashQuickly=true;
       break;//end "q"

    case 's':    // Slowly flash
       //Serial.print("\nWill flash slowly\n");
       boFlashQuickly=false;
       break;//end "q"

    default:
       Serial.print("Unrecognized. Only s and q recognized\n");
       break;//end default

   }//end "switch..."
    Serial.print('>');
   }//if, cmnd waiting
  else {//1 no cmnds waiting
   if (boFlashQuickly){//2
     QuicklyFlash();
     }//end if "2"
   else {//2
     SlowlyFlash();
     }//end of else(2)
    }//1 end of level 1 "if" clause, no cmnds waiting
}//end "loop()"

void QuicklyFlash(){
    LEDOn();
    delay(100);
    LEDOff();
    delay(100);
}

void SlowlyFlash(){
    LEDOn();
    delay(900);
    LEDOff();
    delay(900);
}

void LEDOn(){
digitalWrite(LEDpin,LOW);//Yes- LOW for ON
};

void LEDOff(){
digitalWrite(LEDpin,HIGH);
};

//Treat "GET_LINE" as a black box, for now.
//Nothing to change in it.
//Press the "enter" key after entering your 1 letter command
static void get_line (char *buff, byte len)
{
   byte c;
   int idx = 0;

   for (;smiley-wink {//1 Start infinite loop... will only exit via "break"
      if(Serial.available()){//2
         c = Serial.read();
         if (((byte)c >= ' ') && (idx < len - 1)) {
            buff[idx++] = c; Serial.print(c);
         }//3
      }else break;//2
   }//1 (ends "for...")
   buff[idx] = 0;
//   Serial.print(c);
   Serial.print('\n');
}
//  === END OF GET_LINE ===
« Last Edit: March 20, 2012, 04:50:13 am by jacqueskleynhans » Logged

Pages: [1] 2   Go Up
Jump to: