cancel
Showing results for 
Search instead for 
Did you mean: 

PSSI DMA or IT on STM32H5?

olaan
Associate II

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

9 REPLIES 9
Imen.D
ST Employee

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)

 

 

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Imen.D
ST Employee

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).

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
olaan
Associate II

Hello!

Any updates on this?

Cheers,

// Ola

Imen.D
ST Employee

Hi @olaan ,

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

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

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

 

olaan
Associate II

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

Imen.D
ST Employee

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.

 

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
JesperEC
Associate II

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

 

JesperEC
Associate II

Hi @Imen.D 

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

   Best regards, Jesper