I want to read/write I2C EEPROM on the FX3 board with UsbI2cRegMode example firmware project. But I couldn't understand the process.
Project readme file says, " The device enumerates as a vendor specific USB device with only the control endpoint and provides a set of vendor commands to read/write the data on I2C EEPROM devices.".
That's all. There is no additional information how it can be realized.
When I look over "CyFxUSBSetupCB" callback function and "CyFxUsbI2cTransfer" function, I can produce callback function's "setupdat0" and "setupdat1" parameters.
1. How can I generate vendor commands with "setupdat0" and "setupdat1"? 2. How can I send vendor commands within "USB Control Center"? 3. When I send a read command, how can I observe the data? 4. When I want to write to EEPROM, how can I send the EEPROM data?
In the USB Control Centre highlight the control endpoint, click on the data transfer tab and then enter values in the following fields to suit your application
Direction Out/IN you decide
Req Type Vendor
Req CodeYour Vendor code
USB setup data is an 8 byte array sent by the host pc and these are stored in setupdat0 and setupdat1 which the firmware then parses to decode the control information contained in the setup data. In the eeprom example (cyfxusbi2cregmode.c) this is done in the following code
/* Parse the control request parameters. */
attr=(uint8_t) (setupdat0 & 0x000000FF);
rqt=(uint8_t)((setupdat0 & 0x0000FF00) >> 8);
value= (uint16_t) (setupdat0 >> 16);
index= (uint16_t) (setupdat1 & 0x0000FFFF);
length= (uint16_t) (setupdat1 >> 16);
attr is the request type and will be set by Control Centre when you select Vendor.
rqt is the users vendor code and in this example for an eeprom read the code shows