1

I'm working on a project where I need to use GPIO to toggle pins high and low as well as gather sensor data from an I2C peripheral. I have each component working separately, GPIO using wiringPi and I2C using open() and ioctl(). Separately they work great. When I run them together, the I2C bus gets in a state where i2cdetect shows all possible address values, and I can't communicate with the I2C device again until I reboot. Has anyone seen this before or does anyone know what I can do to fix this? I've tried only using wiringPi as well, and it breaks using both GPIO and I2C at the same time.

  • I've made your title more specific since I would presume this is an issue with wiringPi -- using the linux I2C interface (which is ioctl() based) and GPIOs via sysfs is not a problem. It does sound odd that you say wiringPi screws up I2C when used alone; doesn't it have it's own I2C interface? Probably you should include an SSCCE here if you want serious attention. – goldilocks Aug 9 '16 at 14:28
1

Alright, I'm an idiot. I accidentally had my button pin set to the pin used for I2C communication, and when I set it up as an input, it crashed I2C. I changed the pin assignment to the correct pin and I2C doesn't crash anymore, all works as expected. If anyone else is having this problem, double check your pin assignments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.