This is the DW1000 driver and our self developed distance measurement application based on it. We do this as a semester thesis at ETH Zürich under the Automatic Control Laboratory in the Department of electrical engineering.

Dependencies:   mbed

Revision:
12:985aa9843c3c
Parent:
11:c87d37db2c6f
Child:
13:b4d27bf7062a
--- a/main.cpp	Sun Nov 23 11:20:46 2014 +0000
+++ b/main.cpp	Sun Nov 23 14:34:31 2014 +0000
@@ -7,19 +7,19 @@
 
 
 uint64_t timestamp_old = 0;
-//#define SENDER
+#define SENDER
 
 void Interrupthandler() {
     /*uint8_t frameready = 0;
     dw.readRegister(DW1000_SYS_STATUS, 1, &frameready, 1);
     pc.printf("Interrupt status: %X\r\n", frameready);*/
     
-    uint16_t framelength = 0;                                       // get framelength
+    uint16_t framelength = 0;                                       // get framelength TODO: just for debugging of string
     dw.readRegister(DW1000_RX_FINFO, 0, (uint8_t*)&framelength, 2);
     framelength &= 0x03FF;
     framelength -= 2;
     
-    char* receive = dw.receiveString();
+    char* receive = dw.receiveString();                             // receive a string
     pc.printf("Received: %s %d   ", receive, framelength);
     delete[] receive;
     
@@ -35,11 +35,6 @@
     timestamp_old = timestamp;
     pc.printf("Timestamp: %lld\r\n", difference);
     
-    /*uint8_t xtalt;                            // for clock tuning
-    dw.readRegister(DW1000_FS_CTRL, 0x0E, (uint8_t*)&xtalt, 1);
-    pc.printf("XTALT: %X\r\n", xtalt);*/
-    
-    //dw.resetRX();                                                   // TODO DONE: reset was crucial because otherwise only 1 frame is received correct, cause: LDE crashing because you have to manually initialize
     dw.receiveFrame();
 }
 
@@ -53,19 +48,15 @@
     pc.printf("%d EUI register: %016llX\r\n", i, dw.getEUI());
     pc.printf("%d Voltage: %f\r\n", i, dw.getVoltage());
     
-    // read System Configuration
-    uint32_t conf = 0;
+    uint32_t conf = 0;     // read System Configuration
     dw.readRegister(DW1000_SYS_CFG, 0, (uint8_t*)&conf, 4);
     pc.printf("%d System Configuration: %X\r\n", i, conf);
     
-    wait(1);
-    
     dw.callbackRX = &Interrupthandler;
 #ifndef SENDER
     uint8_t dataframereadyinterrupt = 0x40; // only good frame 0x40 all frames 0x20
     dw.writeRegister(DW1000_SYS_MASK, 1, &dataframereadyinterrupt, 1);
     
-    // Receive something
     dw.receiveFrame();
 #endif