Problem porting working I2C from PSoC4 to 5LP | Cypress Semiconductor
Problem porting working I2C from PSoC4 to 5LP
I am having a problem converting code that runs on a PSOC4 to PSOC5LP. The code is a used to drive an I2C 128x64 OLED using the great work done by Derk Steggewentz. He took the time to port over the Adafruit graphic code to work on PSoC4.
The code works very well using the CY8CKIT-049 4200 Prototyping Kit. The exact code is located at: github.com/derkst/Cypress-PSOC-OLED. On the converted code for the PSoC5LP. I get random pixels.
Here are the steps I used to move the code to the 5LP on a CY8CKIT-059 PSoC 5LP Prototyping Kit:
1. Start with working project directly from "github.com/derkst/Cypress-PSOC-OLED". It works right out of the box on the 049 kit.
2. Recompile with the new device: CY8C5868LTI-LP039, (I am using the PROG KIT portion of the 059 kit).
3. The PSoC4 I2C SCB component is not supported on the 5LP device, so I delete the I2C component and drag in a I2C UDB that is compatible with the 5LP.
4. Assign pins to 12.2 and 12.4 (Doesn't seem to matter what pins I use).
5. When I compile the code, there are a few errors as per the attached screen shot. Maybe this is the issue, but I remove the “I2C” prefix from the values that are highlighted and I get a clean compile.
6. After I recompile, I try to run the code and I get random pixels on the display. This means I wired it correct and the I2C address is correct, but the data is getting garbled.
7. I connected a Logic analyzer and see a difference in the starting Write frame - see attached screen shots. In the working frame, the first byte is '0x00'. On the upgraded code, the byte is '0x80'. I tried going through the I2C code, but can’t make out what needs to change to get the correct values.
Hoping that someone more experienced with I2C UDB can point out my mistake. By the way, I tried a Fixed Function block and got the same results.
Thanks in advance for any insight.