I am currently trying to access a temperature sensor via I2C. The problem is whenever I want to send data I get the error message: “Bad address”, but the BBB doesn’t even check for the address on the I2C bus. The address is 0x48 so it is free for use.
I want to use the Pins P9,17 and P9,18. The BBB is running Angstrom. I am using C++ and i2c-dev.h to access the built in i2c-1 device file.
I hope someone has some ideas how to solve this.
Do you have a pullup on the i2c line?
After some further testing I can clarify the behavior of the I2C-bus:
When I manually access the I2C-dev nothing happens, SDA and SCL keep 3.3V the whole time.
When I use the command “i2cdetect -y -r 1” the SCL gets the typical clock-look with about 4us high and low, except for its not going between 3.3V and 0V, but 3.3V and 2.8V. SDA on the other hand also periodically keeps 3.3V for 2.5ms, then stays 0V for 1s.
All this behavior is unaffected, if I put additional external pullup resistors or not.
Has anyone any idea whats going wrong?
I don’t understand what happened, but today the behavior changed again, “i2cdetect -y -r 1” working as it is supposed to and my program doing nothing at all. Maybe I got something wired wrong yesterday? But I don’t really care right now, since I also found a bug in my code (damm pointers) and now everything is working fine.
I am having problems with i2c read write too. The code only seems to pick up odd values for some reason. I am a newbie to this domain in general and would appreciate any assistance. Can you share the read instance of your code or help me find fault in mine?
opResult = read(i2cFD, (char*)rxBuffer, 6);
printf(“Part ID rx0: %x, %x\n”, (int)rxBuffer, 0x00);
printf(“Part ID rx1: %x, %x\n”, (int)rxBuffer, 0x01);
printf(“Part ID rx2: %x, %x\n”, (int)rxBuffer, 0x02);
printf(“Part ID rx3: %x, %x\n”, (int)rxBuffer, 0x03);
printf(“Part ID rx4: %x, %x\n”, (int)rxBuffer, 0x04);
printf(“Part ID rx5: %x, %x\n”, (int)rxBuffer, 0x05);