2014-05-18 04:48 PM
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 stopP_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
2014-05-18 06:29 PM
CS = CHIP SELECT
The signal is asserted LOW for the chip you are communicating with to be selected/activated.2014-05-19 07:39 AM
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 clive2014-05-19 07:51 AM
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
2014-05-19 08:26 AM
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.2014-05-23 11:53 PM