SPI between ATmega32 and ATmega328 is not working
After posting my problem on AVR Freaks, I was able to solve the problem. I hadn't set SCK on slave as input and SPI clock rate was not set properly. I set clock rate to f/64 where f refers to the CPU frequency of the master. I would like to mention couple of things here for being noted by future visitors.


If your SPI is not working, first check what is the SPI clock rate. If it's too fast or slow, it won't work.
Check if you have declared the pins of the SPI module correctly on the master and slave. MISO should be set to input and the rest to output on the master. On the slave, MISO should be set as output and the rest as input.
If both these don't work for you, then focus on more advanced things like CPOL, CPHA. Using a logic analyzer to debug will help in this case.