OldBikerPete Posted November 9, 2017 Share Posted November 9, 2017 I've installed this library on an Orange Pi PC Plus running 'Armbian 5.31 stable Ubuntu 16.04.3 LTS 3.4.113-sun8i' with all updates and I would like to use wiringPiI2C but it doesn't work with either /dev/i2c-0 or /dev/i2c-1. My USB storage CRO device shows no output at all when I attempt a write to an I2C device on connector pins 3 and 5 (BCM pins 2 & 3). the 'gpio' app and 'blink' example apps that come with the library wiggles these and other pins as outputs, no trouble at all. I'm porting a library that interfaces to a DS3232 or DS3231 real-time-clock chip from Arduino and have used the initialisation sequence from the example in the WiringOP library as below. static int sfd; void DS323xRTC(bool *retVal) { wiringPiSetup(); if((sfd = wiringPiI2CSetupInterface("/dev/i2c-1", DS323x_I2C_ID)) < 0) { *retVal = false return; } // Control reg All disabled, EOSC low = oscillator enabled. wiringPiWriteReg8(sfd, CONTROL_REG, 0x00); wiringPiWrite(sfd, 0x08); // Status/Control reg, Enable 32kHz output *retVal = true; } I note that the I2C examples that come with this library drive an I2C device via software bit-bashing. Has anybody been able to use from C++ the I2C interface built into the H3 chip? If so, how did you get it working? Peter. Link to comment Share on other sites More sharing options...
Igor Posted November 10, 2017 Share Posted November 10, 2017 Can you check/see I2C devices with i2cdetect? Link to comment Share on other sites More sharing options...
OldBikerPete Posted December 13, 2017 Author Share Posted December 13, 2017 Sorry about the long delay. I've had issues! Installed I2C-tools and ran i2cdetect on an Orange Pi PC plus and an Orange Pi Zero - both running the same Armbian distro. The results are below. /dev/i2c-0 detected a non-existent (as far as I know) device at 0x48 and the /dev/i2c-1 device detected nothing at all. In the interval since my first post on this subject, I wrote a bit-bashing library for the I2C bus on connector pins 3 and 5 and this works a treat with a DS3231 clock chip located at address 0x68 on the I2C bus on both CPUs using the gpio pin part of the WiringOP library to access the bits and a microsecond delay routine. Note that i2cdetect did not find my clock chip on the bus. root@orangepizero:~# i2cdetect 0 WARNING! This program can confuse your I2C bus, cause data loss and worse! I will probe file /dev/i2c-0. I will probe address range 0x03-0x77. Continue? [Y/n] y 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- root@orangepizero:~# i2cdetect 1 WARNING! This program can confuse your I2C bus, cause data loss and worse! I will probe file /dev/i2c-1. I will probe address range 0x03-0x77. Continue? [Y/n] y 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- Peter. Note that I'm investigating a message that flashes by at boot-up on the debug serial port. 'FAILURE: Linux Kernel modules failed to load' Link to comment Share on other sites More sharing options...
Recommended Posts