AnsweredAssumed Answered

ADT7310: /CS pin connected to GND?

Question asked by bugserm on Feb 3, 2012
Latest reply on Feb 9, 2012 by FEB

 

Hallo..

I have a question regarding configuration of SS pin of Master(atmega88) in program (AVR studio 4) when

the SS pin of the atmega88 ( Master) is not connected to /CS pin of ADT7310 (slave). /CS pin is always connected to GND.

In the datasheet atmega 88pa states that:

 

When the SPI is configured as a Master (MSTR in SPCR is set), the user can determine the direction of the SS pin.

 

If SS is configured as an output, the pin is a general output pin which does not affect the SPI system. Typically, the pin will be driving the SS pin of the SPI Slave.

 

If SS is configured as an input, it must be held high to ensure Master SPI operation. If the SS pin is driven low by peripheral circuitry when the SPI is configured as a Master with the SS pin defined as an input, the SPI system interprets this as another master selecting the SPI as a slave and starting to send data to it

 

I have only 1 master (atmega88) & 1 slave(adt7310 temperature sensor).so I connected my cs pin of the slave to GND. That means the adt7310 is always selected as slave.

 

If I just set the SS pin as Output as shown below..my sensor will not working (not giving any readings). In Datasheet atmega88 it clearly states that I can set SS pin as Output without affecting SPI system. Theoretically this setting should work but it doesn't. Why? Could anybody explains?

 

Code:

 


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

 

My sensor give readings when SS pin is set as Output & then set high as below:

 

Code:


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

 

My sensor also gives readings when SS pin is set as Input & then set high as below:

 

Code:


DDR_SPI = (1<<DD_MOSI)|(1<<DD_SCK); // MOSI and SCK output
DDR_SPI|= (0<<DD_SS);            // SS Input
PORTB|=(1<<DD_SS); // Set SS pin high

Outcomes