3 Replies Latest reply on Jul 21, 2015 1:42 AM by user_1377889

    PSoC4: EzI2C Slave with master Raspberry Pi

    user_350540870

      I am working on I2C communication between Raspberry Pi as master and PSoC4 as slave. To set PSoC4 as I2C slave, I am programming it with EZI2C Slave (SCB v3.0) component using Creator 3.2. I went through the following piece of while studying the datasheet of the component:

         

      #define BUFFER_SIZE (0x0Au)
      #define BUFFER_RW_BOUNDARY (0x04u)
      uint8 ezi2cBuffer[BUFFER_SIZE];
      SCB_EzI2CSetBuffer1(BUFFER_SIZE, BUFFER_RW_BOUNDARY, ezi2cBuffer);

         

       

         

      What I could understand from the datasheet and this piece of code is that this SCB_ExI2CSetBuffer1() API sets the "ezi2cBuffer" as the buffer to which Master I2C device writes data and from which Master I2C device reads data. If I understood in this way, then I am afraid that I will get so much confused about how to set the same buffer for simultaneous read and write operations from master.

         

      For example, I write a value "0x0000" from master Pi to slave PSoC. The slave PSoC gets this value as a command to send a string "OK" back to the master. On the reading from slave, the master gets the string "OK".  If I want to execute this, I have to define separately a read buffer and a write buffer, but it is not possible as this SCB_ExI2CSetBuffer1() API only declares a single buffer for both.

         

      Any help in understanding this and developing the comminucation would be highly appreciated.

         

       

         

      Regards

         

      Shaunak