DM5SG
Member
last weekend i tried to figure how use dma to copy data within memory. but i coundnt get it working. searching the net didnt wasnt helpfull neither
here we go :
the expected data transfer actually never happens. means.. m2m.complete() never returns true.
iam sure doing something not the right way .. but a missing lib description doesnt make easier.
yes .. there are a view hints here and there in damchannel.h but leaving question marks
here we go :
Code:
#include <Arduino.h>
#include <DMAChannel.h>
DMAChannel m2m(false);
int16_t buffer1[128 * 3];
int16_t buffer2[128 * 2];
void setup() {
Serial.begin(9600);
while(!Serial);
Serial.println("Go..");
for (int j = 0; j < 128 * 3;j++)
buffer1[j] = j;
m2m.begin();
//m2m.sourceCircular(buffer1, sizeof(buffer1));
m2m.sourceBuffer(buffer1,sizeof(buffer1));
m2m.destinationBuffer(buffer2, sizeof(buffer2));
//m2m.transferCount(sizeof(buffer2));
m2m.enable();
Serial.print("buffer1[10] = ");
Serial.println(buffer1[10]);
m2m.triggerManual();
while (!m2m.complete());
Serial.print("buffer2[10] = ");
Serial.println(buffer2[10]);
}
the expected data transfer actually never happens. means.. m2m.complete() never returns true.
iam sure doing something not the right way .. but a missing lib description doesnt make easier.
yes .. there are a view hints here and there in damchannel.h but leaving question marks