i found out that the freeze in code line is relative to the interrupt of SPI where i set SPIE bit to 1,and when i disable SPI interrupt and clear SPIE bit then anything gotworking, but why while i enabled global interrupt and i wrote SPI corresponding ISR why SPIF will not be cleared?
and never this line of code be truth?
while(! (SPSR & (1<<SPIF) ));
- - - Updated - - -
hey nandhu015 you were wrong about the connection,the truth is that what i did ,and MOSI must connect to MOSI and MISO must be connected to MISO;