Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

Software I2C Master Component for PSoC 3/4/5

lock attach
Attachments are accessible only for community members.

Software I2C Master Component for PSoC 3/4/5

RodolfoGL
Employee
Employee
250 solutions authored 250 sign-ins 5 comments on KBA

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
1277 Views
Comments
cadi_1014291
Level 6
Level 6
25 likes received 10 likes received 10 likes given

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
Level 2
Level 2

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