4 Replies Latest reply on Aug 4, 2015 11:00 AM by user_367297687

    UDB based ezI2C

    user_367297687

      I use the fixed function I2C with the exI2C component regularly with good success.  I currently have a project where I need a second I2C slave.

         

      Since the PSoC5LP I am using has only one fixed function I2C block, I need to use a UDB equivalent of the ezI2C slave.

         

      It appears that the register addressing needs to be manually implemented for the UDB I2C slave in order to make it function like the ezI2C block?  My main loop has a lot of work going on, so I need to have the register addressing handled in an interrupt like the ezI2C.  Any ideas before I completely rewrite the ISR for the I2C slave ;)

        • 1. Re: UDB based ezI2C
          user_1377889

          I always used the UDB implementation for I2C, the ezI2C seemed to be too eazy ;-)

             

          What is your actual problem with the component, what "registers" are you talking about?

             

           

             

          Bob

          • 2. Re: UDB based ezI2C
            user_367297687

            Thanks for the response Bob,

               

            The ezI2C is easy, I'll give you that.  I need to emulate a typical I2C device where the master sends a register address and the next read or write begins at that address.  I have tweaked the interrupt routine to use the first byte of a write sequence as the register address, but I was hoping there was a cleaner way of doing this.  I don't want to have to process in the main loop.

               

            Andy

            • 3. Re: UDB based ezI2C
              user_1377889

              You will probably have to do it that way. Of course you may use techniques as a callback routine which could make your programmer's life easier.

                 

               

                 

              Bob

              • 4. Re: UDB based ezI2C
                user_367297687

                Thanks for the responses.

                   

                The attached file (rename to I2C_INT.c) is the modified version that supports ezI2C style functionality for my project.  I only did mods for the specific component configuration I am using, but one should easily see what I did.  It seems to work quite reliably.  I did an A/B test with the FF based ezI2C component and it appears to operate the same.  I need to do some more cleanup before it goes to production.  Let me know if there is a better way ;)