Strictly necessary cookies are on by default and cannot be turned off. Functional, Performance and Tracking/targeting/sharing cookies can be turned on below based on your preferences (this banner will remain available for you to accept cookies). You may change your cookie settings by deleting cookies from your browser. Then this banner will appear again. You can learn more details about cookies HERE.
Strictly necessary (always on)
Functional, Performance and Tracking/targeting/sharing (default off)
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?
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.
There are two ways of stating an I2C address: with or without the R/W bit. The former is 8 bit, the latter is 7 bit long. You need to look up the data sheets of both the I2C device you are using, and the I2C library, which format they want to use.
In the code above, slaveAddress is a 7-bit-address, whereas the library / MCU wants a 8-bit-adress, so the address is moved one bit to the left.
Since the (UDB) I2C master in the PSoC want to use a 7-bit-address, you don't need the bitshift.