-
Notifications
You must be signed in to change notification settings - Fork 1
/
ADS126x_constants.py
621 lines (497 loc) · 10.8 KB
/
ADS126x_constants.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
ADS1262_NUM_REG = 0x15 # ADS1262 has 21 registers */
ADS1263_NUM_REG = 0x1B # ADS1263 has 27 registers */
# SPI Commands */
NOP = 0x00
RESET = 0x06
START1 = 0x08
STOP1 = 0x0B
RDATA1 = 0x12
SYOCAL1 = 0x16
SYGCAL1 = 0x17
SFOCAL1 = 0x19
# Multi-Byte Commands
RREG = 0x20
WREG = 0x40
# Additional ADS1263 Commands */
START2 = 0x0C # ID/CFG REGISTER (ADDRESS 00h */
STOP2 = 0x0E # ID/CFG REGISTER (ADDRESS 00h */
RDATA2 = 0x14 # ID/CFG REGISTER (ADDRESS 00h */
SYOCAL2 = 0x1B # ID/CFG REGISTER (ADDRESS 00h */
SYGCAL2 = 0x1C # ID/CFG REGISTER (ADDRESS 00h */
SFOCAL2 = 0x1E # ID/CFG REGISTER (ADDRESS 00h */
# STATUS Byte Masks */
# define ADC2_NEW = 0x80 # Indicates new ADC2 data */
# define ADC1_NEW = 0x40 # Indicates new ADC1 data */
# define EXTCLK = 0x20 # Indicates ADC clock source */
# define REF_ALM = 0x10 # Low Reference Alarm - Only used with ADC1 */
# define PGAL_ALM = 0x08 # PGA Output Low Alarm - Only used with ADC1 */
# define PGAH_ALM = 0x04 # PGA Output High Alarm - Only used with ADC1 */
# define PGAD_ALM = 0x02 # PGA Diff Output Alarm - Only used with ADC1 */
# define RST_ALM = 0x01 # Indicates device reset (re-named to avoid conflict */
# Register Addresses */
ID = 0x00 # Device Identification Register
POWER = 0x01 # Power Register
INTERFACE = 0x02 # Interface Register
MODE0 = 0x03
MODE1 = 0x04
MODE2 = 0x05
INPMUX = 0x06
OFCAL0 = 0x07 # Offset Calibration, Low Byte
OFCAL1 = 0x08 # Offset Calibration, Mid Byte
OFCAL2 = 0x09 # Offset Calibration, High Byte
FSCAL0 = 0x0A # Full-Scale Calibration, Low Byte
FSCAL1 = 0x0B # Full-Scale Calibration, Mid Byte
FSCAL2 = 0x0C # Full-Scale Calibration, High Byte
IDACMUX = 0x0D
IDACMAG = 0x0E
REFMUX = 0x0F
TDACP = 0x10 # CONFIGURATION REGISTER 0 (ADDRESS 01h */
TDACN = 0x11 # CONFIGURATION REGISTER 1 (ADDRESS 02h */
GPIOCON = 0x12 # High-Pass Filter Corner Frequency, Low Byte (Address 03h */
GPIODIR = 0x13 # High-Pass Filter Corner Frequency, High Byte (Address 04h */
GPIODAT = 0x14
# Additional ADS1263 Registers */
ADC2CFG = 0x15
ADC2MUX = 0x16
ADC2OFC0 = 0x17
ADC2OFC1 = 0x18
ADC2FSC0 = 0x19
ADC2FSC1 = 0x1A
# Default Register Values */
# ID_DEFAULT_VALUE = 0x00 # ID/CFG REGISTER (ADDRESS 00h*/
POWER_DEFAULT_VALUE = 0x19 # CONFIGURATION REGISTER 0 (ADDRESS 01h */
INTERFACE_DEFAULT_VALUE = 0x05 # CONFIGURATION REGISTER 1 (ADDRESS 02h */
MODE0_DEFAULT_VALUE = 0x00 # High-Pass Filter Corner Frequency, Low Byte (Address 03h */
MODE1_DEFAULT_VALUE = 0x80 # High-Pass Filter Corner Frequency, High Byte (Address 04h */
MODE2_DEFAULT_VALUE = 0x04 # Offset Calibration, Low Byte (Address 05h */
INPMUX_DEFAULT_VALUE = 0x01 # Offset Calibration, Mid Byte (Address 06h */
OFCAL0_DEFAULT_VALUE = 0x00 # Offset Calibration, High Byte (Address 07h */
OFCAL1_DEFAULT_VALUE = 0x00 # Full-Scale Calibration, Low Byte (Address 08h */
OFCAL2_DEFAULT_VALUE = 0x00 # Full-Scale Calibration, Mid Byte (Address 09h */
FSCAL0_DEFAULT_VALUE = 0x00 # Full-Scale Calibration, High Byte (Address 0Ah */
FSCAL1_DEFAULT_VALUE = 0x00
FSCAL2_DEFAULT_VALUE = 0x40
IDACMUX_DEFAULT_VALUE = 0xBB
IDACMAG_DEFAULT_VALUE = 0x00
REFMUX_DEFAULT_VALUE = 0x00
TDACP_DEFAULT_VALUE = 0x00
TDACN_DEFAULT_VALUE = 0x00
GPIOCON_DEFAULT_VALUE = 0x00
GPIODIR_DEFAULT_VALUE = 0x00
GPIODAT_DEFAULT_VALUE = 0x00
ADC2CFG_DEFAULT_VALUE = 0x00
ADC2MUX_DEFAULT_VALUE = 0x01
ADC2OFC0_DEFAULT_VALUE = 0x00
ADC2OFC1_DEFAULT_VALUE = 0x00
ADC2FSC0_DEFAULT_VALUE = 0x00
ADC2FSC1_DEFAULT_VALUE = 0x40
# Register Field Definitions */
# POWER Register Fields */
RST = 0x10
VBIAS = 0x02
INTREF = 0x01
# INTERFACE Register Fields */
TIMEOUT = 0x08
STATUS = 0x04
# CRC1 = 0x02
# CRC0 = 0x01
CRC_MASK = 0x03
# CRC Field
CRC_OFF = 0x00
CRC_CHKSUM = 0x01
CRC_ON = 0x02
# MODE0 Register Fields */
REFREV = 0x80
RUNMODE = 0x40
# CHOP1 = 0x20
# CHOP0 = 0x10
CHOP_MASK = 0x30
# CHOP Field
CHOP_OFF = 0x00
CHOP_ON = 0x10
CHOP_IDAC = 0x20
CHOP_ON_IDAC = 0x30
# DELAY3 = 0x08
# DELAY2 = 0x04
# DELAY1 = 0x02
# DELAY0 = 0x01
DELAY_MASK = 0x0F # Additional Settling Delay Field */
# DELAY Field
DELAY_0us = 0x00
DELAY_8_7us = 0x01
DELAY_17us = 0x02
DELAY_35us = 0x03
DELAY_69us = 0x04
DELAY_139us = 0x05
DELAY_278us = 0x06
DELAY_555us = 0x07
DELAY_1100us = 0x08
DELAY_2200us = 0x09
DELAY_4400us = 0x0A
DELAY_8800us = 0x0B
# MODE1 Register Fields */
# FILTER_2 = 0x80
# FILTER_1 = 0x40
# FILTER_0 = 0x20
FILTER_MASK = 0xE0
# DELAY Field
FILTER_SINC1 = 0x00
FILTER_SINC2 = 0x20
FILTER_SINC3 = 0x40
FILTER_SINC4 = 0x60
FILTER_FIR = 0x80
SBADC = 0x10
SBPOL = 0x08
# SBMAG2 = 0x04
# SBMAG1 = 0x02
# SBMAG0 = 0x01
SBMAG_MASK = 0x07
# SBMAG Field
SBMAG_0uA = 0x00
SBMAG_0_5uA = 0x01
SBMAG_2uA = 0x02
SBMAG_10uA = 0x03
SBMAG_50uA = 0x04
SBMAG_200uA = 0x05
SBMAG_10MOhm = 0x06
# MODE2 Register Fields */
BYPASS = 0x80
# GAIN2 = 0x40
# GAIN1 = 0x20
# GAIN0 = 0x10
GAIN_MASK = 0x70
# GAIN Field
GAIN_1 = 0x00
GAIN_2 = 0x10
GAIN_4 = 0x20
GAIN_8 = 0x30
GAIN_16 = 0x40
GAIN_32 = 0x50
# DR3 = 0x08
# DR2 = 0x04
# DR1 = 0x02
# DR0 = 0x01
DR_MASK = 0x0F
# DR Field
DR_2_5_SPS = 0x00
DR_5_SPS = 0x01
DR_10_SPS = 0x02
DR_16_6_SPS = 0x03
DR_20_SPS = 0x04
DR_50_SPS = 0x05
DR_60_SPS = 0x06
DR_100_SPS = 0x07
DR_400_SPS = 0x08
DR_1200_SPS = 0x09
DR_2400_SPS = 0x0A
DR_4800_SPS = 0x0B
DR_7200_SPS = 0x0C
DR_14400_SPS = 0x0D
DR_19200_SPS = 0x0E
DR_38400_SPS = 0x0F
# INPMUX Register Fields */
# MUXP_3 = 0x80
# MUXP_2 = 0x40
# MUXP_1 = 0x20
# MUXP_0 = 0x10
MUXP_MASK = 0xF0
# MUXP Field
MUXP_AIN0 = 0x00
MUXP_AIN1 = 0x10
MUXP_AIN2 = 0x20
MUXP_AIN3 = 0x30
MUXP_AIN4 = 0x40
MUXP_AIN5 = 0x50
MUXP_AIN6 = 0x60
MUXP_AIN7 = 0x70
MUXP_AIN8 = 0x80
MUXP_AIN9 = 0x90
MUXP_AINCOM = 0xA0
MUXP_TEMP = 0xB0
MUXP_AVDD = 0xC0
MUXP_DVDD = 0xD0
MUXP_TEST = 0xE0
MUXP_NO_CONN = 0xF0
# MUXN_3 = 0x08
# MUXN_2 = 0x04
# MUXN_1 = 0x02
# MUXN_0 = 0x01
MUXN_MASK = 0x0F
# MUXN Field
MUXN_AIN0 = 0x00
MUXN_AIN1 = 0x01
MUXN_AIN2 = 0x02
MUXN_AIN3 = 0x03
MUXN_AIN4 = 0x04
MUXN_AIN5 = 0x05
MUXN_AIN6 = 0x06
MUXN_AIN7 = 0x07
MUXN_AIN8 = 0x08
MUXN_AIN9 = 0x09
MUXN_AINCOM = 0x0A
MUXN_TEMP = 0x0B
MUXN_AVSS = 0x0C
MUXN_DVDD = 0x0D
MUXN_TEST = 0x0E
MUXN_NO_CONN = 0x0F
# SKIP OFFSET & GAIN CAL REGISTERS
# IDACMUX Register Fields */
# MUX2_3 = 0x80
# MUX2_2 = 0x40
# MUX2_1 = 0x20
# MUX2_0 = 0x10
MUX2_MASK = 0xF0
# MUX2 Field
MUX2_AIN0 = 0x00
MUX2_AIN1 = 0x10
MUX2_AIN2 = 0x20
MUX2_AIN3 = 0x30
MUX2_AIN4 = 0x40
MUX2_AIN5 = 0x50
MUX2_AIN6 = 0x60
MUX2_AIN7 = 0x70
MUX2_AIN8 = 0x80
MUX2_AIN9 = 0x90
MUX2_AINCOM = 0xA0
MUX2_NO_CONM = 0xB0
# MUX1_3 = 0x08
# MUX1_2 = 0x04
# MUX1_1 = 0x02
# MUX1_0 = 0x01
MUX1_MASK = 0x0F
# MUX1 Field
MUX1_AIN0 = 0x00
MUX1_AIN1 = 0x01
MUX1_AIN2 = 0x02
MUX1_AIN3 = 0x03
MUX1_AIN4 = 0x04
MUX1_AIN5 = 0x05
MUX1_AIN6 = 0x06
MUX1_AIN7 = 0x07
MUX1_AIN8 = 0x08
MUX1_AIN9 = 0x09
MUX1_AINCOM = 0x0A
MUX1_NO_CONM = 0x0B
# IDACMAG Register Fields */
# MAG2_3 = 0x80
# MAG2_2 = 0x40
# MAG2_1 = 0x20
# MAG2_0 = 0x10
MAG2_MASK = 0xF0
# MAG2 Field
MAG2_OFF = 0x00
MAG2_50uA = 0x10
MAG2_100uA = 0x20
MAG2_250uA = 0x30
MAG2_500uA = 0x40
MAG2_750uA = 0x50
MAG2_1000uA = 0x60
MAG2_1500uA = 0x70
MAG2_2000uA = 0x80
MAG2_2500uA = 0x90
MAG2_3000uA = 0xA0
# MAG1_3 = 0x08
# MAG1_2 = 0x04
# MAG1_1 = 0x02
# MAG1_0 = 0x01
MAG1_MASK = 0xF0
# MAG1 Field
MAG1_OFF = 0x00
MAG1_50uA = 0x01
MAG1_100uA = 0x02
MAG1_250uA = 0x03
MAG1_500uA = 0x04
MAG1_750uA = 0x05
MAG1_1000uA = 0x06
MAG1_1500uA = 0x07
MAG1_2000uA = 0x08
MAG1_2500uA = 0x09
MAG1_3000uA = 0x0A
# REFMUX Register Fields */
# RMUXP_2 = 0x20
# RMUXP_1 = 0x10
# RMUXP_0 = 0x08
RMUXP_MASK = 0x38
# MUXP Field
RMUXP_INTP = 0x00
RMUXP_AIN0 = 0x08
RMUXP_AIN2 = 0x10
RMUXP_AIN4 = 0x18
RMUXP_AVDD = 0x20
# RMUXN_2 = 0x04
# RMUXN_1 = 0x02
# RMUXN_0 = 0x01
RMUXN_MASK = 0x07
# MUXN Field
RMUXN_INTN = 0x00
RMUXN_AIN1 = 0x01
RMUXN_AIN3 = 0x02
RMUXN_AIN5 = 0x03
RMUXN_AVSS = 0x04
# TDACP Register Fields */
OUTP = 0x80
# OUTP Field
OUTP_NO_CONN = 0x00
OUTP_AIN6 = 0x80
# MAGP4 = 0x10
# MAGP3 = 0x08
# MAGP2 = 0x04
# MAGP1 = 0x02
# MAGP0 = 0x01
MAGP_MASK = 0x1F
# MAGP Field
MAGP_0_9_AVDD = 0x09
MAGP_0_7_AVDD = 0x08
MAGP_0_6_AVDD = 0x07
MAGP_0_55_AVDD = 0x06
MAGP_0_525_AVDD = 0x05
MAGP_0_5125_AVDD = 0x04
MAGP_0_50625_AVDD = 0x03
MAGP_0_503125_AVDD = 0x02
MAGP_0_5015625_AVDD = 0x01
MAGP_0_5_AVDD = 0x00
MAGP_0_4984375_AVDD = 0x11
MAGP_0_496875_AVDD = 0x12
MAGP_0_49375_AVDD = 0x13
MAGP_0_4875_AVDD = 0x14
MAGP_0_475_AVDD = 0x15
MAGP_0_45_AVDD = 0x16
MAGP_0_4_AVDD = 0x17
MAGP_0_3_AVDD = 0x18
MAGP_0_1_AVDD = 0x19
# DACN Register Fields */
OUTN = 0x80
# OUTN Field
OUTN_NO_CONN = 0x00
OUTN_AIN7 = 0x80
# MAGN4 = 0x10
# MAGN3 = 0x08
# MAGN2 = 0x04
# MAGN1 = 0x02
# MAGN0 = 0x01
MAGN_MASK = 0x1F
# MAGN Field
MAGN_0_9_AVSS = 0x09
MAGN_0_7_AVSS = 0x08
MAGN_0_6_AVSS = 0x07
MAGN_0_55_AVSS = 0x06
MAGN_0_525_AVSS = 0x05
MAGN_0_5125_AVSS = 0x04
MAGN_0_50625_AVSS = 0x03
MAGN_0_503125_AVSS = 0x02
MAGN_0_5015625_AVSS = 0x01
MAGN_0_5_AVSS = 0x00
MAGN_0_4984375_AVSS = 0x11
MAGN_0_496875_AVSS = 0x12
MAGN_0_49375_AVSS = 0x13
MAGN_0_4875_AVSS = 0x14
MAGN_0_475_AVSS = 0x15
MAGN_0_45_AVSS = 0x16
MAGN_0_4_AVSS = 0x17
MAGN_0_3_AVSS = 0x18
MAGN_0_1_AVSS = 0x19
# GPIOCON Register Fields */
CON7_AINCOM = 0x80
CON6_AIN09 = 0x40
CON5_AIN08 = 0x20
CON4_AIN07 = 0x10
CON3_AIN06 = 0x08
CON2_AIN05 = 0x04
CON1_AIN04 = 0x02
CON0_AIN03 = 0x01
# GPIODIR Register Fields */
DIR7_AINCOM = 0x80
DIR6_AIN09 = 0x40
DIR5_AIN08 = 0x20
DIR4_AIN07 = 0x10
DIR3_AIN06 = 0x08
DIR2_AIN05 = 0x04
DIR1_AIN04 = 0x02
DIR0_AIN03 = 0x01
# GPIODAT Register Fields */
DAT7_AINCOM = 0x80
DAT6_AIN09 = 0x40
DAT5_AIN08 = 0x20
DAT4_AIN07 = 0x10
DAT3_AIN06 = 0x08
DAT2_AIN05 = 0x04
DAT1_AIN04 = 0x02
DAT0_AIN03 = 0x01
# Additional ADS1263 Registers */
# ADC2CFG Register Fields */
# DR2_1 = 0x80
# DR2_0 = 0x40
DR2_MASK = 0xC0
# DR_2 Field
DR2_10SPS = 0x00
DR2_100SPS = 0x40
DR2_400SPS = 0x80
DR2_800SPS = 0xC0
# REF2_2 = 0x20
# REF2_1 = 0x10
# REF2_0 = 0x08
REF2_MASK = 0x38
# REF2 Field
REF2_INTP_INTN = 0x00
REF2_AIN0_AIN1 = 0x08
REF2_AIN2_AIN3 = 0x10
REF2_AIN4_AIN5 = 0x18
REF2_AVDD_AVSS = 0x38
# GAIN2_2 = 0x04
# GAIN2_1 = 0x02
# GAIN2_0 = 0x01
GAIN2_MASK = 0x07
# GAIN2 Field
GAIN2_1 = 0x00
GAIN2_2 = 0x01
GAIN2_4 = 0x02
GAIN2_8 = 0x03
GAIN2_16 = 0x04
GAIN2_32 = 0x05
GAIN2_64 = 0x06
GAIN2_128 = 0x07
# DC2MUX Register Fields */
# MUXP2_3 = 0x80
# MUXP2_2 = 0x40
# MUXP2_1 = 0x20
# MUXP2_0 = 0x10
MUXP2_MASK = 0xF0
# MUXP2 Field
MUXP2_AIN0 = 0x00
MUXP2_AIN1 = 0x10
MUXP2_AIN2 = 0x20
MUXP2_AIN3 = 0x30
MUXP2_AIN4 = 0x40
MUXP2_AIN5 = 0x50
MUXP2_AIN6 = 0x60
MUXP2_AIN7 = 0x70
MUXP2_AIN8 = 0x80
MUXP2_AIN9 = 0x90
MUXP2_AINCOM = 0xA0
MUXP2_TEMP = 0xB0
MUXP2_AVDD = 0xC0
MUXP2_DVDD = 0xD0
MUXP2_TEST = 0xE0
MUXP2_NO_CONN = 0xF0
# MUXN2_3 = 0x08
# MUXN2_2 = 0x04
# MUXN2_1 = 0x02
# MUXN2_0 = 0x01
MUXN2_MASK = 0x0F
# MUXN2 Field
MUXN2_AIN0 = 0x00
MUXN2_AIN1 = 0x01
MUXN2_AIN2 = 0x02
MUXN2_AIN3 = 0x03
MUXN2_AIN4 = 0x04
MUXN2_AIN5 = 0x05
MUXN2_AIN6 = 0x06
MUXN2_AIN7 = 0x07
MUXN2_AIN8 = 0x08
MUXN2_AIN9 = 0x09
MUXN2_AINCOM = 0x0A
MUXN2_TEMP = 0x0B
MUXN2_AVSS = 0x0C
MUXN2_DVDD = 0x0D
MUXN2_TEST = 0x0E
MUXN2_NO_CONN = 0x0F