2022-10-13 07:50 PM
2022-10-24 02:05 AM
Hi @ZHaid.1 ,
how many LIS3MDL are you seeing behaving this way?
You might check-first the current consumption just after the device power on (MD Bits are '11' by default).
You should also check the default configuration of the SPI pins and the INT and DRDY from application processor side: for example, the INT and DRDY default states are low, check also the SPI ones (e.g. the CS) and tray to change them, if possible, to check if you have an extra-consumption coming from these lines.
-Eleon
2022-10-24 06:00 PM
how many LIS3MDL are you seeing behaving this way?
It is occurring on all our boards
You might check-first the current consumption just after the device power on (MD Bits are '11' by default).
I will get back on this thing.
You should also check the default configuration of the SPI pins and the INT and DRDY from application processor side:
HAL_StatusTypeDef ret = HAL_OK;
hspi->Instance = SPI3;
hspi->Init.Mode = SPI_MODE_MASTER;
hspi->Init.Direction = SPI_DIRECTION_2LINES;
hspi->Init.DataSize = SPI_DATASIZE_8BIT;
hspi->Init.CLKPolarity = SPI_POLARITY_HIGH;
hspi->Init.CLKPhase = SPI_PHASE_2EDGE;
hspi->Init.NSS = SPI_NSS_SOFT;
hspi->Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_16;
hspi->Init.FirstBit = SPI_FIRSTBIT_MSB;
hspi->Init.TIMode = SPI_TIMODE_DISABLE;
hspi->Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
hspi->Init.CRCPolynomial = 7;
hspi->Init.CRCLength = SPI_CRC_LENGTH_DATASIZE;
hspi->Init.NSSPMode = SPI_NSS_PULSE_ENABLE;
if (HAL_SPI_Init(hspi) != HAL_OK)
{
ret = HAL_ERROR;
}
__HAL_SPI_ENABLE(hspi);
/* Configure LIS3MDL Interrupt Pin */
/* PF9 */
BSP_LIS3MDL_INT_GPIO_CLK_ENABLE();
GPIO_InitStruct.Pin = BSP_LIS3MDL_INT_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(BSP_LIS3MDL_INT_PORT, & GPIO_InitStruct);
/* EXTI interrupt init*/
/* Enable and set EXTI Interrupt priority */
HAL_NVIC_SetPriority(BSP_LIS3MDL_INT_EXTI_IRQn, BSP_LIS3MDL_INT_EXTI_IRQ_PP, BSP_LIS3MDL_INT_EXTI_IRQ_SP);
HAL_NVIC_EnableIRQ(BSP_LIS3MDL_INT_EXTI_IRQn);
/* Configure LIS3MDL Data Ready Pin */
/* PC8 */
BSP_LIS3MDL_DR_GPIO_CLK_ENABLE();
GPIO_InitStruct.Pin = BSP_LIS3MDL_DR_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(BSP_LIS3MDL_DR_PORT, & GPIO_InitStruct);
For example, the INT and DRDY default states are low, check also the SPI ones (e.g. the CS)
Pin Status when device starts:
Status of BSP_LIS3MDL_INT_PIN = 0
Status of BSP_LIS3MDL_DR_PIN = 0
Status of BSP_LIS3MDL_CS_PIN = 1
Pin status in continuous mode:
Status of BSP_LIS3MDL_INT_PIN = 0
Status of BSP_LIS3MDL_DR_PIN = 1
Status of BSP_LIS3MDL_CS_PIN = 1
Pin status in power down mode:
Status of BSP_LIS3MDL_INT_PIN = 0
Status of BSP_LIS3MDL_DR_PIN = 0
Status of BSP_LIS3MDL_CS_PIN = 1