AnsweredAssumed Answered

ADT7310 SPI communication problem

Question asked by bugserm on Dec 6, 2011
Latest reply on Dec 8, 2011 by FEB

Hallo,

I'm trying to read data from ADT7310 register using atmega8515 as master on STK500 board.

The problem is everytime i send command byte to write or read, the ADT7310 keep sending back 0x00

on the Terminal program. I've tried to read the set point register (0x04) and the ADT7310 still replies 0x00.

I've tried to reset the ADT7310 by sending 0xFF four times (32 clock cycles) via SPI but nothing changes.

Any suggestion what could be done to solve this? Thanks.

 

Here are my SPI Master settings:

/CS pin is connected to ground.

SS- output high. The SS pin of Atmega8515 is not connected to /CS pin of ADT7310.

SCLK- fclk/16 ,  whereby fclk is the Atmega8515 internal clock (3.68Mhz)

 

Here is the source code for the SPI setting for Master.

 

//MASTER SPI setting, Clock rate fck/16

 

void SPI_MasterInit(void) {          // Initialise SPI in MASTER mode

     DDR_SPI = (1<<DD_MOSI)|(1<<DD_SCK);      // MOSI and SCK output

     DDR_SPI|= (1<<DD_SS);                         // SS output

 

     PORTB|=(1<<DD_SS);      // Set SS pin high

 

// SPI Control Reg. (SPCR) configurations

// define SPI communication mode & ready for data exchange

 

     SPCR|= (1<<SPE);              // SPI enable- Set SPE high

     SPCR &= ~(1<<DORD);      // Data order MSB first

     SPCR|=(1<<MSTR);            // Select master mode    

     SPCR|=(1<<CPOL);            // Clock Polarity: Leading edge- Falling, Trailling edge-Raising

     SPCR &= ~(1<<CPHA);     // Clock Phase: Leading edge- Setup, Trailling edge-Sample

 

     // Clock rate fclk/16

     SPSR &= ~(1<<SPI2X);

     SPCR &= ~(1<<SPR1);

     SPCR|= (1<<SPR0);    

}

Outcomes