can't upload - programmer is not responding

Hi there,

I'm using the Arduino Uno quite a long time, but since yesterday I can't upload my code anymore.

I tried all the troubleshooting hints and googled for hours, no solution did work (e.g. pressing the reset button after pressing the upload button - I tried it round about 50 times :smiley: ).

Using Linux, I receive this message:

hans@hans-desktop:~/jowblobb$ avrdude -F -p atmega328P -P /dev/ttyACM0 -c arduino -b 19200 -vvvv

avrdude: Version 5.10, compiled on Jun 29 2010 at 21:09:48
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/etc/avrdude.conf"
         User configuration file is "/home/flo/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM0
         Using Programmer              : arduino
         Overriding Baud Rate          : 19200
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding

avrdude done.  Thank you.

Trying to upload it on Windows XP, it says something like

avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

I guess I have to burn the bootloader again to fix it.

Here comes the question: This is the code I uploaded last.
Am I doing anything forbidden here?
I'm asking because I've got another Uno Board, but I don't dare to upload it there until I know there's nothing wrong with the code :slight_smile:

(I'm trying to setup a LIN-Bus Slave using RX and TX)

#include <avr/io.h> 			
#include <stdint.h>				
#include <avr/wdt.h>			
#include <avr/interrupt.h>  	

#define VREF 5					
#define FOSC 8000000 			
#define BAUD 9600				
#define MYUBRR FOSC/16/BAUD-1	

#define WDTO_16msec  0
#define WDTO_32msec  1
#define WDTO_64msec  2
#define WDTO_125msec 3
#define WDTO_250msec 4
#define WDTO_500msec 5
#define WDTO_1sec	 6
#define WDTO_2sec	 7
#define WDTO_4sec	 32
#define WDTO_8sec	 33

/* PORTC */
#define PC7     7
#define PC6     6
#define PC5     5
#define PC4     4
#define PC3     3
#define PC2     2
#define PC1     1
#define PC0     0
 
/* DDRC */
#define DDC7    7
#define DDC6    6
#define DDC5    5
#define DDC4    4
#define DDC3    3
#define DDC2    2
#define DDC1    1
#define DDC0    0
 
/* PINC */
#define PINC7   7
#define PINC6   6
#define PINC5   5
#define PINC4   4
#define PINC3   3
#define PINC2   2
#define PINC1   1
#define PINC0   0 

//------------------------------Globale Variablen------------------------------------

uint8_t Relais_Position=0;
uint8_t Relais_Position1=0;
uint8_t Relais_Position2=0;
int8_t Daten[8];
uint8_t PID;
uint8_t Slave_Address=0;



  uint16_t ADC_Val;
  int8_t   Temperatur1=0;
  int8_t   Temperatur2=0;
  uint8_t  Vref=0;
			


void USART_Init(uint16_t ubrr)
{
  // Baudrate setzen
  UBRR0H = (uint8_t)(ubrr>>8);
  UBRR0L = (uint8_t)ubrr;

  // Receiver und Transmitter einschalten UND Transmitt und Receive Interrupts einschalten
  UCSR0B = (1<<RXEN0)|(1<<TXEN0)|(1<<RXCIE0)|(1<<TXCIE0);

  //Frameformat setzen: Asynchron 8 Daten, Keine Parität 1 Stop bit (8N1) 
  UCSR0C = (1<<UCSZ01) | (1<<UCSZ00);

}

//-------------------------------------Sende Zeichen-------------------------------
void Send_Byte(uint8_t sendByte){
  DDRC = (1 << DDC2); 			//grüne LED einschalten (senden)
  PORTC |= (1<<PC2);
  while (!(UCSR0A & (1<<UDRE0)))  //warten bis Senden möglich
    ;
  UDR0 = sendByte; 				// schreibt das Zeichen auf die Schnittstelle
  //DDRC = (1 << DDC2); 			
  PORTC &= (0<<PC2);				//grüne LED ausschalten (senden)
}


//-----------------------------Empfange Zeichen-----------------------------------
uint8_t Receive_Byte(){

  uint8_t status;

  DDRC = (1 << DDC3); 			
  PORTC |= (1<<PC3); 				//rote LED einschalten (receive)

  while (!(UCSR0A & (1<<RXC0)))	// warten bis Zeichen verfuegbar
    ;
  status = UCSR0A;
  if (status & (1<<FE0)){			//wurde ein Break empfangen?
    return 1;
  }

  else{
    return UDR0;					// Zeichen aus UDR an Aufrufer zurueckgeben
  }

  DDRC = (0 << DDC3);
  PORTC &= (0<<PC3); 				//rote LED ausschalten (receive)
}






//-------------------------Parität berechnen------------------------------------
uint8_t Paritaet_Berechnen(uint8_t PID){

  uint8_t ID0;
  uint8_t ID1;
  uint8_t ID2;
  uint8_t ID3;
  uint8_t ID4;
  uint8_t ID5;
  uint8_t P0;
  uint8_t P1;
  uint8_t P0_temp;
  uint8_t P1_temp;

  P1  = (PID & 10000000) >> 7;
  P0  = (PID & 01000000) >> 6;
  ID5 = (PID & 00100000) >> 5;
  ID4 = (PID & 00010000) >> 4;
  ID3 = (PID & 00001000) >> 3;
  ID2 = (PID & 00000100) >> 2;
  ID1 = (PID & 00000010) >> 1;
  ID0 = (PID & 00000001);

  P1_temp = ID1^ID3^ID4^ID5;
  P0_temp = ID0^ID1^ID2^ID4;

  if ((P1==P1_temp) && (P0==P0_temp)){
    return 1;
  }
  else 
    return -1;
}
//-----------------------Slave Adresse am Port D einlesen---------------------
uint8_t Read_Slave_ADR(){

  Slave_Address = PIND;
  Slave_Address = (Slave_Address & 11100000) >>  5;

  return Slave_Address;
}


//------------------------------------MAIN------------------------------------

void setup(void){


  //---------------------------------Initialisierungen------------------------------

  USART_Init(MYUBRR);
  //-----------------------------------ENDE Init-----------------------------------

  sei ();	//ab hier werden Interrupts zugelassen 
}

void loop (void) {
    

Send_Byte(5);
   
delay(1000);
}//ende Main
//-------------------------------------------------------------------------------------------

ISR (USART_RX_vect) {		//Die Interupt Service Routine wird ausgeführt wenn ein zeichen empfangen wird



  uint16_t TMPchecksum = 0;
  uint8_t checksum;			//Hier steht die Enhanced Checksumme
  uint8_t ID;					//Hier steht die vom Master versandte ID (ohne Paritätsbits)
  uint8_t PID;				//Hier steht die vom Master versandte ID (mit Paritätsbits)
  uint8_t ID_adr;				//Hier stehen die oberen drei Bits der ID mit der die Baugruppe angesprochen wird
  uint8_t ID_func;			//Hier stehen die unteren drei Bits der ID mit der die Funktionen ausgeführt werden
  uint8_t SyncFeld;
  uint8_t Sync_Break;


  //LIN KOMMUNIKATION STARTET HIER
  Sync_Break=Receive_Byte();

  if (Sync_Break){				//Ein Frame Error wird durch ein Sync-Break hervorgerufen


    if (SyncFeld==0x55){			

      PID		= Receive_Byte();
      ID  	= (PID & 00111111);						//ID (ohne Paritätsbits)
      ID_adr	= (ID >> 3);
      ID_func = (PID & 00000111); 

      if(Paritaet_Berechnen(PID)) {



        if ((ID_func==0) && (Slave_Address==ID_adr)){	
          // printf("id_func 0)");			
/*
          for (uint8_t i=0; i<=6; i++){
            Send_Byte(Daten[i]);					//gesammelte Daten senden
            TMPchecksum= TMPchecksum + Daten[i];	//Checksumme berechnen (CARRY-BIT fehlt noch)!!!!!!!
          }

          TMPchecksum = TMPchecksum+PID;				//Enhanced Checksumme!	
          //Low-Byte der checksumme + High-Byte der checksumme
          checksum  = (uint8_t) ((TMPchecksum & 0x00FF) + (TMPchecksum >> 8));				
          checksum= ~checksum;				//Checksumme invertieren
          Send_Byte(checksum);				//anschließend die Checksumme senden
*/
        }

        if ((ID_func == 1) && (Slave_Address==ID_adr)){		
          // printf("id_func 1)");
        }

        if ((ID_func == 2) && (Slave_Address==ID_adr)){		
          // printf("id_func 2)");
        }				

        if ((ID_func == 3) && (Slave_Address==ID_adr)){		
          // printf("id_func 3)");
        }

        if ((ID_func == 4) && (Slave_Address==ID_adr)){		
          // printf("id_func 4)");
        }

        if ((ID_func == 5) && (Slave_Address==ID_adr)){		
          // printf("id_func 5)");
        }

        if ((ID_func == 6) && (Slave_Address==ID_adr)){		
          // printf("id_func 6)");
        }

        if ((ID_func == 7) && (Slave_Address==ID_adr)){		
          // printf("id_func 7)");
        }
      }//parität

        else{ 
        DDRC = (1 << DDC4);
        PORTC |= (1<<PC4);
      } 						//gelbe LED eischalten, somit liegt ein Paritätsfehler vor
    }//syncfeld
  }//FE
}//ISR

This is just the first draft, so I know the code is far away from being perfect :slight_smile:

Cheers!

jowblobb:
I'm using the Arduino Uno quite a long time, but since yesterday I can't upload my code anymore.

I tried all the troubleshooting hints and googled for hours, no solution did work

Same situation here :frowning:

Some more info:

OS:        LINUX, Debian Squeeze.
board:    arduino duemilanove, two different boards, known to work before.
version:  arduino-0022 (and others)

I have checked board type and serial port, restarted software, pressed reset button,
tried different USB plugs and cables, changed board and tried on another computer,
tried example sketches, tried older and newer arduino versions, ...
and so many other things and combinations ... ... ...

Experimental:  JNI_OnLoad called.
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version   = RXTX-2.1-7
Binary sketch size: 12038 bytes (of a 14336 byte maximum)
avrdude: stk500_getsync(): not in sync: resp=0xe6
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x33

what´s happening?

Lord have mercy! Why does everybody complain about uploads not working?

  • Do you drill holes in concrete walls with a plain power drill? NO, you use an impact drill (hammer)...
  • Do you sky-dive without a parachute? NO.
  • Do you eat spaghetti with bare hands? NO, you use a spoon and a fork.

GET YOURSELF THE PROPER TOOLS (ISP) AND FIX IT YOURSELF. :0

USBtiny, cheap, works with linux !!!! <<<

And while I'm ranting, go to savannah and immediately download avrdude 5.11

madworm:
Lord have mercy! Why does everybody complain about uploads not working?

exactly!

And while I'm ranting, go to savannah and immediately download avrdude 5.11

I tried:
./configure
make

/bin/bash ./ylwrap lexer.l .c lexer.c -- :
make: *** [lexer.c] Error 1

don´t know what that means

Most likely you're missing a few essentials. The output of 'configure' should tell you: (yes / no).

make, automake...

@madworm:
I wasn´t able to configure and make avrdude 5.11 yet.

I have updated a debian sid system now, it has avrdude 5.11
I get the same error.

still searching...

Do yourself the favour and get an ISP.

I have one too, and oh wonder... I have never had issues with the damn bootloader. Probably it knows that I don't need it, so it behaves well.

It is not worth the trouble, so find yourself 20-30 bucks and get one. Using an ISP is also a good way to determine if the main chip is toast. If even an ISP can't talk to it, it is most likely dead.

But if you prefer insanity and madness... happy searching.

And please forgive me my sarcasm, I just can't stand it anymore.

madworm:
Do yourself the favour and get an ISP.

Maybe I will, the kits are out of stock right now, btw.

For now I want to find another way.
You´re absolutely right, looks like madness...
... ... ... ... ... ... ... ...
... still unhappy searching

You can also use the 'Pocket AVR Programmer' from Sparkfun. Same thing, 15 bucks.