UDB based ezI2C

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

cross mob
AnSa_1225656
Level 4
Level 4
50 replies posted 25 replies posted 10 replies posted

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 😉

0 Likes
4 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

0 Likes

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

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

0 Likes
lock attach
Attachments are accessible only for community members.
AnSa_1225656
Level 4
Level 4
50 replies posted 25 replies posted 10 replies posted

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 😉

0 Likes