SPI and UART of atmega32 were not working when atmega32 was interfaced with ad7705
Some general comments.


When composing a message on StackExchange's Electrical Engineering website, notice the question mark icon '?' at the top right corner of the toolbar above the message editing box. Click on that question mark to display the Markdown help webpage. Scroll down the Markdown help webpage to find the section titled "Syntax highlighting for code". Use the information in that section to learn how to properly embed within your message a source code listing that has syntax highlighting. For example:


#include &lt;iostream&gt;
int main()
{
    std::cout &lt;&lt; "Hello, World!" &lt;&lt; std::endl;
    return 0;
}



Read and try to understand the applicable data sheet(s) before asking others to spend their time helping you. The data sheet for Microchip Technology's ATmega328P microcontroller is provided on Microchip Technology's website:


http://ww1.microchip.com/downloads/en/DeviceDoc/ATmega48A-PA-88A-PA-168A-PA-328-P-DS-DS40002061A.pdf


Look at Figure 1.1 "Pinout ATmega48A/PA/88A/PA/168A/PA/328/P" (page 12) in the ATmega328P data sheet. Write down the port B pin numbers (PBn) for the following signals as shown in Figure 1.1: MISO, MOSI, SCK, SS.  Now look at your function 'spi_init_master', at the code that sets and clears individual bits within port B's data direction register (DDRB): is your code setting and clearing the correct bit (PBn) numbers in DDRB?


MISO (INPUT)  PB?
MOSI (OUTPUT) PB?
SCK  (OUTPUT) PB?
SS   (OUTPUT) PB?



As a best practice, replace every magic number in your source code with a descriptive name (see self-documenting code). For example, add a header file named "my_defs.h" to your project and in that header file define some preprocessor macros that correspond to the CPU register names, I/O port bit positions, etc. for SPI bus related programming tasks.  Include that header file into your C source files, and in your C code use your preprocessor macros instead of the hard-coded register names, pin numbers, etc.


/*
 * my_defs.h
 *
 * Created: 6/7/2019 3:44:31 AM
 *  Author: me
 */ 

#ifndef MY_DEFS_H_
#define MY_DEFS_H_

#define BIT_SET(VALUE, BIT_POSITION) ((VALUE) |= (1&lt;&lt;(BIT_POSITION)))
#define BIT_CLEAR(VALUE, BIT_POSITION) ((VALUE) &amp;= ~(1&lt;&lt;(BIT_POSITION)))

/* PIN_MODE(PIN_NAME, IO_MODE)
 *  PIN_NAME = { MISO | MOSI | SCK | SS | ... }
 *  IO_MODE = { INPUT | OUTPUT }
 */
#define PIN_MODE(PIN_NAME, IO_MODE) (PIN_MODE_ ## IO_MODE(PIN_NAME ## _DDR, PIN_NAME ## _BIT))
#define PIN_MODE_OUTPUT(DDR, BIT_POSITION) BIT_SET(DDR, BIT_POSITION)
#define PIN_MODE_INPUT(DDR, BIT_POSITION) BIT_CLEAR(DDR, BIT_POSITION)

#ifdef __AVR_ATmega328P__

#define MISO_DDR DDRB
#define MISO_PORT PORTB
#define MISO_PIN PINB
#define MISO_BIT 4

#define MOSI_DDR DDRB
#define MOSI_PORT PORTB
#define MOSI_PIN PINB
#define MOSI_BIT 3

#define SCK_DDR DDRB
#define SCK_PORT PORTB
#define SCK_PIN PINB
#define SCK_BIT 5

#define SS_DDR DDRB
#define SS_PORT PORTB
#define SS_PIN PINB
#define SS_BIT 2

#endif /* __AVR_ATmega328P__ */

#endif /* MY_DEFS_H_ */


/*
 * main.c
 */

#include &lt;avr/io.h&gt;
#define F_CPU 16000000UL
#include "my_defs.h"

void
spi_bus_initialize()
{
    // Configure the SPI bus's MOSI, SCK, and SS pins as outputs
    PIN_MODE(MOSI, OUTPUT);
    PIN_MODE(SCK, OUTPUT);
    PIN_MODE(SS, OUTPUT);

    // Configure the SPI bus's MISO pin as an input
    PIN_MODE(MISO, INPUT);

    // Set the SPI bus's slave select signal (logic high == idle).
    BIT_SET(SS_PORT, SS_BIT);

    /* Other configuration tasks, e.g.,
     *    Master mode select
     *    Clock polarity, phase, and frequency
     *    etc...
     */

    // Enable the microcontroller's SPI bus circuitry
    BIT_SET(SPCR, SPE);
}

/* ... */