- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A real low cost logic analyzer, works great, very good SW.
I have 2, very useful.
Regards, Dana.