Re: How to I2C in RPi3B+ (also gpioiic) ?
[email protected] (Michael van Elst)
| Newsgroups | gmane.os.netbsd.ports.arm |
|---|---|
| Organization | Serpens User Group |
| Message-ID | <[email protected]> |
[email protected] ("Dr. Nicola Mingotti") writes: >1. Is anybody able to get some form of I2C to work ? yes. http://cdn.netbsd.org/pub/NetBSD/misc/mlelstv/antipasti2.jpg shows an RPI0W driving two I2C devices, a CO2 sensor from Sensirion and an OLED display. http://cdn.netbsd.org/pub/NetBSD/misc/mlelstv/scd30.tgz has the C source of the program running. >2. Does it exist a command similar to i2cget in NetBSD to query > ÃÂ ÃÂ directly a device via shell ? Otherwise, is there a code > ÃÂ ÃÂ snipped around I can start from to get the same thing in C ? There is no such command in base. man 4 iic shows the device ioctls that are used to send or receive data. The standard DTB has 3 I2C controllers enabled, but only one (i2c@7e804000) is supposed to be used and configured on GPIO. When all 3 I2C controllers are enabled that "good" controller should be /dev/iic2. >3. using gpioiic the widget was recognized and it seems > ÃÂ ÃÂ the device dsrtc0 was created (I guess a driver was found) but >.. Where is it ? I don't see it in /dev/ >.. How do I use that device dsrtc0 ? That device has no interface to userland, the driver attaches to the todr(9) routines to provide a time-of-day clock to the kernel. You can read it with gettimeofday() or set it with settimeofday().