cancel
Showing results for 
Search instead for 
Did you mean: 

Resource Library

Software I2C Master Component for PSoC 3/4/5

RodolfoGL
Employee

Software I2C Master Component for PSoC 3/4/5

Attached file contains the implementation of a software I2C Master component, which does not require any UDB or Fixed-Function block. It implements non-blocking functions to write and read i2c packets without using any interrupt. The user needs to call a "process" function to move on with the i2c packet. Here is an example on how to use this component in the main loop:

SW_I2C_WriteBuf(I2C_SLAVE_ADDR, i2cBuffer, PACKET_SIZE, SW_I2C_MODE_COMPLETE_XFER);

for(;;)

    {    

        status = SW_I2C_Process();

        if ((status & SW_I2C_MSTAT_WR_CMPLT) != 0)

        {  

            /* Do something */               

        }

       

        if ((status & SW_I2C_MSTAT_RD_CMPLT) != 0)

        {

            /* Do something */  

        }

         CyDelayUs(5);

    }

To use the attached file, follow the steps from this video.

This is NOT an official release from Cypress. Use it on your own risk.

Attachments
0 Likes
Comments
cadi_1014291
Valued Contributor

Thanks for the component rlos, i have no use for it (yet) but it's always nice to see how others implement custom components

Regards,

Carlos

AmCi_3754291
New Contributor

I'm trying to use the component but it seems like the blocking I2C functions (WriteByte and ReadByte) don't exist. Do you have an updated version of the component that includes these functions? Or could you give me some direction on how to write these functions?

Thanks

Amilcar

Version history
Revision #:
1 of 1
Last update:
‎Jun 27, 2018 05:46 PM
Updated by:
 
Contributors