I've a question regarding I2C communication in CY8CKIT-042 pioneer board.
What I want to do is a simple I2C communication; Write a byte and read a value from slave. It could be programmed in Arduino like below.
const int address = 0x40;
// open the serial port
// Start the I2C module
// start a transmission to the slave
// request register 0
// issue the request
// prepare to receive on byte
// wait for the data to be ready
// print the temperature
I started this program with an example project, I2cCommMaster. When I try this project with my commands and slave address, I found that the master couldn't complete write, so my program holds here;
[main.c @ line:85]
while (0u == (I2CM_I2CMasterStatus() & I2CM_I2C_MSTAT_WR_CMPLT))
/* Waits until master completes write transfer */
Could you guys help me to make this code run? I attach all my code below for your information.
Thanks for your help in advance.
Generally speaking its better if you post a project archive so
all setup/settings/configuration can be seen.
Look at I2C clk and data lines to make sure pullups in place
and you see legit logic level signals.
“Create Workspace Bundle”
If you are using a Pioneer board be aware of fixed pin assignments
on the board. Also PSOC 4 itself has dedicated pins for various
components. See table in -
http://www.cypress.com/?rID=93401 AN86439 - PSoC® 4 - Using GPIO Pins
Thanks Dana for your help. I just figured out that there was my misunderstanding at packet allocation. Once I set the packet design, I could successfully communicate with my slave device. I will make sure to attach the archive if I've a question next time. Thanks!