Arduino driver library for Decawave DW1000  Dec 20 2016
DW1000Constants.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 by Thomas Trojer <thomas@trojer.net>
3  * Decawave DW1000 library for arduino.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * @file DW1000Constants.h
18  * Arduino driver library (header file) for the Decawave DW1000 UWB transceiver IC.
19  */
20 
21 #ifndef _DW1000CONSTANTS_H_INCLUDED
22 #define _DW1000CONSTANTS_H_INCLUDED
23 
24 // time stamp byte length
25 #define LEN_STAMP 5
26 
27 // enum to determine RX or TX mode of device
28 #define IDLE_MODE 0x00
29 #define RX_MODE 0x01
30 #define TX_MODE 0x02
31 
32 // used for SPI ready w/o actual writes
33 #define JUNK 0x00
34 
35 // no sub-address for register write
36 #define NO_SUB 0xFF
37 
38 // device id register
39 #define DEV_ID 0x00
40 #define LEN_DEV_ID 4
41 
42 // extended unique identifier register
43 #define EUI 0x01
44 #define LEN_EUI 8
45 
46 // PAN identifier, short address register
47 #define PANADR 0x03
48 #define LEN_PANADR 4
49 
50 // device configuration register
51 #define SYS_CFG 0x04
52 #define LEN_SYS_CFG 4
53 #define FFEN_BIT 0
54 #define FFBC_BIT 1
55 #define FFAB_BIT 2
56 #define FFAD_BIT 3
57 #define FFAA_BIT 4
58 #define FFAM_BIT 5
59 #define FFAR_BIT 6
60 #define DIS_DRXB_BIT 12
61 #define DIS_STXP_BIT 18
62 #define HIRQ_POL_BIT 9
63 #define RXAUTR_BIT 29
64 #define PHR_MODE_SUB 16
65 #define LEN_PHR_MODE_SUB 2
66 #define RXM110K_BIT 22
67 
68 // device control register
69 #define SYS_CTRL 0x0D
70 #define LEN_SYS_CTRL 4
71 #define SFCST_BIT 0
72 #define TXSTRT_BIT 1
73 #define TXDLYS_BIT 2
74 #define TRXOFF_BIT 6
75 #define WAIT4RESP_BIT 7
76 #define RXENAB_BIT 8
77 #define RXDLYS_BIT 9
78 
79 // system event status register
80 #define SYS_STATUS 0x0F
81 #define LEN_SYS_STATUS 5
82 #define CPLOCK_BIT 1
83 #define AAT_BIT 3
84 #define TXFRB_BIT 4
85 #define TXPRS_BIT 5
86 #define TXPHS_BIT 6
87 #define TXFRS_BIT 7
88 #define LDEDONE_BIT 10
89 #define RXPHE_BIT 12
90 #define RXDFR_BIT 13
91 #define RXFCG_BIT 14
92 #define RXFCE_BIT 15
93 #define RXRFSL_BIT 16
94 #define RXRFTO_BIT 17
95 #define LDEERR_BIT 18
96 #define RFPLL_LL_BIT 24
97 #define CLKPLL_LL_BIT 25
98 
99 // system event mask register
100 // NOTE: uses the bit definitions of SYS_STATUS (below 32)
101 #define SYS_MASK 0x0E
102 #define LEN_SYS_MASK 4
103 
104 // system time counter
105 #define SYS_TIME 0x06
106 #define LEN_SYS_TIME LEN_STAMP
107 
108 // RX timestamp register
109 #define RX_TIME 0x15
110 #define LEN_RX_TIME 14
111 #define RX_STAMP_SUB 0x00
112 #define FP_AMPL1_SUB 0x07
113 #define LEN_RX_STAMP LEN_STAMP
114 #define LEN_FP_AMPL1 2
115 
116 // RX frame quality
117 #define RX_FQUAL 0x12
118 #define LEN_RX_FQUAL 8
119 #define STD_NOISE_SUB 0x00
120 #define FP_AMPL2_SUB 0x02
121 #define FP_AMPL3_SUB 0x04
122 #define CIR_PWR_SUB 0x06
123 #define LEN_STD_NOISE 2
124 #define LEN_FP_AMPL2 2
125 #define LEN_FP_AMPL3 2
126 #define LEN_CIR_PWR 2
127 
128 // TX timestamp register
129 #define TX_TIME 0x17
130 #define LEN_TX_TIME 10
131 #define TX_STAMP_SUB 0
132 #define LEN_TX_STAMP LEN_STAMP
133 
134 // timing register (for delayed RX/TX)
135 #define DX_TIME 0x0A
136 #define LEN_DX_TIME LEN_STAMP
137 
138 // transmit data buffer
139 #define TX_BUFFER 0x09
140 #define LEN_TX_BUFFER 1024
141 #define LEN_UWB_FRAMES 127
142 #define LEN_EXT_UWB_FRAMES 1023
143 
144 // RX frame info
145 #define RX_FINFO 0x10
146 #define LEN_RX_FINFO 4
147 
148 // receive data buffer
149 #define RX_BUFFER 0x11
150 #define LEN_RX_BUFFER 1024
151 
152 // transmit control
153 #define TX_FCTRL 0x08
154 #define LEN_TX_FCTRL 5
155 
156 // channel control
157 #define CHAN_CTRL 0x1F
158 #define LEN_CHAN_CTRL 4
159 #define DWSFD_BIT 17
160 #define TNSSFD_BIT 20
161 #define RNSSFD_BIT 21
162 
163 // user-defined SFD
164 #define USR_SFD 0x21
165 #define LEN_USR_SFD 41
166 #define SFD_LENGTH_SUB 0x00
167 #define LEN_SFD_LENGTH 1
168 
169 // OTP control (for LDE micro code loading only)
170 #define OTP_IF 0x2D
171 #define OTP_ADDR_SUB 0x04
172 #define OTP_CTRL_SUB 0x06
173 #define OTP_RDAT_SUB 0x0A
174 #define LEN_OTP_ADDR 2
175 #define LEN_OTP_CTRL 2
176 #define LEN_OTP_RDAT 4
177 
178 // AGC_TUNE1/2 (for re-tuning only)
179 #define AGC_TUNE 0x23
180 #define AGC_TUNE1_SUB 0x04
181 #define AGC_TUNE2_SUB 0x0C
182 #define AGC_TUNE3_SUB 0x12
183 #define LEN_AGC_TUNE1 2
184 #define LEN_AGC_TUNE2 4
185 #define LEN_AGC_TUNE3 2
186 
187 // DRX_TUNE2 (for re-tuning only)
188 #define DRX_TUNE 0x27
189 #define DRX_TUNE0b_SUB 0x02
190 #define DRX_TUNE1a_SUB 0x04
191 #define DRX_TUNE1b_SUB 0x06
192 #define DRX_TUNE2_SUB 0x08
193 #define DRX_TUNE4H_SUB 0x26
194 #define LEN_DRX_TUNE0b 2
195 #define LEN_DRX_TUNE1a 2
196 #define LEN_DRX_TUNE1b 2
197 #define LEN_DRX_TUNE2 4
198 #define LEN_DRX_TUNE4H 2
199 
200 // LDE_CFG1 (for re-tuning only)
201 #define LDE_IF 0x2E
202 #define LDE_CFG1_SUB 0x0806
203 #define LDE_RXANTD_SUB 0x1804
204 #define LDE_CFG2_SUB 0x1806
205 #define LDE_REPC_SUB 0x2804
206 #define LEN_LDE_CFG1 1
207 #define LEN_LDE_CFG2 2
208 #define LEN_LDE_REPC 2
209 #define LEN_LDE_RXANTD 2
210 
211 // TX_POWER (for re-tuning only)
212 #define TX_POWER 0x1E
213 #define LEN_TX_POWER 4
214 
215 // RF_CONF (for re-tuning only)
216 #define RF_CONF 0x28
217 #define RF_RXCTRLH_SUB 0x0B
218 #define RF_TXCTRL_SUB 0x0C
219 #define LEN_RF_RXCTRLH 1
220 #define LEN_RF_TXCTRL 4
221 
222 // TX_CAL (for re-tuning only)
223 #define TX_CAL 0x2A
224 #define TC_PGDELAY_SUB 0x0B
225 #define LEN_TC_PGDELAY 1
226 #define TC_SARC 0x00
227 #define TC_SARL 0x03
228 
229 // FS_CTRL (for re-tuning only)
230 #define FS_CTRL 0x2B
231 #define FS_PLLCFG_SUB 0x07
232 #define FS_PLLTUNE_SUB 0x0B
233 #define FS_XTALT_SUB 0x0E
234 #define LEN_FS_PLLCFG 4
235 #define LEN_FS_PLLTUNE 1
236 #define LEN_FS_XTALT 1
237 
238 // PMSC
239 #define PMSC 0x36
240 #define PMSC_CTRL0_SUB 0x00
241 #define LEN_PMSC_CTRL0 4
242 
243 // TX_ANTD Antenna delays
244 #define TX_ANTD 0x18
245 #define LEN_TX_ANTD 2
246 
247 #endif