Question
Is there anything to care about when using DMA transmit function of SPI (HAL_SPI_Transmit_DMA()) ?
I am trying to control a screen with spi interface of STM32H750VB. I have tried "HAL_SPI_Transmit()" and "HAL_SPI_Transmit_IT()", it works well. But when I tried "HAL_SPI_Transmit_DMA()", it does not work. So I wrote the following code to compare DMA transmitting function of UART and SPI, and I found "hspix.State" is always "HAL_SPI_STATE_BUSY_TX", but nothing happens to UART. Is there anyone knows what is wrong with my code, or is there anything remarkable about "HAL_SPI_Transmit_DMA()" ?
char debugInfo[] = "Debug Info\r\n";
while (1)
{
#if 1 // testing SPI transmitting function in DMA mode
HAL_SPI_Transmit_DMA(&hspi4, (uint8_t *)debugInfo, strlen(debugInfo) + 1);
while(hspi4.State != HAL_SPI_STATE_READY); // program will stuck here
#else // testing UART transmitting function in DMA mode
HAL_UART_Transmit_DMA(&huart1, (uint8_t *)debugInfo, strlen(debugInfo) + 1);
while(huart1.gState != HAL_UART_STATE_READY || huart1.RxState != HAL_UART_STATE_READY); // program won't stuck
#endif
HAL_Delay(500);
}
