Skip to main content
PFlor.2
Senior II
November 12, 2024
Solved

SPI interface to LCD with DMA

I'm using SPI on STM32H563 with DMA to interface to a ST7789 LCD controller.  During the LCD initialization I'm using a loop to send a series of command/data bytes using the HAL_SPI_Transmit_DMA() HAL function but the DMA status never goes back to READY (see my function below).

 

void LCD_IO_WriteMultipleData(uint8_t *pData, uint32_t Size)

{

  /* Swap endianes */

  ConvHL(pData, (int32_t)Size*2);

  DC_H();

  if (HAL_SPI_Transmit_DMA(&hspi3, pData, Size*2 ) != HAL_OK) {

    Error_Handler();

  }

  while (hspi3.hdmatx->State != HAL_DMA_STATE_READY);

}

Function hangs on the while loop at the end waiting on DMA to complete.

Please see attached images of .ioc SPI and DMA configuration.

 

This topic has been closed for replies.
MM..1
MM..1Best answer
Super User
November 12, 2024

 

 if (HAL_SPI_Transmit_DMA(&hspi3, pData, Size*2 ) != HAL_OK) {
 Error_Handler();
 }
 while (hspi3.hdmatx->State != HAL_DMA_STATE_READY);

 

realy use this is waste of DMA and must meet condition pData in DMA memory.

Start with normal SPI ... after this on you SPIconfig image you can see DMAtable try ...

3 replies

MM..1
MM..1Best answer
Super User
November 12, 2024

 

 if (HAL_SPI_Transmit_DMA(&hspi3, pData, Size*2 ) != HAL_OK) {
 Error_Handler();
 }
 while (hspi3.hdmatx->State != HAL_DMA_STATE_READY);

 

realy use this is waste of DMA and must meet condition pData in DMA memory.

Start with normal SPI ... after this on you SPIconfig image you can see DMAtable try ...

PFlor.2
PFlor.2Author
Senior II
November 14, 2024

starting with just SPI and can't get LCD to respond with that either, just be another problem that needs addressed outside of DMA