- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am working on I2C communication between Raspberry Pi as master and PSoC4 as slave. To set PSoC4 as I2C slave, I am programming it with EZI2C Slave (SCB v3.0) component using Creator 3.2. I went through the following piece of while studying the datasheet of the component:
#define BUFFER_SIZE (0x0Au)
#define BUFFER_RW_BOUNDARY (0x04u)
uint8 ezi2cBuffer[BUFFER_SIZE];
SCB_EzI2CSetBuffer1(BUFFER_SIZE, BUFFER_RW_BOUNDARY, ezi2cBuffer);
What I could understand from the datasheet and this piece of code is that this SCB_ExI2CSetBuffer1() API sets the "ezi2cBuffer" as the buffer to which Master I2C device writes data and from which Master I2C device reads data. If I understood in this way, then I am afraid that I will get so much confused about how to set the same buffer for simultaneous read and write operations from master.
For example, I write a value "0x0000" from master Pi to slave PSoC. The slave PSoC gets this value as a command to send a string "OK" back to the master. On the reading from slave, the master gets the string "OK". If I want to execute this, I have to define separately a read buffer and a write buffer, but it is not possible as this SCB_ExI2CSetBuffer1() API only declares a single buffer for both.
Any help in understanding this and developing the comminucation would be highly appreciated.
Regards
Shaunak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So do not use EzI2C component, but the I2C component in slave mode. There you get two separate buffers for read and write access from master.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did not check, but that seems to be what I suggested. Remove the copyright from your main.c and replace it with your own! It is your work, not Cypress's.
Bob