cancel
Showing results for 
Search instead for 
Did you mean: 

Why always to stop clock for read by SPI interface ?

gusonela
Associate II
Posted on May 19, 2014 at 01:48

uint8_t P_LIS302_Read1Adr(uint8_t adr)

{

uint8_t ret_wert=0;

uint8_t spi_wert;

// Chip Select to Lo

P_LIS302_CS(

Bit_RESET

);

// read an address

spi_wert=(adr&0x3F);

spi_wert|=0x80;

// 0b1000 0000 or

// Send address

UB_SPI1_SendByte(spi_wert);

// read address

ret_wert=UB_SPI1_SendByte(0x55);

// Chip Select to Hi

P_LIS302_CS(

Bit_SET

);

return

(ret_wert);

}

i get this code in repository, so i dont know all the code ...

I ask about why we should stop 

P_LIS302_CS(

Bit_RESET

);

in  this code is here

</p>

 

void

 

 

</b>

 

P_LIS302_CS(

BitAction

wert) {

 

 

if

(wert==

Bit_RESET

) {

 

LIS302_CS_GPIO_PORT->

BSRRH

= LIS302_CS_PIN;

 

}

 

else

{

 

LIS302_CS_GPIO_PORT->

BSRRL

= LIS302_CS_PIN;

 

}

}

 

 

why ?

#rtfm-lmgtfy
5 REPLIES 5
Posted on May 19, 2014 at 03:29

CS = CHIP SELECT

The signal is asserted LOW for the chip you are communicating with to be selected/activated.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
gusonela
Associate II
Posted on May 19, 2014 at 16:39

Thanks clive,, i have read datasheet for lis302dl and see the spi operation... CS have to low for start and high for stop... its true ?

thanks again clive
Posted on May 19, 2014 at 16:51

Use Google, get a data sheet for the part you are trying to communicate with. Needs CS LOW for SPI mode to function.

http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/CD00135460.pdf

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 19, 2014 at 17:26

i have read datasheet for lis302dl and see the spi operation... CS have to low for start and high for stop... its true ?

Perhaps a language issue, I would describe it as being LOW during the SPI transaction with the device.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
gusonela
Associate II
Posted on May 24, 2014 at 08:53

thanks clive,, one question again ...

why use send byte 0x55 ?

i dont understand