I want to connect an electronic micrometer to the microcontroller stm32f103с8t6. The electronic micrometer has 2 outputs (date and clk). Judging by the readings of the logical analyzer, this is similar to the SPI protocol.
In the cube I connected SPI1 (Receive Only Slave, Hardvare NSS-disable) through DMA (DMA in normal mode).
In the program, sw4stm32 indicated the function of receiving spi through DMA (HAL_SPI_Receive_DMA (& hspi1, (uint8_t *) pBuffer, 3)).
The reception of bytes occurs (every 100ms), but the buffer array constantly increases with the arrival of each packet and is not overwritten.
How to overwrite an array of DMA with the reception of each parcel, clearing the previous value?