Hi, I trying to read out the M_DEVICEID register on the FS26 PMIC/SBC deivce from a S32K3 MCU with SPI, and I get the correct values for device ID, but a lot of Flags are set in the "General device status" bits response.
E.g. I see that bit COM_G is set, so I read out M_COM_FLAG and see that bit MSPI_CRC_I is set (CRC not valid).
I've tried different CRC calculations provided by AI assistance and all of them give the same result but get the CRC fault anyway.
This is what my SPI communication looks like.
Reading of M_DEVICEID register:

Reading of M_COM_FLG register:

As can be seen, both responses from FS26 gives 254 for General Device Status bits.
And in the last message (M_COM_FLG) the data is 0x04, which is MSPI_CRC_I.
In the above SPI messages I calculate CRC for reading M_DEVICEID register as 166 (0xA6) but the FS26 respond with 150 (0x96).
And for reading M_COM_FLG register I calculate and send CRC = 234 (0xEA) but FS26 respond with CRC 251 (0xFB).
These are the C function to calculate 8bit CRC:
uint8_t FS26_CalculateCRC(
uint8_t byte0,
uint8_t byte1,
uint8_t byte2,
uint8_t byte3)
{
uint8_t crc = 0xFF; // Seed
uint8_t poly = 0x1D;
// Data bytes used in CRC calculation:
// byte0 = bit31..24
// byte1 = bit23..16
// byte2 = bit15..8
// byte3 = CRC byte, assumed to be 0x00 during calculation
uint8_t data[4];
data[0] = byte0;
data[1] = byte1;
data[2] = byte2;
data[3] = byte3; // CRC byte cleared during calculation
for (int byte = 0; byte < 4; byte++)
{
crc ^= data[byte];
for (int bit = 0; bit < 8; bit++)
{
if (crc & 0x80)
{
crc = (crc << 1) ^ poly;
}
else
{
crc <<= 1;
}
}
}
return crc;
}
and the function above is called like this (where CRC is set intially to 0):
uint8_t crc = FS26_CalculateCRC(
masterTxData[0],
masterTxData[1],
masterTxData[2],
0);