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

cross mob
srinathkp
Level 1
Level 1
10 sign-ins 10 likes given 5 questions asked

Hi,

My usecase requires PSoC controller as both I2C Master and I2C Slave and switch between those two seamlessly without reprogramming. 

I2C Write from PSoC to EP - PSoC should be master here. Immediately after, EP should be able to control clock & become master and doI2C Write from EP to PSoC. What should be my design like in this case ? Do I need two separate I2C components - one for Master (I2C_1) and one for Slave(I2C_2) ? In that case, which I2C line will my EP have access to so will that work  ? Or a single I2C component can be configured to be both I2C Master and Slave and switch between those two modes based on who sends START condition & controls the clock ? I'm new to embedded programming so any help and explanation would be really helpful. Thanks in Advance.

0 Likes
3 Replies
ncbs
Moderator
Moderator
Moderator
500 replies posted 50 likes received 250 sign-ins

Hi @srinathkp ,

Which device are you using?

You may use the multi master slave mode in I2C as shown in the picture below.

ncbs_0-1664439494157.png

 

Does EP support UART? UART would be the best bet for you since both devices need to send data to each other at their own will. 

Regards,
Nikhil

srinathkp
Level 1
Level 1
10 sign-ins 10 likes given 5 questions asked

Hi @ncbs ,

Thanks a lot for the answer. Apologies for the late reply, the EP doesn't support UART. The data transfer has to be through I2C and both EP & PSoC MCU has to be able to switch between Master and Slave seamlessly. EP can take control of the clock, become Master and start sending data - during which our PSoC should remain in slave mode and receive the data & vice versa for PSoC in master mode.

Is it possible to achieve this ? EP has the capability to switch, I want to know if PSoC can do that. The project was earlier done on Atmega mcu by a different team & it was possible. Looking for a way to do the same with PSoC - examples or explanations would do. Thank you so much.

TIA,
Srinath

0 Likes

Adding more info @ncbs ,

Able to configure the I2C component as Multi-master slave & do I2C Write to EP as I2C Master. But, when EP wants to become Master, need help in switching PSoC to I2C slave & allow EP to send START condition & do I2C Write as master. I saw a few examples using callbacks but none of them are clear. How do I switch to slave mode & receive data immediately after being master ? Thanks

0 Likes