2024-10-14 09:15 PM - edited 2024-10-14 09:59 PM
Hi.
I'm trying to use STM32H573IIKxQ's SPI using HAL.
I've noticed that the HAL library disables the SPI after each transfer which causes the SCK pin to go high and goes low again before the next transfer, which causes an extra bit being shifted to the slave device:
I tried to remove the line from HAL lib that disables SPI after finishing the transfer which cause the next transfers to not happening.
is there any solution for this? I mean is it possible to keep SPI enabled the whole time and then use it in different manners (pulling, IT, DMA, single byte transfer, ...) ?
Thank you.
Here is the part of the code that I'm trying:
spi_busy=1;
HAL_SPI_Transmit_DMA(&hspi2,buff,130);
while(spi_busy);
spi_busy=1;
HAL_SPI_Transmit_DMA(&hspi2,buff+40,80);
while(spi_busy);
HAL_SPI_TransmitReceive(&hspi2,buff+10,buff+5,3,20);
HAL_Delay(1);
spi_busy=1;
HAL_SPI_Transmit_DMA(&hspi2,buff+140,30);
while(spi_busy);
HAL_Delay(1);
HAL_SPI_TransmitReceive(&hspi2,buff+15,buff+5,3,20);
HAL_Delay(1);
HAL_SPI_TransmitReceive(&hspi2,buff+10,buff+5,3,20);
HAL_Delay(1);
spi_busy=1;
HAL_SPI_Transmit_DMA(&hspi2,buff+140,30);
while(spi_busy);
HAL_Delay(1);
HAL_SPI_TransmitReceive(&hspi2,buff+15,buff+5,3,20);
HAL_Delay(1);