-
1. Re: FX3 I2C simple example
shashankr_96 Sep 18, 2014 1:09 AM (in response to krzysztof.sielewicz)Krzystof,
I2cregmode/i2cdmamode are the simplest examples available. I think you just need to familiarize yourself with Fx3 firmware flow.
In the i2cregmode, there is a CyFxUsbI2cTransfer() function defined that performs the i2c read/write operations using the CyU3PI2cReceiveBytes() and CyU3PI2cTransmitBytes() API calls.
And this functions is called inside the CyFxUSBSetupCB() function which is a callback function for USB EP0 commands.
There are vendor requests defined for i2c read (CY_FX_RQT_I2C_EEPROM_READ) and write (CY_FX_RQT_I2C_EEPROM_WRITE). These vendor commands are recevied from the PC.
You can call the CyFxUsbI2cTransfer() function from anywhere in the code based on your requirement.
You can use the existing thread itself for your i2c read/write calls.
-Shashank
-
2. Re: FX3 I2C simple example
krzysztof.sielewicz Sep 18, 2014 8:09 AM (in response to krzysztof.sielewicz)Hi!
Thank you for the answer!
Can you tell me how now I should write data from the PC? So that they are properly interpreted by FX3?
Regards,
Krzysztof
-
3. Re: FX3 I2C simple example
shashankr_96 Sep 19, 2014 1:04 AM (in response to krzysztof.sielewicz)CY_FX_RQT_I2C_EEPROM_READ and CY_FX_RQT_I2C_EEPROM_WRITE are vendor commands sent out on EP0 from host to device.
The Fx3 already has code to interpret them and take appropriate action (read/write to i2c). You can send these Ep0 requests from the Control Center application.
-Shashank
-
4. Re: FX3 I2C simple example
user_438021184 Jan 27, 2017 10:08 PM (in response to krzysztof.sielewicz)Are there any examples on how to send CY_FX_RQT_I2C_EEPROM_READ and CY_FX_RQT_I2C_EEPROM_WRITE from Linux?
Is there a device driver which will do this, or is there a user space program on top of libusb which can do this?
-
5. Re: FX3 I2C simple example
user_438021184 Jan 28, 2017 2:58 AM (in response to krzysztof.sielewicz)I appears that this can be done using libusb_control_transfer.
However, in my case it will timeout when the FX3 calls CyU3PUsbSendEP0Data (I'm using CY_FX_RQT_ID_CHECK to read the glFirmwareID).
-
6. Re: FX3 I2C simple example
user_438021184 Jan 29, 2017 10:41 AM (in response to krzysztof.sielewicz) -
7. Re: FX3 I2C simple example
user_438021184 Jan 31, 2017 10:19 PM (in response to krzysztof.sielewicz)Did anybody get this working on Windows?
Update:
I don't have a windows system, but I also get the same result with the pre-built firmware downloaded from:
http://www.cypress.com/file/340976/download
The result using the Cypress GUI is the same as in the image above. I would have expected to read the firmware id, which I observe on the FX3 serial port:
=3A: Device initialized. Firmware ID: 20 33 58 46 0 43 32 49
=3B: Device initialized. Firmware ID: 20 33 58 46 0 43 32 49
... -
8. Re: FX3 I2C simple example
user_438021184 Feb 1, 2017 12:27 PM (in response to krzysztof.sielewicz)Did anybody get this to work on any platform?
CyU3PUsbSendEP0Data will simply hang. Using CY_FX_RQT_I2C_EEPROM_READ CyFxUsbI2cTransfer will return CY_U3P_SUCCESS, but the following CyU3PUsbSendEP0Data will timeout.
Are there any chipsets which will not work with the FX3? I have tried both VIA and Intel and I get no data.
-
9. Re: FX3 I2C simple example
nishanta_46 Mar 28, 2017 12:48 AM (in response to user_438021184)Please try by setting the bmRequest type to 0xC0 instead of 0x40 (SETUPDATA0 field in the above image)
-
10. Re: FX3 I2C simple example
ThrimurthiM Oct 6, 2018 3:19 AM (in response to shashankr_96)Hello,
What is Byte adress in CyFxUsbI2cTransfer() parameter
CyFxUsbI2cTransfer (
uint16_t byteAddress,
uint8_t devAddr,
uint16_t byteCount,
uint8_t *buffer,
CyBool_t isRead)
-
11. Re: FX3 I2C simple example
yumingfoy_3247926 Nov 9, 2018 1:27 AM (in response to krzysztof.sielewicz)Hello!
Did you solve the PC code?