- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dev Board: CYUSB3KIT-003
I am currently working with the example "cyfxusbi2cregmode.c"
I understand that communications can be sent through the I2C pins SDA and SCL using the function:
CyFxUsbI2cTransfer (
uint16_t byteAddress,
uint8_t devAddr,
uint16_t byteCount,
uint8_t *buffer,
CyBool_t isRead)
Could someone please provide a quick example of how these parameters would be filled out when this function is called to communicate with a slave peripheral? Assume we want to send a simple 16 bit (2 byte) write communication. What would this look like? I also do not understand the difference between byteAddress and devAddr.
Thank you
Solved! Go to Solution.
- Tags:
- cyusb3kit-003
- fx3
- i2c
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
- If you want to make a write communication you need to update the parameter as follows:
- To write 2 bytes of data you need to give it through the control center as follows :
Write to I2C EEPROM
bmRequestType = 0x40
bRequest = 0xBA
wValue = I2C EEPROM Slave Address (Can be in the 0 to 7 range, must be set according to the
EEPROM address switch SW40)
wIndex = EEPROM byte address (can vary from 0x0000 to 0xFFFF. The max address is capped by
the EEPROM max size)
wLength = Length of data to be written (Should be a multiple of 64 and less than or equal to 4096)
- The byte address gives the address of a specific byte inside the EEPROM address.
- dev address is to address the I2C device as such.
Best Regards,
Sakshi Bakal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
- If you want to make a write communication you need to update the parameter as follows:
- To write 2 bytes of data you need to give it through the control center as follows :
Write to I2C EEPROM
bmRequestType = 0x40
bRequest = 0xBA
wValue = I2C EEPROM Slave Address (Can be in the 0 to 7 range, must be set according to the
EEPROM address switch SW40)
wIndex = EEPROM byte address (can vary from 0x0000 to 0xFFFF. The max address is capped by
the EEPROM max size)
wLength = Length of data to be written (Should be a multiple of 64 and less than or equal to 4096)
- The byte address gives the address of a specific byte inside the EEPROM address.
- dev address is to address the I2C device as such.
Best Regards,
Sakshi Bakal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for the reply. Could you read/write through a function call without using the control center? Also, can this transfer function work with other I2C devices other than EEPROM? For example, I may need to write to an external DAC chip.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
you can refer to this thread for functioning without a control center :
If any further issues please let us know.
Regards,
Sakshi Bakal