https://github.com/lab5e/nrf9160_i2c_example
Demonstrating direct I2C access for scanning I2C bus + Chipcap 2 driver example
https://github.com/lab5e/nrf9160_i2c_example
firmware i2c lang-zephyr nordic-connect nrf91 sample zephyr
Last synced: 10 months ago
JSON representation
Demonstrating direct I2C access for scanning I2C bus + Chipcap 2 driver example
- Host: GitHub
- URL: https://github.com/lab5e/nrf9160_i2c_example
- Owner: lab5e
- Created: 2023-12-15T16:35:43.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-19T10:53:49.000Z (over 2 years ago)
- Last Synced: 2025-02-28T22:39:00.046Z (over 1 year ago)
- Topics: firmware, i2c, lang-zephyr, nordic-connect, nrf91, sample, zephyr
- Language: C
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# nrf9160 Direct Access I2C example code.
This code demonstrates:
* I2C scanner (more or less ripped ad verbatim from the internet)
* Low level Chipcap2 I2C communication (from [Air Quality Sensor Node](https://github.com/lab5e/air-quality-sensor-node)
)
## Note:
* If you want to use i2c0,1,3, and the driver doesn't load, it is a good idea to check the various I2C nodes in the compiled dts (build/zephyr/zephyr.dts). They will either be marked as "okay" or "disabled".
* The code is tested on nRF9160DK using nRF Connect SDK v.2.5.0 (SCL: 31, SDA:30).
* The example code is using i2c2, since this is enabled by default.
* [Chipcap2 application guide](https://www.cdiweb.com/datasheets/telaire-amphenol/chipcap2applicationnote.pdf)
* Don't forget to add pullup resistors between the SDA/SCL and VDD (4.7k-10k).
# Example output
## I2C Scanner
```
*** Booting nRF Connect SDK v2.5.0 ***
The I2C scanner started
Value of NRF_TWIM2->PSEL.SCL : -1
Value of NRF_TWIM2->PSEL.SDA : -1
Value of NRF_TWIM2->FREQUENCY: 67108864
26738688 -> 100k
I2C device found at address 0x28
```
## Chipcap2
```
*** Booting nRF Connect SDK v2.5.0 ***
Sample : 0
Temp: 25.8
RH: 34
Sample : 1
Temp: 25.8
RH: 34
Sample : 2
Temp: 25.8
RH: 35
```