0

Have a nice day. I have a pca9685 controller. When I try to read and write I get the error errno 6.

root@orangepipc:~/wiringOP# i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: 70 -- -- -- -- -- -- --
root@orangepipc:~/wiringOP# i2cdump -y 0 40
No size specified (using byte-data access)
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
10: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
20: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
30: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
40: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
50: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
60: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
70: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
80: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
90: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
a0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
b0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
c0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
d0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
e0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
f0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX

my code

#include <iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <cstdlib>
#include <unistd.h>
#include <pthread.h>
#include <wiringPi.h>
#include <wiringPiI2C.h>
#include <errno.h>

using namespace std;

int main()
{
  string addr = "/dev/i2c-0";
  int fd = wiringPiI2CSetupInterface(addr.c_str(), 40);
  if (fd < 0)
    printf("wiringPiI2CSetupInterface errno %d\n", errno);

  int wr8 = wiringPiI2CWriteReg8(fd, 0x00, 0x00);
  if (wr8 < 0)
    printf("wiringPiI2CWriteReg8 errno %d\n", errno);

  int wr16 = wiringPiI2CWriteReg16(fd, 0x00, 0x00);
  if (wr16 < 0)
    printf("wiringPiI2CWriteReg16 errno %d\n", errno);

  int r8 = wiringPiI2CReadReg8(fd, 0x00);
  if (r8 < 0)
    printf("wiringPiI2CReadReg8 errno %d\n", errno);

  int r16 = wiringPiI2CReadReg16(fd, 0x00);
  if (r16 < 0)
    printf("wiringPiI2CReadReg16 errno %d\n", errno);

  close(fd);
}

console output wiringPiI2CWriteReg8 errno 6 wiringPiI2CWriteReg16 errno 6 wiringPiI2CReadReg8 errno 6 wiringPiI2CReadReg16 errno 6

I also have a gy521 which behaves exactly the same. Can this behavior signal a microcomputer i2c bus failure?

Can determining the address of the connected controller ensure that the microcomputer's i2c bus is working properly?

Maybe I'm doing something wrong?

I could not find information about errno 6, please help.

I thought that I did not install the wiringpi correctly, reinstalled several times, different versions.

Tom V
  • 4,827
  • 2
  • 5
  • 22

0 Answers0