CSS811 Eagle - debugging
=====
# Setup
## I2C
1. 50KHz clock
2. SERCOM3 PA16 - SDA / PA17 - SCK
3. With and without `scl_stretch_only_after_ack_bit` (no difference).
4. Tried to change many other settings like `start_hold_time`, `scl_low_timeout`, `slave_scl_low_extend_timeout`, `sda_scl_rise_time_ns`.
## App
1. Probe the sensor asking about its ID.
2. Configure CSS811 to prepare a sample every second.
3. Sample in a loop (with 1s delay).
# DUT #66 - Fail
### Probing
```
TRACE : I2C master com - enabled
TRACE : --------------------------------------- PROBING
DEBUG : I2C [0x5B] Write (0) 20
DEBUG : I2C [0x5B] Read (0) 81
DEBUG : I2C [0x5B] Write (0) 00
DEBUG : I2C [0x5B] Read (0) 10
DEBUG : I2C [0x5B] Write (0) F4
DEBUG : I2C [0x5B] Write (18) 00
ERROR : [0x5B] CCS811 sensor init - Failed with error 8
DEBUG : I2C [0x5B] Write (18) 20
ERROR : [0x5B] CCS811 sensor init - Failed with error 8
DEBUG : I2C [0x5B] Write (18) 20
ERROR : [0x5B] CCS811 sensor init - Failed with error 8
DEBUG : I2C [0x5B] Write (18) 20
ERROR : [0x5B] CCS811 sensor init - Failed with error 8
DEBUG : I2C [0x5B] Write (18) 20
ERROR : [0x5B] CCS811 sensor init - Failed with error 8
DEBUG : I2C [0x5B] Write (18) 20
```

### Sampling
- NO I2C activity.
### Conclusion
- Error 8 = I2C Error
- Failed for some reason while probing.
- WTF is wrong with that clock? 1.8V high, but the shape ...
# DUT #03 - Fail
### Probing
```
TRACE : --------------------------------------- PROBING
DEBUG : I2C [0x5B] Write (0) 20
DEBUG : I2C [0x5B] Read (0) 81
DEBUG : I2C [0x5B] Write (0) 00
DEBUG : I2C [0x5B] Read (0) 10
DEBUG : I2C [0x5B] Write (0) F4
DEBUG : I2C [0x5B] Write (0) 00
DEBUG : I2C [0x5B] Read (0) 90
DEBUG : I2C [0x5B] Write (0) 01 10
TRACE : [0x5B] CCS811 sensor init - OK
```

### Sampling
```
TRACE : --------------------------------------- SAMPLING
DEBUG : I2C [0x5B] Write (0) 02
DEBUG : I2C [0x5B] Read (0) FD FD FD FD FD FD FD FD
ERROR : [0x5B] CCS811: Failed to read, error 5
INFO : [0x5B] CCS811: eCO2 65021 ppm
INFO : [0x5B] CCS811: tVOC 65021 ppb
DEBUG : [0x5B] CCS811: STATUS 0xFD
DEBUG : [0x5B] CCS811: ERROR_ID 0xFD
DEBUG : [0x5B] CCS811: RAW DATA 0xFDFD
```

### Conclusion
- Error 5 = Has legit errors, received from CSS811 status register (ref datasheet).
- Probing went well.
- 2.7V clock High level, good shape.
- Sampling junk 0xFD data.
# DUT #05 - Pass
### Probing
```
TRACE : --------------------------------------- PROBING
DEBUG : I2C [0x5B] Write (0) 20
DEBUG : I2C [0x5B] Read (0) 81
DEBUG : I2C [0x5B] Write (0) 00
DEBUG : I2C [0x5B] Read (0) 10
DEBUG : I2C [0x5B] Write (0) F4
DEBUG : I2C [0x5B] Write (0) 00
DEBUG : I2C [0x5B] Read (0) 90
DEBUG : I2C [0x5B] Write (0) 01 10
TRACE : [0x5B] CCS811 sensor init - OK
```

### Sampling
```
TRACE : --------------------------------------- SAMPLING
DEBUG : I2C [0x5B] Write (0) 02
DEBUG : I2C [0x5B] Read (0) 02 1B 00 15 98 00 35 8B
INFO : [0x5B] CCS811: Got sensor readings
INFO : [0x5B] CCS811: eCO2 539 ppm
INFO : [0x5B] CCS811: tVOC 21 ppb
DEBUG : [0x5B] CCS811: STATUS 0x98
DEBUG : [0x5B] CCS811: ERROR_ID 0x00
DEBUG : [0x5B] CCS811: RAW DATA 0x358B
```

### Conclusion
- 3.3V clock High level, good shape.
- There are some 1.1V spikes on SDA (not sure if normal or not).
- Consistent over 10 min of sampling.
# DUT #05 - Fail
### Probing
```
TRACE : --------------------------------------- PROBING
DEBUG : I2C [0x5B] Write (0) 20
DEBUG : I2C [0x5B] Read (0) 81
DEBUG : I2C [0x5B] Write (0) 00
DEBUG : I2C [0x5B] Read (0) 10
DEBUG : I2C [0x5B] Write (0) F4
DEBUG : I2C [0x5B] Write (18) 00
ERROR : [0x5B] CCS811 sensor init - Failed with error 8
DEBUG : I2C [0x5B] Write (18) 20
ERROR : [0x5B] CCS811 sensor init - Failed with error 8
DEBUG : I2C [0x5B] Write (18) 20
ERROR : [0x5B] CCS811 sensor init - Failed with error 8
DEBUG : I2C [0x5B] Write (18) 20
ERROR : [0x5B] CCS811 sensor init - Failed with error 8
DEBUG : I2C [0x5B] Write (18) 20
ERROR : [0x5B] CCS811 sensor init - Failed with error 8
```

### Sampling
- NO I2C activity. (similar to DUT #66)
### Conclusion
- SCL pin header dropped - so I resoldered it, I checked for shorts - there are none.
- SCL High level dropped from initial test (i.e. 3.3V) to 2.68V.
# DUT without RAK module - Fail
- Using the new RAK Eval board (from Electrovic) to hook up to the headless PCB.
- I2C scanning - finds no address.
```
3255 - TRACE : I2C master com - enabled
3264 - DEBUG : I2C [0x70] Write (24) 35 17
3272 - INFO : CCS811_WAKE: LOW
3277 - INFO : CCS811_RESET: HIGH
3282 - INFO : PIR_INPUT: LOW
8259 - INFO : -------------
8263 - INFO : CCS811_WAKE: LOW
8268 - INFO : CCS811_RESET: HIGH
8273 - INFO : PIR_INPUT: LOW
13250 - INFO : -------------
13254 - INFO : CCS811_WAKE: LOW
13259 - INFO : CCS811_RESET: HIGH
13264 - INFO : PIR_INPUT: LOW
18241 - INFO : -------------
18246 - INFO : CCS811_WAKE: LOW
18251 - INFO : CCS811_RESET: HIGH
18255 - INFO : PIR_INPUT: LOW
```

### Conclusion
- The PCB has 3v3 power and the pinut seems fine, however I2C wires are 30cm long.
- Error 8 = I2C Error, maybe a pinout or wire length issue.
- Will try again tomorrow, with shorter wires.