Solved
AIS2120 Accelerometer Sensor
I'm encountering many issues while using the AIS2120 accelerometer sensor and would greatly appreciate your assistance. Thank you very much!
- After the sensor is powered on, a series of initializations (default configuration) are performed, then it enters normal mode, and then the corresponding acceleration data is read. Are these actions performed automatically by the sensor?Do I need to perform any operations to make the sensor enter normal mode?
- If I need to set it to 1600Hz, how should I operate? (I tried setting a soft reset and then writing to the configuration register, but it didn't work).
- I keep having communication issues, especially I'm not sure if the CRC check is correct. The manual is very vague. Attached is my CRC check function.
- I'm also unsure how to fill in the position indicating whether it is sensor data in the SDI frame.
uint8_t AIS1120SX_ubCrcVal(int32u ulCrcVal) {
uint8_t crc = 0x00;
uint8_t poly = 0x97;
for (uint8_t i = 0; i < 4; i++)
{
crc ^= (uint8_t) ((ulCrcVal >> (i * 8)));
for (uint8_t b = 0; b < 8; b++)
{
if (crc & 0x80)
{
crc = (uint8_t) ((crc << 1) ^ poly);
}
else
{
crc <<= 1;
}
}
}
return crc;
}




