cancel
Showing results for 
Search instead for 
Did you mean: 

How do I configure/program with MDMA?

elso
Senior

Hi All,

I am struggling with that the maximum DMA buffer size is 64KB. I am currently transferring the data from an ADC to the Buffer using DMA with circular buffering, but I would want the buffer to be around 200KB. I have heard that one can use MDMA to transfer the DMA buffer information to a bigger buffer. I have never used MDMA before, and there is little information online about how to use it in CubeIDE. If someone can help me to configure the MDMA/DMA to do this, and what functions to use it would be very helpful!

Best regards,

Elso

1 ACCEPTED SOLUTION

Accepted Solutions
elso
Senior

Finally figured it out. This is how I would configure a 6 noded linked list. 

elso_4-1699536692092.png

This linked list will do a transfer from the a source buffer to a destination buffer when triggered by a software call: 

HAL_MDMA_GenerateSWRequest(&hmdma_mdma_channel0_sw_0);

These blocks below in the config file will need to be configured for each node. Example: Source address is replaced with the ptr or address to the source buffer. Destination address is configured the same way for the destination buffer. I would use block count 1 assuming you want to send 1 block, and block size, the size of the data you send. 

elso_3-1699536650099.png

 

View solution in original post

6 REPLIES 6
elso
Senior

elso_0-1698236433496.png

Like this

EXUE.2
ST Employee

you can find the STM32 cube demos for MDMA on st.com, or can use Cube-MX to build MDMA function automatically.

for example, STM32H747 MCU has MDMA module, you can find "STM32H747", you can find it on st.com, then you can get the completely demo to how to use MDMA.

EXUE2_0-1698832438038.png

 

Most of these files does not use a config file/ .IOC. Is MDMA enabled by default? Or do I have to define the macro myself to get the MDMA features?

 

elso_2-1698845849934.png

In this picture it shows that we can configure that DMA can trigger a request for MDMA, however is it possible for HF (half full), and not only TC (Transfer complete)?

Edit:

Not HF, I meant HT.

elso
Senior

Finally figured it out. This is how I would configure a 6 noded linked list. 

elso_4-1699536692092.png

This linked list will do a transfer from the a source buffer to a destination buffer when triggered by a software call: 

HAL_MDMA_GenerateSWRequest(&hmdma_mdma_channel0_sw_0);

These blocks below in the config file will need to be configured for each node. Example: Source address is replaced with the ptr or address to the source buffer. Destination address is configured the same way for the destination buffer. I would use block count 1 assuming you want to send 1 block, and block size, the size of the data you send. 

elso_3-1699536650099.png

 

CactusPete
Associate III

Peachy, but how do you setup a MDMA transfer for DAC or ADC?   There is only source or destination address.  No example found and can't pull null into destination or source for DAC and ADC.

I have NO issue starting DMA jobs for DAC or ADC via 'software start'. That's easy, makes sense and works fine.

Tying DMA to MDMA is where things break down for me since I need to sequence DAC and ADC jobs.  I call these jobs because for a software dev that's what each MDMA conceptually is.

I have a ADC DMA job I setup in the ADC peripheral setup tabs.  I can run this via software start and it works.  Now I want to do the same using MDMA. To start MDMA I'm using HAL_MDMA_Start_IT(.......) . I set the buffer for source and destination to the same as in software start, I set the size in bytes which is different than software start.  I get a HAL_OK, but do not get a MDMA_TransferCompleteCallback or MDMA_TransferErrorCallback event.   

This should be easy.  Hopefully someone sees what I'm doing wrong here.

Thanks