5 Replies Latest reply on Oct 3, 2019 12:12 PM by OtGo_1311741

    PSoC4 I2C

    SaGh_4441651

      I need to configure to use 1 I2C both as master and slave. At first the I2C is configured as master and then once the master is done sending data, it is configured as slave. I am thinking of using a SCB block and then switching between the configuration. Is it possible to do so?

        • 1. Re: PSoC4 I2C
          OtGo_1311741

          Hi,

           

          One question, why do you want to change the I2c from master to slave?

           

          Normally, the I2C block inside a microcontroller is configured as a master and any other external device (eeprom, adc, etc.) is treated as slave.  If you want to share communication between two or more microcontrollers having other devices too, you can configure the microcontroller's I2C as multmaster.

          • 2. Re: PSoC4 I2C
            SaGh_4441651

            Why do you want to change the I2c from master to slave - That is how the application is designed (for reasons I cannot mention)

             

            How is having multi master going to help in this situation? I need to write data to a device (acting as master) and then wait for the other device to send me data(now acting as slave)

            • 3. Re: PSoC4 I2C
              OtGo_1311741

              Hi, there is no need to post the specific application of your circuit.  But for example, I use a microcontroller as master and a I2C eeprom as slave.  The master sends commands to the eeprom and if it is a command that requires a response, the eeprom will send the response and the master will receive it without changing to slave.

               

              In other words, master starts communication and depending on the command used, it will wait a response from the slave.

               

              I suggest you to check the examples available in Cypress website.

               

              Good luck.

              • 4. Re: PSoC4 I2C
                SaGh_4441651

                I understand your explanation. But as of now I still want my I2C to switch between master and slave. Is it possible with SCB?

                • 5. Re: PSoC4 I2C
                  OtGo_1311741

                  Yes, if you use the unconfigured SCB.  The function SCB_I2CInit(SCB_I2C_INIT_STRUCT *config) lets you to change the mode of operation.  See page 28 of the datasheet of the SCB component.

                  1 of 1 people found this helpful