cancel
Showing results for 
Search instead for 
Did you mean: 

The problem with receiving signals by SPI

Siragh ASUTP
Associate II
Posted on July 10, 2017 at 17:26

Hello.

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?
2 REPLIES 2
Posted on July 10, 2017 at 20:18

Possibly circular mode might help.  Or just re-issue the HAL_SPI_Receive_DMA() using the base address after each transfer.