You are here

I2C With PSoC4 | Cypress Semiconductor

I2C With PSoC4

Summary: 18 Replies, Latest post by RichardNV on 01 Sep 2016 04:25 PM PDT
Verified Answers: 0
Last post
Log in to post new comments.
user_350540870's picture
User
176 posts

Hi All

I apologize for being active on forum after a very long time. 

Anyways, I am currently working in a direction to test I2C Master and Slave in a single PSoC4 - 049 42xx Prototyping Kit. The function that I want is:

1. Send Command from from Master to Slave.

2. Send response of the command from Slave to Master.

I have a single kit. So is there any possibility of testing 2 I2Cs of same PSoC4 with setting one as master and one as slave?

 

Thank you in advance.

 

- Shaunak Agastya Vyas

user_1377889's picture
User
10428 posts

1. Send Command from from Master to Slave.

2. Send response of the command from Slave to Master. This will not work: A slave cannot send any data, but the master may read from slave.

2 I2Cs of same PSoC4 with setting one as master and one as slave?  Yes, you will have to provide pullup resistors in the range of 2K Ohms and externally connect the sda and scl pins.

 

Bob

 

user_350540870's picture
User
176 posts

Hi Bob

Thank you for replying rapidly. We have discussed I2C in the past. So, based on that, I am attaching a project that, I think, can do the tasks. It is a request to all to review this project give your inputs.

 

Thanks and Regards

Shaunak Agastya Vyas

user_350540870's picture
User
176 posts

Hello All

Please ignore previous project attachment as there is a header.h file missing in it.

Please find attached herewith the project.

user_1377889's picture
User
10428 posts

I would only recommend to

  • put all the initialization stuff into a InitializeSystem() function
  • remove the LED blinking into a separate function
  • declare variables in main() as static, so they do not use the stack

to make main() shorter and better readable.

 

Bob

user_350540870's picture
User
176 posts

Hi Bob

Please find attached the modified one. I am facing a problem of not being able to set UART on 4.0 and 4.1 pins. The reason to set them in such way is that I want to program PSoC4 with bootloader and debug the code using UART. I am avoiding MiniProg3 as of now. Please guide me for the same.

user_1377889's picture
User
10428 posts

You cannot have it all.

Ports >= 4 cannot be routed in your PSoC. So you may use an SCB based UART which will use P40 and 1, but this is already used by the second I2C.

You do not need to use the UART in your bootloadable project. Only the bootloader will need it, but after the bootload process it is freed again. You just have to care for the electrical levels on your pins, ie removing the I2C interface during Bootload.

 

Bob

user_350540870's picture
User
176 posts

If that is the case, then how can I debug the same project without MiniProg?

user_1377889's picture
User
10428 posts

You cannot. The -049 kit has no debug capabilities. Get a CY8CKIT-043.

 

Bob

user_350540870's picture
User
176 posts

Is there any possibility for using three SCB Components instead of two in PSoC4?

 

Shaunak Agastya Vyas

user_1377889's picture
User
10428 posts

There is a small "Resource Meter" tab on the very right hand side of the Creator window. This shows how many SCBs are available and (after a successful build) how many are used.

 

Bob

Log in to post new comments.