Runtime Configuration of CCG3PA from I2C Multimaster to I2c Slave

Announcements

Live Webinar: USB-C adoption. Simple & Cost-efficient solutions | April 18th @9am or 5pm CEST. Register now !

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

cross mob
PrRe_3492461
Level 4
Level 4
First like received 50 sign-ins 50 replies posted

Hello all,

I have a requirement to change the i2c configuration of ccg3pa in runtime ie., from I2C Multi-Master configuration to I2C slave.

From PSOC4 Serial Communication Block(SCB) document,

void SCB_I2CInit(SCB_I2C_INIT_STRUCT *config) description as in Image 1 says that this function is intended specifically for "Unconfigured SCB " in customizer as in Image 2,

So if I use "I2C" block instead of "Unconfigured SCB", how would I re-configure I2C from multi-master to slave mode in runtime ? Is it possible ?

And Even though if I use "Unconfigured SCB " in customizer, I'm unable to Configure I2C SCL and SDA lines to my required pins in .cydwr file as in Image 3. I want to configure SCL SDA lines to 12 and  pins but only 2,5,7,8 pins are only available to configure. Why ? Any dependecny with pin muxing ? How to overcome ?

Image 1:

 

PrRe_3492461_1-1669717200878.png

Image 2:

PrRe_3492461_2-1669717324390.png

Image 3:

PrRe_3492461_3-1669717618109.png

 

Thanks in advance,

Regards,

Pranay

 

0 Likes
5 Replies
Wang_Fred
Moderator
Moderator
Moderator
5 questions asked 100 solutions authored 250 sign-ins

Hi Pranay,

SCB component could be only allocated to the fixed pins. In attached capture, SCB1 is used, so you could find in device datasheet the allocated pins for SCB1.

I2C mode could be switched during running time. There are code examples available in PSoC Creator for PSoC4/CCGA3PA - SCB_UnconfiguredComm / I2C_Master_High_Level.

It should be helpful to your application.

 

0 Likes

Hello wang,

Thanks for the reply,

Below Image4 is from ccg3pa datasheet, it says pins 1,2 and 7,8 and 12,13 can be used for SCB (I2C) component. Correct me if I'm wrong here.

And in my custom design I'm using pins 12 and 13 for I2C communications, so I want to make use of that pins itself and re-configure i2c as Multi-Master and Slave in runtime.

But as per below Image5 and Image6, I'm unable to allocate pins 12 and 13 for SCB block, they're not even visible in the dropdown selection itself. Can you please help me out here, Am I missing something here ?

Image 4:

PrRe_3492461_0-1669786934590.png

Image 5:

PrRe_3492461_3-1669787253615.png

 

Image 6:

 

PrRe_3492461_4-1669787278433.png

 

Thanks and regards,

Pranay

 

 

0 Likes
Wang_Fred
Moderator
Moderator
Moderator
5 questions asked 100 solutions authored 250 sign-ins

Hi Pranay,

It looks there is no problem on my side to allocate pin12/13 to I2C component. The base project is CYPD3171 pb from Power SDK3.5. See below capture.

Wang_Fred_0-1669795174370.png

Maybe you can try an empty project with dragging a I2C component to check the if the allocation could be successful.

0 Likes

HI wang,

Can you please share your .cysh file screenshot like below

PrRe_3492461_0-1669795463379.png

 

It looks like you're configuring to "I2C" mode instead of that try selecting "unconfigured SCB "mode similar to mine and try assigning pins in .cydwr file.

Even I'm able to assign to 12 and 13 pins if I select I2C in configuration block

 

--pranay

0 Likes

Hi Pranay,

Yes, you are correct. The unconfigured SCB component can not be routed to pin12/13.  Furthermore,  this component is originally designed for PSoC 4, so there are no proper pins which could be allocated to this component for CCG3PA, including p1_1/p1_2 and p0_0/p0_1 (SWD pins). There are always building errors. 

Considering your application requirements, it looks the only feasible way is to switch the I2C component running mode. But there is perhaps no available code to show this.

I would suggest you to raise a another ticket under PSoC 4 categoty in community since CCG3PA is PSoC 4 based controller, PSoC 4 expertise may be able to show the correct way. 

0 Likes