cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f407 mem to mem DMA with different Sizes

MehranMsba
Associate II

My data has zeros every 2 bytes.

it's like this: 0x55 0x55 00 00 0xaa 0xaa 00 00 0x33 0x33 00 00 ......

I want to remove these zeros with address increment feature of DMA.

I wrote a configuration for stm32f107 DMA and removed these zeros without problem but when I write same configuration for stm32f407 all data is copied.

my configuration is:

PINC=MINC=1 ,

PSIZE=32-bit and MSIZE=16-Bit,

PINCOS=0

I saw somethings about packing and padding for stm32f4 DMA in RM0090,but I can't understand it.

Thanks.

10 REPLIES 10
TDK
Guru

Doesn't setting PINCOS=1 do what you want? It reads that way to me.

If you feel a post has answered your question, please click "Accept as Solution".

I tried this with other configurations.

one of this configuration with pincos=1

Msize=2

Psize=1

is successful, but I think ​this configuration is special case. I need to revert the data again, in other mean I need to put zeros in data.

In ​rm0090,

"If Pincos bit is set, the address of the next transfer is address of previous one increment by 4 whatever the psize value."

So It's limited with pincos=1

You can revert the direction by using memory-to-peripheral transfer, triggered by a suitably set timer (triggering DMA as fast as possible).

JW

can you explain more?

Ok. I think I understand what you said. I have never used this mode for memory to memory operation.

The data buffer is large and triggering DMA with timer will take a long time, I think.

Also I am worried about DMA with ultra fast timer triggering that may has problem with bus accessing that caused increasing time access of CPU and other DMAs to bus.

> The data buffer is large and triggering DMA with timer will take a long time, I think.

No, you can trigger way faster than the DMA is capable of transferring. The net result is exactly the same as with the memory-to-memory mode.

JW

Thank you. 

I will test it. 

Before test I have a question and that is when I trig the Timer faster than the DMA operation, Is there any problem? for example, one data transfer with DMA take 10n Second and the timer trig in 5n Second, So how many times that I should trig the DMA when I don't know what is the DMA take long exactly.

> When I trig the Timer faster than the DMA operation, Is there any problem?

No, the extra triggers are simply ignored.

Btw., in an 'F407, DMA transfer will never take 10ns. The minimum system clock's cycle time is around 6ns, and one DMA cycle will be around 5-7 system cycles under ideal conditions.

JW