Skip to main content
Visitor II
June 9, 2025
Question

STM32H563ZIT6 SPI 16 bit with GPDMA linked list

  • June 9, 2025
  • 2 replies
  • 409 views

Hello,

Trying to implement SPI bus (Master only) to transmit 16 bit to LCD, utilize linked list GPDMA ch 6, I looked at the UART linked list example and tried to modify it to work with SPI with no success, only the first half word is sent and then it stops without any interrupts...

I'm using the "HAL_SPI_Transmit_DMA" after initiate all linked list array by CubeMx.

Does any one has any SPI linked list example?     

    This topic has been closed for replies.

    2 replies

    Technical Moderator
    June 9, 2025

    Hi @Oyulz.1 

    Please check the size of the transmitted data for the HAL_SPI_Transmit_DMA() function (BUFFERSIZE). Perhaps you have declared it as 8 bits instead of 16 bits.

    Also, check the configuration of the Linked List GPDMA. You can refer to this Knowledge Base article: "How to configure the linked list mode in STM32CubeMX", which might be helpful.

    Additionally, take a look for this Application Note AN5593, specifically section 3.4.5 Serial Peripheral Interface (SPI), and this example from STM32CubeH5 "SPI_FullDuplex_ComDMA_Master Example Description".

    Thank you.

    ELABI.1

     

    Oyulz.1Author
    Visitor II
    June 9, 2025

    Hi ELABI.1, 

    Thanks for your rapid response.

    It seems that when I switch to 16 bit, the condition inside "HAL_SPI_Transmit_DMA" meets, and goto HAL_ERROR

    As the variable SrcDataWidth does not initialize correctly... 


    @ELABI.1 wrote:

    Hi @Oyulz.1 

    Please check the size of the transmitted data for the HAL_SPI_Transmit_DMA() function (BUFFERSIZE). Perhaps you have declared it as 8 bits instead of 16 bits.

    Also, check the configuration of the Linked List GPDMA. You can refer to this Knowledge Base article: "How to configure the linked list mode in STM32CubeMX", which might be helpful.

    Additionally, take a look for this Application Note AN5593, specifically section 3.4.5 Serial Peripheral Interface (SPI), and this example from STM32CubeH5 "SPI_FullDuplex_ComDMA_Master Example Description".

    Thank you.

    ELABI.1

     




     

    Oyulz.1Author
    Visitor II
    June 9, 2025
    /* Packing mode management is enabled by the DMA settings */
    if (((hspi->Init.DataSize > SPI_DATASIZE_16BIT) && (hspi->hdmatx->Init.SrcDataWidth != DMA_SRC_DATAWIDTH_WORD) && (IS_SPI_FULL_INSTANCE(hspi->Instance))) || ((hspi->Init.DataSize > SPI_DATASIZE_8BIT) && (hspi->hdmatx->Init.SrcDataWidth == DMA_SRC_DATAWIDTH_BYTE)))
    {
    /* Restriction the DMA data received is not allowed in this mode */
    __HAL_UNLOCK(hspi);
    return HAL_ERROR;
    }