Skip to main content
Explorer
April 30, 2024
Question

PSSI DMA or IT on STM32H5?

  • April 30, 2024
  • 9 replies
  • 3186 views

Hello!

I have not been able to figure out how to get PSSI DMA working for the H5. For other peripherals, there is a DMA-tab in the configuration, but not for PSSI. Similarly, I have not been able to find any way of using interrupts for transmitting or receiving PSSI data. The XXX_Transmit_IT() & XXX_Receive_IT() functions available for many other peripherals are missing. As it is, my only option seems to be to synchronously send and poll for data.

My question is what am I missing? Is there another way of doing this for the STM32H5? If you could just point me in the right direction, I'd be most grateful.

Cheers,

// Ola

    This topic has been closed for replies.

    9 replies

    Technical Moderator
    April 30, 2024

    Hello @olaan  

    To properly configure and use PSSI on a STM32H5, you can follow the supported and recommended GPDMA settings in the AN5593 "How to use the GPDMA for STM32 MCUs" to be used for PSSI peripheral request (check the "GPDMA configuration for communication, audio and mathematical peripherals" section)

     

     

    Technical Moderator
    April 30, 2024

    Hi @olaan

    You are right, the 'DMA Settings' tab is missing in the PSSI configuration when using CubeMx.

    An internal ticket number 180456 is submitted in order to fix such issue.

    (PS: ticket number 180456 is an internal tracking number and is not accessible or usable by customers).

    olaanAuthor
    Explorer
    June 4, 2024

    Hello!

    Any updates on this?

    Cheers,

    // Ola

    Technical Moderator
    June 5, 2024

    Hi @olaan ,

    The issue will be fixed in the next release of STM32CubeMX.

    Graduate II
    August 26, 2024

    Hi @Imen.D,

    I checked STM32CubeIDE 1.16.0 but I could not find the DMA Settings discussed above.

    Please share what "next release" is specifically and time plans if available.

    I would also like to know if ST can provide any recommended workarounds for this or we need to wait for the tool chain to be updated which puts a lot of time pressure on our project unfortunately.

        Best regards, Jesper

     

    olaanAuthor
    Explorer
    August 27, 2024

    Right. So after a recent update we now have the necessary functions (HAL_PSSI_Transmit_DMA/HAL_PSSI_Receive_DMA) and after a bit of experimentation with DMA for UART together with reading what meagre documentation I could find on GPDMA on STM32h5, I got it to work by adding the following to the HAL_PSSI_MspInit() function:

     

     /* GPDMA1_REQUEST_PSSI_RX Init */
     handle_GPDMA1_Channel4.Instance = GPDMA1_Channel4;
     handle_GPDMA1_Channel4.Init.Request = GPDMA1_REQUEST_DCMI;
     handle_GPDMA1_Channel4.Init.BlkHWRequest = DMA_BREQ_SINGLE_BURST;
     handle_GPDMA1_Channel4.Init.Direction = DMA_PERIPH_TO_MEMORY;
     handle_GPDMA1_Channel4.Init.SrcInc = DMA_SINC_FIXED;
     handle_GPDMA1_Channel4.Init.DestInc = DMA_DINC_INCREMENTED;
     handle_GPDMA1_Channel4.Init.SrcDataWidth = DMA_SRC_DATAWIDTH_WORD;
     handle_GPDMA1_Channel4.Init.DestDataWidth = DMA_DEST_DATAWIDTH_WORD;
     handle_GPDMA1_Channel4.Init.Priority = DMA_LOW_PRIORITY_MID_WEIGHT; 
     handle_GPDMA1_Channel4.Init.SrcBurstLength = 1;
     handle_GPDMA1_Channel4.Init.DestBurstLength = 1;
     handle_GPDMA1_Channel4.Init.TransferAllocatedPort = DMA_SRC_ALLOCATED_PORT0|DMA_DEST_ALLOCATED_PORT1;
     handle_GPDMA1_Channel4.Init.TransferEventMode = DMA_TCEM_BLOCK_TRANSFER;
     handle_GPDMA1_Channel4.Init.Mode = DMA_NORMAL;
     if (HAL_DMA_Init(&handle_GPDMA1_Channel4) != HAL_OK)
     {
     Error_Handler();
     }
     __HAL_LINKDMA(hpssi, hdmarx, handle_GPDMA1_Channel4);
     if (HAL_DMA_ConfigChannelAttributes(&handle_GPDMA1_Channel4, DMA_CHANNEL_NPRIV) != HAL_OK)
     {
     Error_Handler();
     }
    
     /* GPDMA1_REQUEST_PSSI_TX Init */
     handle_GPDMA1_Channel1.Instance = GPDMA1_Channel1;
     handle_GPDMA1_Channel1.Init.Request = GPDMA1_REQUEST_DCMI;
     handle_GPDMA1_Channel1.Init.BlkHWRequest = DMA_BREQ_SINGLE_BURST;
     handle_GPDMA1_Channel1.Init.Direction = DMA_MEMORY_TO_PERIPH;
     handle_GPDMA1_Channel1.Init.SrcInc = DMA_SINC_INCREMENTED;
     handle_GPDMA1_Channel1.Init.DestInc = DMA_DINC_FIXED;
     handle_GPDMA1_Channel1.Init.SrcDataWidth = DMA_SRC_DATAWIDTH_WORD;
     handle_GPDMA1_Channel1.Init.DestDataWidth = DMA_DEST_DATAWIDTH_WORD;
     handle_GPDMA1_Channel1.Init.Priority = DMA_LOW_PRIORITY_HIGH_WEIGHT;
     handle_GPDMA1_Channel1.Init.SrcBurstLength = 1;
     handle_GPDMA1_Channel1.Init.DestBurstLength = 1;
     handle_GPDMA1_Channel1.Init.TransferAllocatedPort = DMA_SRC_ALLOCATED_PORT1|DMA_DEST_ALLOCATED_PORT0;
     handle_GPDMA1_Channel1.Init.TransferEventMode = DMA_TCEM_BLOCK_TRANSFER;
     handle_GPDMA1_Channel1.Init.Mode = DMA_PFCTRL; 
     if (HAL_DMA_Init(&handle_GPDMA1_Channel1) != HAL_OK)
     {
     Error_Handler();
     }
     __HAL_LINKDMA(hpssi, hdmatx, handle_GPDMA1_Channel1);
     if (HAL_DMA_ConfigChannelAttributes(&handle_GPDMA1_Channel1, DMA_CHANNEL_NPRIV) != HAL_OK)
     {
     Error_Handler();
     }

     

    I’m sure it can be improved. If you notice something that looks off, please let me know.

    Cheers,

    // Ola

    Technical Moderator
    August 27, 2024

    Hi @JesperEC 

    The fix was not included in the latest version of CubeMX 6.12.0 because it was too late when this problem was detected, and the version 6.12.0 was being tested and was ready for release.

    We have therefore scheduled the correction for coming versions.

    Thank you for your comprehension.

     

    Graduate II
    September 24, 2024

    Hi @Imen.D 

    Thanks. I think there is a risk that the hackish workaround we did for this will later collide with enabling DMA for the UART so we would still like an official solution via a CubeMX update.

    May I please ask you to share in which version the PSSI DMA code generation will be available in CubeMX?

       Best regards, Jesper

     

    Graduate II
    November 8, 2024

    Hi @Imen.D 

    Any update on the plans to include PSSI DMA code generation in CubeMX?

       Best regards, Jesper

     

    Graduate II
    March 6, 2025

    STM32CubeIDE 1.18 contains STM32CubeMX 6.14 and now there is a DMA Settings in the PSSI configuration tab and in the GPDMA1 config UI PSSI_RX and PSSI_TX are available in the drop-down menu CH0 / Request Configuration / Request.

    From a quick glance, the generated code looks sane - just a tad confusing because there is no GPDMA1_REQUEST_PSSI and GPDMA1_REQUEST_DCMI is used which I guess is due to that according to AN5593 rev 7, you can't use PSSI and DCMI at the same time.

    I haven't tested it on an actual STM32H5 though.