I'm using I2C bus to access BMI270 sensor with STM32H7 board. The chip ID of the sensor is read correctly from the register 0x00 with 0x24. I followed the steps of initialization, write_reg(0x7c,0x00), write_reg(0x59, 0x00), as the datasheet written. And these steps look alright since the functions return "HAL_OK" status. Then I used a for loop to burst write the config file that I found in BMI270 API into register 0x5E. I wrote 1 byte from the config file array everytime in the for loop. The writing status of the function I was using is "HAL_OK" as well, which seems alright. Then I wrote 0x01 into the register again like the datasheet said. However, when I read 0x5E (where I loaded the congif file) to check if the config file was burst written correctly, it looked completely different. Could you please help me with this problem? Any guidence would be appreciated! Here is my code HAL_StatusTypeDef return_value; uint8_t addr = 0x7c; uint8_t addr1 = 0x59; uint8_t addr2 = 0x5e; uint8_t addr2_sub = 0x5e; uint8_t addr_chk = 0x21; uint8_t val[1]; val[0] = 0x00; uint8_t val_1[1]; val_1[0] = 0x01; uint8_t return_addr_chk[1]; // write_reg(0x7c, 0x00) return_value = HAL_I2C_Mem_Write(&hi2c1, (uint16_t)(BMI270_address), (uint16_t)addr, 1, val, 1, HAL_MAX_DELAY); if(return_value == HAL_OK){ HAL_Delay(450); // write_reg(0x59, 0x00) Burst write the config file return_value = HAL_I2C_Mem_Write(&hi2c1, (uint16_t)BMI270_address, (uint16_t)addr1, 1, val, 1, HAL_MAX_DELAY); if(return_value ==HAL_OK){ for(uint16_t i=0; i<sizeof(bmi270_config_file); i++){ return_value = HAL_I2C_Mem_Write(&hi2c1, (uint16_t)BMI270_address, (uint16_t)addr2_sub, 1, &bmi270_config_file[i], 1, HAL_MAX_DELAY); if(return_value != HAL_OK){ break; } } } } return_value = HAL_I2C_Mem_Write(&hi2c1, (uint16_t)(BMI270_address), (uint16_t)addr1, 1, val_1, 1, HAL_MAX_DELAY); // write_reg(0x59,0x01) if(return_value != HAL_OK){ HAL_Delay(100); } return_value = HAL_I2C_Mem_Read(&hi2c1, (uint16_t)(BMI270_address|0x01), addr_chk, 1, return_addr_chk, 1, HAL_MAX_DELAY); // read INTERNAL_STATUS uint8_t config_file_check[8192]; return_value = HAL_I2C_Mem_Read(&hi2c1, (uint16_t)(BMI270_address|0x01), 0x5e, sizeof(bmi270_config_file), config_file_check, sizeof(bmi270_config_file), HAL_MAX_DELAY); // check if the file loaded correctly
... View more