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:
Just realized that I forgot to enable the interrupt in the NVIC. After adding: NVIC_EnableIRQ((IRQn_Type) I2CM_SCB_IRQ_cfg.intrSrc); everything works as expected.