Is this a bug in the i2c code?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I spent better part of 4 hours trying to figure out why I couldn't communicate with my OLED lcd.  Worked fine on atmel, could see it under BusPirate but with a basic setup on the POSC it kept getting NACK's and freezing on MasterSendStop.  THEN I found out it was sending the wrong address?

I finally came across this line here:

I2C_1_DATA_REG = (uint8) (slaveAddress << I2C_1_SLAVE_ADDR_SHIFT);

Why is it shifting left the address?  I went ahead and change my address to shift left first and now everything is peachy.  Could there be an option in the component to turn this off and just check if the address is even?

PS - For the record I know the LSB is the read/write bit, but  I have yet to come across a device that is pre sifted liike that.

0 Likes
1 Reply