Strictly necessary cookies are on by default and cannot be turned off. Functional, Performance and Tracking/targeting/sharing cookies can be turned on below based on your preferences (this banner will remain available for you to accept cookies). You may change your cookie settings by deleting cookies from your browser. Then this banner will appear again. You can learn more details about cookies HERE.
Strictly necessary (always on)
Functional, Performance and Tracking/targeting/sharing (default off)
I get even higher numbers: for 4095 bytes, the speed-up ratio memset/dmemset = 8.17, and memcpy/dmemcpy = 10.4. Data are attached.
I used the StopWatch component instead of toggled Pins to measure the elapsed BUS_CLK cycles, and the SerialPlot to output the results. Project is attached, all components are included into the project.
Table 1. Elapsed BUS_CLK for different size of the block (KIT-059, Creator 4.0)
Thank you for your results and modified program. I'll have to check it out.
I was using a framing pulse and a scope to derive my timing results. My memset()/dmemset() ratio is virtually identical to yours (8.10x) however my memcpy()/dmemcpy() ratio was closer to (7.12x).
In general, the actual DMA transfer was significantly faster. The additional time for each function was the CPU compute time to set up the DMA and then wait for the DMA to complete. The actual DMA transfer time is about 90% of time I logged for a large transfer (4095 bytes). The CPU overhead for smaller transfers is more significant that is why 64 bytes is the practical limit (memcpy()/dmemcpy() ~ 1) for these DMA-drive functions compared to the standard functions.
On a related note: For fun, I'm trying to implement a DMA-driven equivalent for the strlen() function. I've got the DMA HW state machine to work for the comparison to the NULL char ('\0') at the end of the string. However, when my digital comparator component finds it and places an active '1' to the TRQ input of the DMA, it does not terminate the DMA transfer. I've never needed to work with the TRQ before therefore I'm assuming I setup something incorrectly.
If you're willing to take a look at it, I would appreciate it. I posted my project at the following link: