deca_params_init.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. /*! ----------------------------------------------------------------------------
  2. * @file deca_params_init.c
  3. * @brief DW1000 configuration parameters
  4. *
  5. * @attention
  6. *
  7. * Copyright 2015 (c) DecaWave Ltd, Dublin, Ireland.
  8. *
  9. * All rights reserved.
  10. *
  11. *
  12. * -------------------------------------------------------------------------------------------------------------------
  13. **/
  14. #include <stdio.h>
  15. #include <stdlib.h>
  16. #include "deca_regs.h"
  17. #include "deca_device_api.h"
  18. #include "deca_param_types.h"
  19. //-----------------------------------------
  20. // map the channel number to the index in the configuration arrays below
  21. // 0th element is chan 1, 1st is chan 2, 2nd is chan 3, 3rd is chan 4, 4th is chan 5, 5th is chan 7
  22. const uint8_t chan_idx[NUM_CH_SUPPORTED] = {0, 0, 1, 2, 3, 4, 0, 5};
  23. //-----------------------------------------
  24. const uint32_t tx_config[NUM_CH] =
  25. {
  26. RF_TXCTRL_CH1, /* Tx value match UM */
  27. RF_TXCTRL_CH2,
  28. RF_TXCTRL_CH3,
  29. RF_TXCTRL_CH4,
  30. RF_TXCTRL_CH5,
  31. RF_TXCTRL_CH7,
  32. };
  33. //RF -> Channel_Specific_Cfg -> Channel_Cfg -> RF_PLL -> RF PLL2
  34. const uint8_t pll2_config[NUM_CH][5] =
  35. {
  36. { 0x07, 0x04, 0x00, 0x09, 0x1E}, //3.5Ghz
  37. { 0x08, 0x05, 0x40, 0x08, 0x26}, //4Ghz
  38. { 0x09, 0x10, 0x40, 0x08, 0x56}, //4.5Ghz
  39. { 0x08, 0x05, 0x40, 0x08, 0x26}, //4Ghz WBW
  40. { 0x1D, 0x04, 0x00, 0x08, 0xBE}, //6.5Ghz
  41. { 0x1D, 0x04, 0x00, 0x08, 0xBE} //6.5Ghz WBW
  42. };
  43. const uint8_t pll2calcfg = (0x60 | 0x10) ; /* Bits 7:5 must always be set to binary “011”. Failure to maintain this value will result in DW1000 malfunction. */
  44. //bandwidth configuration
  45. const uint8_t rx_config[NUM_BW] =
  46. {
  47. 0xD8, //NBW
  48. 0xBC //WBW
  49. };
  50. const agc_cfg_struct agc_config =
  51. {
  52. AGC_TUNE2_VAL,
  53. { AGC_TUNE1_16M , AGC_TUNE1_64M } //adc target
  54. };
  55. const uint8_t dwnsSFDlen[NUM_BR] = { 0x40, 0x10, 0x08 }; //DW non-standard SFD length for 110k, 850k and 6.81M
  56. // SFD Threshold
  57. const uint16_t sftsh[NUM_BR][NUM_SFD] =
  58. {
  59. //110k
  60. {
  61. (0x0a), //RX_SFTSH_LONG - standard
  62. (0x16) //RX_SFTSH_USR_LONG - non-standard (DW - length specified above dwnsSFDlen)
  63. },
  64. //850k
  65. {
  66. (0x01), //RX_SFTSH_SHORT
  67. (0x06), //RX_SFTSH_USR_SHORT - non-standard (DW - length specified above dwnsSFDlen)
  68. },
  69. //6.81Mb
  70. {
  71. (0x01), //RX_SFTSH_SHORT
  72. (0x02), //RX_SFTSH_USR_SHORT - non-standard (DW - length specified above dwnsSFDlen)
  73. }
  74. };
  75. const uint16_t dtune1[NUM_PRF] =
  76. {
  77. 0x0087, // 16 MHz PRF
  78. 0x008D // 64 MHz PRF
  79. };
  80. const uint32_t digital_bb_config[NUM_PRF][NUM_PACS] =
  81. {
  82. //16 PRF
  83. {
  84. //PAC 8
  85. 0x311A002D,
  86. //PAC 16
  87. 0x331A0052,
  88. //PAC 32
  89. 0x351A009A,
  90. //PAC 64
  91. 0x371A011D
  92. },
  93. //64 PRF
  94. {
  95. //PAC 8
  96. 0x313B006B,
  97. //PAC 16
  98. 0x333B00BE,
  99. //PAC 32
  100. 0x353B015E,
  101. //PAC 64
  102. 0x373B0296
  103. }
  104. };
  105. const uint16_t lde_replicaCoeff[PCODES] = {
  106. // 0
  107. (int)(0.0 * 65536),
  108. // 1
  109. (int)(0.35 * 65536),
  110. // 2
  111. (int)(0.35 * 65536),
  112. // 3
  113. (int)(0.32 * 65536),
  114. // 4
  115. (int)(0.26 * 65536),
  116. // 5
  117. (int)(0.27 * 65536),
  118. // 6
  119. (int)(0.18 * 65536),
  120. // 7
  121. (int)(0.50 * 65536),
  122. // 8
  123. (int)(0.32 * 65536),
  124. // 9
  125. (int)(0.16 * 65536),
  126. // 10
  127. (int)(0.20 * 65536),
  128. // 11
  129. (int)(0.23 * 65536),
  130. // 12
  131. (int)(0.24 * 65536),
  132. // 13
  133. (int)(0.23 * 65536),
  134. // 14
  135. (int)(0.21 * 65536),
  136. // 15
  137. (int)(0.17 * 65536),
  138. // 16
  139. (int)(0.21 * 65536),
  140. // 17
  141. (int)(0.20 * 65536),
  142. // 18
  143. (int)(0.21 * 65536),
  144. // 19
  145. (int)(0.21 * 65536),
  146. // 20
  147. (int)(0.28 * 65536),
  148. // 21
  149. (int)(0.23 * 65536),
  150. // 22
  151. (int)(0.22 * 65536),
  152. // 23
  153. (int)(0.19 * 65536),
  154. // 24
  155. (int)(0.22 * 65536)
  156. };