Hello,
In your code, the SPI control register 2 is configured so the Transfer Width is 16bit, Bidirectional Mode is enabled (only one data line; MOSI on Master side), Mode Fault failure detection is enabled.
Try setting it simply as SPICR2=0x00; See if it works and then experiment other bits. The SPICR1 should be OK, but in the main function SPI must be enabled by setting SPICR1_SPE bit. After SPI init, the SPI system must be enabled just before a start of SPI Master transfer.
The SPIBR should be OK. You set the Rate Divisor = Prescaler Divisor = 7.
Note that:
- BaudRateDivisor = (Prescaler+1)*2^(Rate Divisor)
- Baud Rate = BusClock/BaudRateDivisor
The IRQ will be enabled by setting the IRQEN configuration bit, which is OK, and clearing the I-bit in the CPU condition code register. It is inhibited at reset so this pin is initially configured as a simple input with a pull-up.
Concerning the AD7792 device, if you have problems, contact Analog Devices support.
Regards,
Ivan