cancel
Showing results for 
Search instead for 
Did you mean: 

IIS328DQ WHO_AM_I return not 0x32

mal h
Associate II

Hi, I am using IIS328DQ with SPI communication. When I Check register WHO_AM_I, it was return 0x64. It is wrong because in datasheet it mention must be 0x32. So what is the solution?

Thanks​

1 ACCEPTED SOLUTION

Accepted Solutions

Check the clock/data phase settings, you are reading with a bit shift.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

4 REPLIES 4

Check the clock/data phase settings, you are reading with a bit shift.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

i think my configuration for SPI already match with spec in Datasheet sensor.

here my SPI configuration

 hspi1.Instance = SPI1;

 hspi1.Init.Mode = SPI_MODE_MASTER;

 hspi1.Init.Direction = SPI_DIRECTION_2LINES;

 hspi1.Init.DataSize = SPI_DATASIZE_8BIT;

 hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;

 hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;

 hspi1.Init.NSS = SPI_NSS_SOFT;

 hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_16;

 hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;

 hspi1.Init.TIMode = SPI_TIMODE_DISABLE;

 hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;

 hspi1.Init.CRCPolynomial = 0x0;

 hspi1.Init.NSSPMode = SPI_NSS_PULSE_ENABLE;

 hspi1.Init.NSSPolarity = SPI_NSS_POLARITY_LOW;

 hspi1.Init.FifoThreshold = SPI_FIFO_THRESHOLD_01DATA;

 hspi1.Init.TxCRCInitializationPattern = SPI_CRC_INITIALIZATION_ALL_ZERO_PATTERN;

 hspi1.Init.RxCRCInitializationPattern = SPI_CRC_INITIALIZATION_ALL_ZERO_PATTERN;

 hspi1.Init.MasterSSIdleness = SPI_MASTER_SS_IDLENESS_00CYCLE;

 hspi1.Init.MasterInterDataIdleness = SPI_MASTER_INTERDATA_IDLENESS_00CYCLE;

 hspi1.Init.MasterReceiverAutoSusp = SPI_MASTER_RX_AUTOSUSP_DISABLE;

 hspi1.Init.MasterKeepIOState = SPI_MASTER_KEEP_IO_STATE_DISABLE;

 hspi1.Init.IOSwap = SPI_IO_SWAP_DISABLE;

any suggestion?

Thanks

ok you are right.. my fault :D

it solve with CLK Polarity HIGH, phase 2 edge.

Thanks..

RNata.15
Associate II

HEY Muhammad , can you share your code on how you read