I2C With PSoC4

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

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

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

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

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

0 Likes
lock attach
Attachments are accessible only for community members.

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

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

Hello All

   

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

   

Please find attached herewith the project.

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

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

0 Likes
lock attach
Attachments are accessible only for community members.

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.

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

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

0 Likes

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

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

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

   

 

   

Bob

0 Likes
ShVy_264716
Level 4
Level 4
50 replies posted 25 replies posted 10 replies posted

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

   

 

   

Shaunak Agastya Vyas

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

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

0 Likes

Got it, Bob. Thank you.

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

You are welcome!

   

 

   

Bob

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

I have modified the things a bit for debugging purpose. I am using UART UDB instead of SCB. By this way, I am able to get two I2C SCB and a UART UDB. Though I am still not able to access those 4.0 and 4.1 pins for UART as they are for I2C. So I have set up the debugging environment based on LED Blinking. When slave receives command fro master, it blinks an on board LED. If anyone has better method of debugging, then please share.

   

 

   

Shaunak Agastya Vyas

0 Likes
RiLi_333781
Level 2
Level 2

For me, use one pioneer board from PSOC4_BLE kit, solder 5 wires to KitProg pins for PSOC4 kit, then you can debug and program without bootload.

0 Likes
ShVy_264716
Level 4
Level 4
50 replies posted 25 replies posted 10 replies posted

Can PSoC4 CY8CKIT-042 Pioneer kit be used as debugger for PSoC4 and PSoC5 both?

0 Likes
RiLi_333781
Level 2
Level 2

PSOC5 kit- CY8CKIT-059 include kitprog, if you really want save money, you may use one CY8CKIT-059 program and debug PSOC4 and PSOC5.

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

Can PSoC4 CY8CKIT-042 Pioneer kit be used as debugger for PSoC4 and PSoC5

   

Not without modifying the pioneer kit with a soldering iron. This is why we suggest you to use a -059 prototyping lit, the snap-off part is a complete programmer.

   

 

   

Bob

0 Likes

Bob replay is correct.

   

Beside this, for some reason I did damage my pioneer kit Kitprog parts.

   

Use MiniProg3 is better, it can protect damage.

0 Likes