DMA for Science thread

Dependencies:   SimpleDMA mbed-rtos mbed

Fork of spiDMAtest by Shreesha S

Files at this revision

API Documentation at this revision

Comitter:
ee12b079
Date:
Sat Sep 24 08:13:32 2016 +0000
Parent:
2:16545dbc88ae
Commit message:
checking dma - 24-09-2016

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 16545dbc88ae -r 9cc2653d3e83 main.cpp
--- a/main.cpp	Thu Jul 16 05:40:25 2015 +0000
+++ b/main.cpp	Sat Sep 24 08:13:32 2016 +0000
@@ -1,12 +1,15 @@
 #include "mbed.h"
 #include "SimpleDMA.h"
 #include "dmaSPIslave.h"
-
-#define PAYLOAD_LENGTH 1024
-
-dmaSPISlave spi(PTA16, PTA17, PTA15, PTA14);
+#define PAYLOAD_LENGTH 6723
+     #define PAY_SPI_MOSI PTE18
+    #define PAY_SPI_MISO PTE19
+    #define PAY_SPI_CLK PTE17
+    #define PAY_SPI_CS PTE16
+Timer T;
+dmaSPISlave spi(PAY_SPI_MOSI, PAY_SPI_MISO, PAY_SPI_CLK, PAY_SPI_CS);
 RawSerial pc(USBTX, USBRX);
-DigitalOut ledg(LED_GREEN);
+DigitalOut ledg(PTB11);
 
 bool flag = false;
 
@@ -15,10 +18,10 @@
 }
 
 int main(){
-    pc.baud(9600);
+    pc.baud(1200);
     pc.printf("inside main\r\n");
     spi.format(8,0);
-    spi.frequency(10000000);
+    spi.frequency(1000000);
     
     uint8_t buffer[PAYLOAD_LENGTH] = {0};
     pc.printf("welcome to dma test, start sending data now\r\n");
@@ -27,16 +30,16 @@
     spi.bulkRead_init(buffer, PAYLOAD_LENGTH, &do_this);
 //    start dma read
     spi.bulkRead_start();
-    
+    T.start();
     while(true){
         if(flag){
             flag = false;
             ledg = !ledg;
-
-//            for(int i = 0 ; i < PAYLOAD_LENGTH ; ++i){
-//                pc.printf("%02x ", buffer[i]);
-//            }
-//            pc.printf("\r\n");
+            pc.printf("re %f\n",T.read());
+            /*for(int i = 0 ; i < PAYLOAD_LENGTH ; ++i){
+                pc.printf("%02x ", buffer[i]);
+            }
+            pc.printf("\r\n");*/
 
 //            start dma again after handling the data
             spi.bulkRead_start();