Sending I2C communications with CYUSB3KIT register example

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
BobaJFET
Level 2
Level 2
5 replies posted 25 sign-ins 5 questions asked

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

0 Likes
1 Solution
Bakal
Moderator
Moderator
Moderator
100 sign-ins 25 solutions authored 50 replies posted

Hi,

  • If you want to make a write communication you need to update the parameter as follows:

Bakal_0-1675069171935.png

  • 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

View solution in original post

0 Likes
3 Replies
Bakal
Moderator
Moderator
Moderator
100 sign-ins 25 solutions authored 50 replies posted

Hi,

  • If you want to make a write communication you need to update the parameter as follows:

Bakal_0-1675069171935.png

  • 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

0 Likes
BobaJFET
Level 2
Level 2
5 replies posted 25 sign-ins 5 questions asked

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. 

0 Likes
Bakal
Moderator
Moderator
Moderator
100 sign-ins 25 solutions authored 50 replies posted

Hello,

you can refer to this thread for functioning without a control center :

https://community.infineon.com/t5/USB-superspeed-peripherals/Loading-the-FX3-Firmware-into-RAM-witho...

If any further issues please let us know.

Regards,
Sakshi Bakal

0 Likes