I tried using burst write to load the config file 32 bytes at once, but it failed. It looks like my MCU only supports the write/read length of 2 bytes and one byte. So I have two question:
1. Is it okay if I use burst write to load the config file two bytes at once in the while loop?
2. Could you please expain the example code you replied in this post before? Here's the part that confuses me:
Does this mean you wrote both "0x00" and "file_count_" into INIT_ADDR_0 every time when looping?
A supplyment of my last question:
I tried writing two bytes into the register INIT_ADDR_0. (e.g I wrote 0xc8, 0x2e) However, the data I read from INIT_ADDR_0 is always 0x24 and 0x21. This is also resulted when I test other registers like INIT_CTRL other than INIT_ADDR_0.
Also, if I wrote one byte into INIT_ADDR_0, only the last 6 bit of the data can be write/read. (I wrote 10001000 into INIT_ADDR_0. But I read 001000 from it after that.)
First, your system supports burst read operation.
If yes, could you follow below code?
config_size = sizeof(bmi2xx_config_file);
file_count = 0;
while (config_size > 0)
// Begin I2C communication with provided I2C address
// Done writting, end the transmission
// Requests the required number of bytes from the sensor
// Reads the requested number of bytes into the provided array
uint16_t i = 0;
for (i = 0; (i < 32 ) && Wire.available(); i++)
reg_data[i] = Wire.read(); // This is for the modern Wire library
filepos += 32;
file_count += 1;
config_size -= 32;