This is going to be Quick Post showing Maximum Possible Performance of DMA in PIC32MX MCU, These tests are performed with PIC32MX470F512H running at 120Mhz
Short answer:
if you do not want to read further than. My result show DMA can perform 32bit transfers at rate of maximum 10Mhz. This result is quite similar to few other article on web, I do not have answer what exactly limit the maximum transfer rate to 10Mhz, but actual achievable transfer rate may vary depending on the System Bus availability, As System bus is shared between all DMA , CPU and other peripheral.
I have also tried to trigger transfer from timer and external interrupt , any trigger rate above 10Mhz start skipping transfers,
As rule of thumb on PIC32 Maximum achievable trigger rate of DMA is System clock divided by 10, as i have read quite a few places each DMA transfer takes roughly 10 System Clock Cycles.
Experiment 1:
In this test I have setup PMP in slave mode, and we will using DMA to push data out of MCU over 8Bit Parallel Master port(PMP). PMP is also set to Interrupt on each transfer which will trigger DMA to copy one byte from a lookup table into PMDOUT register.
lookup table looks like this
uint8_t look_up[]=
{
1,
1<<1,
1<<2,
1<<3,
1<<4,
1<<5,
1<<6,
1<<7,
};
This look up table will display like this on oscilloscope output :
RD is active low , which is set to active. and D0 to D7 shows lookup table on PMP 8bit Data output port.
Each Byte transfer trigger next DMA transfer of next byte, DMA also start automatically when when all bytes from table transferred, This test show Each byte take same amount of time of ~100ns.
Experiment 2:
As PMP also support Buffered Transfer , image blow taken from PIC32MX PMP datasheet.
in this experiment same lookup table will be transferred PMP set into buffed mode with PMP DMA trigger interrupt generated on every 4th byte. we will use 4byte PMDOUT buffer. Now DMA will be triggered on every 4th byte transfer and DMA will transfer 4byte in one go instead of 1byte.
As displayed by images blow , byte pattern remain same but you can see prebuffered byte take around ~30ns to transfer while as DMA triggers on every 4th byte, it takes same as before ~100ns.
TEST VIDEO
Short answer:
if you do not want to read further than. My result show DMA can perform 32bit transfers at rate of maximum 10Mhz. This result is quite similar to few other article on web, I do not have answer what exactly limit the maximum transfer rate to 10Mhz, but actual achievable transfer rate may vary depending on the System Bus availability, As System bus is shared between all DMA , CPU and other peripheral.
I have also tried to trigger transfer from timer and external interrupt , any trigger rate above 10Mhz start skipping transfers,
As rule of thumb on PIC32 Maximum achievable trigger rate of DMA is System clock divided by 10, as i have read quite a few places each DMA transfer takes roughly 10 System Clock Cycles.
Experiment 1:
In this test I have setup PMP in slave mode, and we will using DMA to push data out of MCU over 8Bit Parallel Master port(PMP). PMP is also set to Interrupt on each transfer which will trigger DMA to copy one byte from a lookup table into PMDOUT register.
lookup table looks like this
uint8_t look_up[]=
{
1,
1<<1,
1<<2,
1<<3,
1<<4,
1<<5,
1<<6,
1<<7,
};
This look up table will display like this on oscilloscope output :
RD is active low , which is set to active. and D0 to D7 shows lookup table on PMP 8bit Data output port.
DMA byte transfer rate ~100ns each transfer, DMA free triggered by PMP Transfer |
Experiment 2:
As PMP also support Buffered Transfer , image blow taken from PIC32MX PMP datasheet.
in this experiment same lookup table will be transferred PMP set into buffed mode with PMP DMA trigger interrupt generated on every 4th byte. we will use 4byte PMDOUT buffer. Now DMA will be triggered on every 4th byte transfer and DMA will transfer 4byte in one go instead of 1byte.
As displayed by images blow , byte pattern remain same but you can see prebuffered byte take around ~30ns to transfer while as DMA triggers on every 4th byte, it takes same as before ~100ns.
DMA Trigger every 4th Byte , Transfers 4byte in one go into PMP buffer. Prebuffered bytes takes ~30ns |
TEST VIDEO
thanks for this: yes, running @200MHz I get good results (expected, I mean) down to 100nS DMA operations (setup a timer for triggering, running @200MHz and hence dividing down to 20);
ReplyDeletebelow that figure, results become a bit unstable i.e. not corresponding to the given math: but anyway I was able to get down to some 30-40nS (see my post at microchip forum)