How can I read from an accelerometer through i2c/spi for ~1 second at frequency>2kHz with precise distancing between measures
ADXL345 Datasheet.
The most interesting section is on the FIFO. See page 21:

The ADXL345 contains technology for an embedded memory management system with 32-level FIFO that can be used to minimize host processor burden. This buffer has four modes: bypass, FIFO, stream, and trigger (see FIFO Modes)

It sounds like you should set the FIFO mode to &quot;stream&quot;. Set the &quot;watermark&quot; level to something suitable (e.g. half the FIFO depth, 16) and the sample speed (BW_RATE register). Then the device will tell the MCU when it is ready, and you simply repeatedly read the data registers (note that you need to do a multi-byte read to get all the axes properly), until you have 16 values. Those will be the values sampled from the last 16 time periods.