You didn't mention what Psoc 4 board kit you are using. Do you have your pull up resistors?
I am using the CY8CKIT-042, PSOC4 I do have pull up resistors.
I have no TSL2591. I tested your program, along with the other device (BMP-085).
Reading is performed correctly, but there are differences:
My program uses another flag (I2C_MODE_COMPLETE_XFER):
31 I2C_I2CMasterWriteBuf(TSL2591_ADDR, (uint8 *)write_Buf,1,I2C_I2C_MODE_COMPLETE_XFER);
I2C.zip 70.1 K
Writing with "MODE_NO_STOP" should be correct, except when stated differently in the slave's datasheet. Usually a read transaction is ended with a stop condition freeing the bus. An intermediate "stop" could be an error for ther slave.
What I do miss is the interpretation of the MasterReadBuf() and MasterWriteBuf() returned result. Both deliver a completion code which could hint to errors that occurred.
Pavloven Thank you for the download, It is a great tool. When I tried it id did not detect the sensor (perhaps I am not using it correctly). I checked wiring voltage etc...all is fine. I even tried it on an arduino and it worked, but I cannot get it to work on the Pioneer kit. SO the sensor appears to be working.
Bob, I checked the datasheet unfortunately it is not clear to me if an intermediate "stop" could be an error for the slave. I will try the PSOC 049 kit maybe I will have more luck. Thanks
Stay with the -042 kit (or get a -044 board) the -049 kit has got no debug capabilities and the core PSoC does not differ from the -042.
On your -042 Kit you may set a breakpoint just after the I2C-calls and inspect the returned values (assign result to a variable)
I checked the datasheet and it seems that you have to write the register number you want to access into the command register.
Use 0xa0 | (RegNumber & 0x1f) to address the register. this will probably need a complete xfer.
Then read from the device which will result in the value of the addressed register.
To work with my program you have to break off a part of the board with chip CY7C65211 and reprogram it as they say here:
CY8CKIT-049, USB-Serial CY7C65211 use as an I2C master.
when you connect the board with chip CY7C65211 to USB and run programm - you should see a "1" in the box USB-I2C
I2C device is connected to the connector J6:
MISO/SCL -> CLK (1-5Kohm to VDD)
MOSI/SDA -> DATA (1-5Kohm to VDD)
If your device requires a 3.3V VDD that is a simple way:
install any green LED instead of F1.
Finally got it to work, thank you guys