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 ?
Thanks in advance,
USB EZ-PD Type-C
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.
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 ?
Thanks and regards,
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.
Maybe you can try an empty project with dragging a I2C component to check the if the allocation could be successful.
Can you please share your .cysh file screenshot like below
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
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.