cancel
Showing results for 
Search instead for 
Did you mean: 

ISM330DHCX Incorrect FIFO data / correct direct reading

Marconfr
Associate

[EDIT 03/04/25 09:15:35 AM] 

Well, it appears that, as usual, the real issue was sitting right in front of the keyboard… and could have been solved with a good old ‘Read The Freaking Manual.’ My deepest apologies for this classic case of user error! :grinning_face_with_sweat:

Sensor_ID inversion (0x01 and 0x02)

 

I'm struggling with programming the ISM330DHCX on a sony spresense. By following the documentation I write my register with these values:

CTRL1_XL: 0b01001000

CTRL2_G: 0b01001100

FIFO_CTRL1: 0b10010000

FIFO_CTRL2: 0b00000000

FIFO_CTRL3: 0b01000100

FIFO_CTRL4: 0b00000110

FIFO_CTRL3C: 0b01000100

The I read the FIFO (SPI) with this kind of code : 

 

 

 

void ISMSensor::read_FIFO(uint8_t *buffer, uint8_t ism_watermark)
{
  uint16_t transferSize = (ism_watermark * 7) + 1;
  uint8_t tx_rx_buffer[transferSize];

    tx_rx_buffer[0] = ISM330::ISM_REG::REG_FIFO_DATA_OUT_TAG | 0x80;
    for (uint16_t i = 1; i < transferSize; i++) {
      tx_rx_buffer[i] = 0x00;
    }
    bus->beginTransaction(spiSettings);
    digitalWrite(csPin, LOW); 

    bus->transfer(tx_rx_buffer, transferSize);

    digitalWrite(csPin, HIGH);
    bus->endTransaction();

    memcpy(buffer, &tx_rx_buffer[1], ism_watermark * 7);
}

 

 

 

Unfortunately, the values read are aberrant (~0 g on the Z axis) although :

1) The FIFO data tag is correct but value seems aberrant

 

 

 

0x09, 0x71, 0xFF, 0x2D, 0x00, 0x7F, 0x00, (accel)
0x11, 0x04, 0x80, 0xFC, 0x7F, 0xFC, 0x7F, (gyro)
0x0A, 0x71, 0xFF, 0x2D, 0x00, 0x7F, 0x00, (accel)
0x12, 0xFC, 0x7F, 0x46, 0x0D, 0xFC, 0x7F, (gyro)

 

 

 

2) when reading ISM OUT register, values are correct. (± 1g on z axis up or down)

 

I don't understand where my mistake or oversight came from. 

Can anyone help me?

1 ACCEPTED SOLUTION

Accepted Solutions
Marconfr
Associate

You can close or delete. I'v edited my initial post 3 days ago to explain i'm ***.

Regards

View solution in original post

2 REPLIES 2
Federica Bossi
ST Employee

Hi @Marconfr ,

Can you try to write your code following this example and let me know if you get accurate results?

It is not the same product but the FIFO works in the same way for the two IMUs.

Thanks.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Marconfr
Associate

You can close or delete. I'v edited my initial post 3 days ago to explain i'm ***.

Regards