AVR programming protocol

Is there any website or blog which is explaining about AVR programming protocol like AVR ISP

step by step

A Google search would get you a result or in fact "About 3,350,000 results (0.51 seconds)".

The web helps those that help themselves.

The AVR910 app note is probably what you want.

Dear ron_sutherland

Every one need teacher So you helped me as a teacher by showing above link

I red it and really helped to start it

Thanks

Please help who have clearly explain timing with code

The ISP sketch in examples has code that programs with that interface. It should be included with the IDE, but I will link to Github for viewing.

https://github.com/arduino/Arduino/blob/master/build/shared/examples/11.ArduinoISP/ArduinoISP/ArduinoISP.ino

I am not sure if that will help with timing, but it is what I have been using to program my custom boards, the code reads fairly well, and I know for a fact it works.

Dear I have found following tutorial about command

My nest step is connecting two arduino board as per following connection

Board 1 Board 2
Pin 10 Reset
MISO MISO
SIMO SIMO
SCK SCK
GND GND
5v Vin

Then I am planing to write a program to read the Signature of the Board 2 ( ID) That only I need to read

Therefore I need to build following steps I think

  1. Build the SPI protocall
  2. Create the Enabling command (0xAC EXECUTABLE COMMAND PREFIX)
  3. Read Device ID (0x30 READ DEVICE ID INFORMATION)
  4. Serial communication to show ID in Serial Monitor

Please advice if I am wrong

This is the code for master for SPI setup which can see the data in Serial monitor received from the slave in my case ID Signature

//Master Code
#ifndef F_CPU
#define F_CPU 16000000UL
#endif
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#define ACK 0x7E
#define LONG_TIME 10000


void setup() {
  Serial.begin(9600);
  spi_init_master();                  //Initialize SPI Master
  DDRD |= 0x01;                       //PD0 as Output

}

void loop() {
  unsigned char data;                 //Received data stored here
  uint8_t x = 0;                      //Counter value which is sent
  while (1)
  {
    data = 0x00;                    //Reset ACK in "data"
    data = spi_tranceiver(++x);     //Send "x", receive ACK in "data"
    if (data == ACK) {              //Check condition
      //If received data is the same as ACK, Sent to Serial Monitor
      Serial.println(data);
    }
    else {
      //If received data is not ACK, then blink LED for a long time so as to determine error
       Serial.println(data);
    }
    _delay_ms(500);                 //Wait
  }

}

//Function to send and receive data
unsigned char spi_tranceiver (unsigned char data)
{
  SPDR = data;                       //Load data into the buffer
  while (!(SPSR & (1 << SPIF) ));    //Wait until transmission complete
  return (SPDR);                     //Return received data
}

//Initialize SPI Master Device
void spi_init_master (void)
{
  DDRB = (1 << 5) | (1 << 3);        //Set MOSI, SCK as Output
  SPCR = (1 << SPE) | (1 << MSTR) | (1 << SPR0); //Enable SPI, Set as Master
  //Prescaler: Fosc/16, Enable Interrupts
}

If you say so. I don't see the 0x30 "Read Signature" command in there anywhere.
In general, each command is a 4-byte SPI sequence, where the 4th byte can be a "dummy" byte used to shift back the response. To read the signature, which is three bytes long, you'd have to send at least

0x30 0 0 0
0x30 0 1 0
0x30 0 2 0