cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4

ShVy_264716
New Contributor II

Hi All

   

I am working on a project in which I need to implement a Master Device (Pioneer Kit) and a Slave Device (Prototyping Kit) that communicate with each other through I2C. I have designed two different projects named I2C_MASTER1 and I2C_Slave that are attached here inside a zip file called I2C_Comm (1). The functionality that I want to implement is as below:

   

1. The master sends a character to the slave thorugh I2C.

   

2. The slave receives the character and does some process on it.

   

3. The master reads the processed character from a slave and then sends it to PC using UART.

   

I am not getting the desired results as of now. Anybody working in this direction can guide.

   

 

   

Thanks and Regards

   

Shaunak

0 Likes
4 Replies
HeLi_263931
Honored Contributor II

What exactly does not work?

   
        
  • did you test that your master actually can send data to the PC via UART?
  •     
  • did you look with a scope / logic analyzer at the I2C signal to see whether the transmission is what you expect it to be?
  •     
  • Maybe test with other I2C devices to check that you get the I2C code correct
  •    
0 Likes
ETRO_SSN583
Esteemed Contributor

In the master you write -

   

uint8 i2cMasterWriteBuf[BUFFER_SIZE]={0x0u};
 

   

then

   

 

   

         I2CM_I2CMasterWriteBuf(I2C_SLAVE_ADDR, (uint8 *) i2cMasterWriteBuf,
                                   BUFFER_SIZE, I2CM_I2C_MODE_COMPLETE_XFER);
 

   

You have declared the buf to be an array, therefore a pointer, then cast it again to another pointer.

   

I think you should change write command to -

   

 

   

         I2CM_I2CMasterWriteBuf(I2C_SLAVE_ADDR,  i2cMasterWriteBuf,
                                   BUFFER_SIZE, I2CM_I2C_MODE_COMPLETE_XFER);

   

 

   

You do the same thing on the read.

   

 

   

Regards, Dana.

0 Likes
ShVy_264716
New Contributor II

@hli:

   

- Master UART is working perfect individually.

   

- I put CRO on SDA pin, whenever I send a character from PC to PSoC4 through UART, it gives a spike that concludes data transmission is happening from master to slave I suppose.

   

- I am afraid but I do not have other I2C devices.

   

 

   

Regards

   

Shaunak

0 Likes
ETRO_SSN583
Esteemed Contributor

A real low cost logic analyzer, works great, very good SW.

   

 

   

I have 2, very useful.

   

 

   

www.ebay.com/itm/New-USB-Logic-Analyzer-Device-Set-USB-Cable-24MHz-8CH-24MHz-for-ARM-FPGA-/111540669...

   

 

   

Regards, Dana.

0 Likes