1 Reply Latest reply on Jun 6, 2019 1:37 AM by DaMa_3386091

    Problem using high level I2C API


      Hi everyone,


      I'm attempting to implement a I2C communication between a PSoC 6 (CY8CPROTO-BLE), which acts as a master, and a PSoC 5LP (CY8CKIT-059), which acts as a slave.

      The slave part is fully working, since I tested it with the Bridge Control Panel. On the master side, I'm struggling to make the high level API functions work correctly.


      Right now the firmware of my master device sends 2 bytes per write transaction: the first byte is always 0, the second bytes goes from 0 to 255, then from 254 to 0, and so on every 10 ms. If I use the high level function Cy_SCB_I2C_MasterWrite and then I check the Master Status I always get CY_SCB_I2C_MASTER_BUSY. I also implemented a 1 second timeout if this occurs, and after this time elapsed I disable and enable again the SCB block, but the next transaction always results in a CY_SCB_I2C_MASTER_BUSY flag.


      If, instead, I use the low level functions (Cy_SCB_I2C_MasterSendStart, Cy_SCB_I2C_MasterWriteByte, Cy_SCB_I2C_MasterSendStop) everything is working properly. What could be the cause of this behaviour?


      I attach here my workspace, where you can find 3 commented projects:

      • Slave (the project for the slave device, running on a PSoC 5LP)
      • Master_PSoC_2 (the project for the master device, running on a PSoC 6)
      • CE220818 (the code example from which I took inspiration for the PSoC 6 master code)


      Thank you!