Revision 33f54213 source/DW1000/v1/deca_instance_common_v1.c

View differences:

source/DW1000/v1/deca_instance_common_v1.c
18 18
#include "module.h"
19 19
#include <string.h>
20 20
#include <math.h>
21
#include <v1/deca_instance_v1.h>
22

  
23

  
24
/*! @brief Software defined configuration settings for RTLS applications */
25
/*! Configuration for DecaRangeRTLS TREK Modes (4 default use cases selected by the switch S1 [2,3] on EVB1000, indexed 0 to 3 )*/
26
instanceConfig_t chConfig[4] ={
27
                               //mode 1 - S1: 2 off, 3 off
28
                               {
29
                                .channelNumber = 2,             // channel
30
                                .preambleCode = 4,              // preambleCode
31
                                .pulseRepFreq = DWT_PRF_16M,    // prf
32
                                .dataRate = DWT_BR_110K,        // datarate
33
                                .preambleLen = DWT_PLEN_1024,   // preambleLength
34
                                .pacSize = DWT_PAC32,           // pacSize
35
                                .nsSFD = 1,                     // non-standard SFD
36
                                .sfdTO = (1025 + 64 - 32)       // SFD timeout
37
                               },
38
                               //mode 2 - S1: 2 on, 3 off
39
                               {
40
                                .channelNumber = 2,            // channel
41
                                .preambleCode = 4,             // preambleCode
42
                                .pulseRepFreq = DWT_PRF_16M,   // prf
43
                                .dataRate = DWT_BR_6M8,        // datarate
44
                                .preambleLen = DWT_PLEN_128,   // preambleLength
45
                                .pacSize = DWT_PAC8,           // pacSize
46
                                .nsSFD = 0,                    // non-standard SFD
47
                                .sfdTO = (129 + 8 - 8)        // SFD timeout
48
                               },
49
                               //mode 3 - S1: 2 off, 3 on
50
                               {
51
                                .channelNumber = 5,             // channel
52
                                .preambleCode = 3,              // preambleCode
53
                                .pulseRepFreq = DWT_PRF_16M,    // prf
54
                                .dataRate = DWT_BR_110K,        // datarate
55
                                .preambleLen = DWT_PLEN_1024,   // preambleLength
56
                                .pacSize = DWT_PAC32,           // pacSize
57
                                .nsSFD = 1,                     // non-standard SFD
58
                                .sfdTO = (1025 + 64 - 32)       // SFD timeout
59
                               },
60
                               //mode 4 - S1: 2 on, 3 on
61
                               {
62
                                .channelNumber = 5,            // channel
63
                                .preambleCode = 3,             // preambleCode
64
                                .pulseRepFreq = DWT_PRF_16M,   // prf
65
                                .dataRate = DWT_BR_6M8,        // datarate
66
                                .preambleLen = DWT_PLEN_128,   // preambleLength
67
                                .pacSize = DWT_PAC8,           // pacSize
68
                                .nsSFD = 0,                    // non-standard SFD
69
                                .sfdTO = (129 + 8 - 8)        // SFD timeout
70
                               }
71
};
21 72

  
22 73

  
23
extern double dwt_getrangebias(uint8_t chan, float range, uint8_t prf);
24

  
25
extern const uint16_t rfDelays[2];
26
extern const uint16_t rfDelaysTREK[2];
27
extern const tx_struct txSpectrumConfig[8];
28

  
29

  
30

  
31
// -------------------------------------------------------------------------------------------------------------------
32
// Deca Calibration Values
33
// -------------------------------------------------------------------------------------------------------------------
74
/*! Slot and Superframe Configuration for DecaRangeRTLS TREK Modes (4 default use cases selected by the switch S1 [2,3] on EVB1000, indexed 0 to 3 )*/
75
sfConfig_t sfConfig[4] ={
76
                         //mode 1 - S1: 2 off, 3 off
77
                         {
78
                          .slotPeriod = (28), //slot duration in milliseconds (NOTE: the ranging exchange must be able to complete in this time
79
                          //e.g. tag sends a poll, 4 anchors send responses and tag sends the final + processing time
80
                          .numSlots = (10),        //number of slots in the superframe (8 tag slots and 2 used for anchor to anchor ranging),
81
                          .sfPeriod = (10*28),  //in ms => 280ms frame means 3.57 Hz location rate
82
                          .pollSleepDly = (10*28), //tag period in ms (sleep time + ranging time)
83
                          .replyDly = (25000) //poll to final delay in microseconds (needs to be adjusted according to lengths of ranging frames)
84
                         },
85
#if (DISCOVERY == 1)
86
                         //mode 2 - S1: 2 on, 3 off
87
                         {
88
                          .slotPeriod = (10), //slot duration in milliseconds (NOTE: the ranging exchange must be able to complete in this time
89
                          //e.g. tag sends a poll, 4 anchors send responses and tag sends the final + processing time
90
                          .numSlots = (100),        //number of slots in the superframe (98 tag slots and 2 used for anchor to anchor ranging),
91
                          .sfPeriod = (10*100),  //in ms => 1000 ms frame means 1 Hz location rate
92
                          .pollSleepDly = (10*100), //tag period in ms (sleep time + ranging time)
93
                          .replyDly = (2500) //poll to final delay in microseconds (needs to be adjusted according to lengths of ranging frames)
94

  
95
                         },
96
#else
97
                         //mode 2 - S1: 2 on, 3 off
98
                         {
99
                          .slotPeriod = (10), //slot duration in milliseconds (NOTE: the ranging exchange must be able to complete in this time
100
                          //e.g. tag sends a poll, 4 anchors send responses and tag sends the final + processing time
101
                          .numSlots = (10),        //number of slots in the superframe (8 tag slots and 2 used for anchor to anchor ranging),
102
                          .sfPeriod = (10*10),  //in ms => 100 ms frame means 10 Hz location rate
103
                          .pollSleepDly = (10*10), //tag period in ms (sleep time + ranging time)
104
                          .replyDly = (2500) //poll to final delay in microseconds (needs to be adjusted according to lengths of ranging frames)
105
                         },
106
#endif
107
                         //mode 3 - S1: 2 off, 3 on
108
                         {
109
                          .slotPeriod = (28), //slot duration in milliseconds (NOTE: the ranging exchange must be able to complete in this time
110
                          //e.g. tag sends a poll, 4 anchors send responses and tag sends the final + processing time
111
                          .numSlots = (10),        //number of slots in the superframe (8 tag slots and 2 used for anchor to anchor ranging),
112
                          .sfPeriod = (10*28),  //in ms => 280ms frame means 3.57 Hz location rate
113
                          .pollSleepDly = (10*28), //tag period in ms (sleep time + ranging time)
114
                          .replyDly = (20000) //poll to final delay in microseconds (needs to be adjusted according to lengths of ranging frames)
115

  
116
                         },
117
                         //mode 4 - S1: 2 on, 3 on
118
                         {
119
                          .slotPeriod = (10), //slot duration in milliseconds (NOTE: the ranging exchange must be able to complete in this time
120
                          //e.g. tag sends a poll, 4 anchors send responses and tag sends the final + processing time
121
                          .numSlots = (10),        //number of slots in the superframe (8 tag slots and 2 used for anchor to anchor ranging),
122
                          .sfPeriod = (10*10),  //in ms => 100 ms frame means 10 Hz location rate
123
                          .pollSleepDly = (10*10), //tag period in ms (sleep time + ranging time)
124
                          .replyDly = (2500) //poll to final delay in microseconds (needs to be adjusted according to lengths of ranging frames)
125
                         }
126
};
34 127

  
35
#define DWT_PRF_64M_RFDLY   (514.462f)
36
#define DWT_PRF_16M_RFDLY   (513.9067f)
37 128

  
38 129
// -------------------------------------------------------------------------------------------------------------------
39 130

  
......
341 432
// function to initialise instance structures
342 433
//
343 434
// Returns 0 on success and -1 on error
344
int instance_init(void){
435
//int instance_init(void){   // TODO
436
int instance_init(DW1000Driver* drv){
345 437
  int instance = 0 ;
346 438
  int i;
347 439
  int result;
......
356 448
  //dwt_softreset();
357 449

  
358 450
  //this initialises DW1000 and uses specified configurations from OTP/ROM
359
  result = dwt_initialise(DWT_LOADUCODE) ;
451
  result = dwt_initialise(DWT_LOADUCODE, drv) ;    // TODO
452
//  result = dwt_initialise(DWT_LOADUCODE) ;
360 453

  
361 454
  //this is platform dependent - only program if DW EVK/EVB
362 455
  dwt_setleds(3) ; //configure the GPIOs which control the leds on EVBs

Also available in: Unified diff