I'm having problems to read my current sensor, which is located at the source leg of a power transistor.
This is my sensor datasheet TLI4970
This is my routine every 10ms:
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET); //Bring slave select low
HAL_SPI_Receive(&hspi1, (uint8_t *)&SPIRx, 2, 10); //Receive data
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET); //Bring slave select high
However, I get random values even when the current is zero. I'm getting values like:
0x8800
0x8803
0x8801
0xA7FF
0x87FC
0x97FE
0xA802
0xA801
0x97FD
0x87FD
0xA800
0xA7FE
According to the datasheet, these are sensor status messages, but none of them are Sensor Current Messages. The hardware seems okay. This sensor is not so common I think. I haven't found much help. Does anyone here have worked with SPI in STM32?
This is my sensor datasheet TLI4970
This is my routine every 10ms:
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET); //Bring slave select low
HAL_SPI_Receive(&hspi1, (uint8_t *)&SPIRx, 2, 10); //Receive data
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET); //Bring slave select high
However, I get random values even when the current is zero. I'm getting values like:
0x8800
0x8803
0x8801
0xA7FF
0x87FC
0x97FE
0xA802
0xA801
0x97FD
0x87FD
0xA800
0xA7FE
According to the datasheet, these are sensor status messages, but none of them are Sensor Current Messages. The hardware seems okay. This sensor is not so common I think. I haven't found much help. Does anyone here have worked with SPI in STM32?