I2C iLLD - set slave device address causes trap

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

cross mob
gotthard
Level 1
Level 1
10 sign-ins 5 questions asked 5 sign-ins

Hello,

I am trying to use I2C over iLLD but I am facing an issue with slave addressing of external EEPROM.

EEPROM has different address depending on whether I write or read as well if I read/write upper addresses.

During configuration, I set: i2cDeviceConfig.deviceAddress = 0xa0 and this is fine when I have to write something, but when I have to read, deviceAddress should be set to 0xa1. I see that there is a function IfxI2c_setSlaveDeviceAddress but whenever I call this function it causes Data Access Asynchronous Error trap.  I tried to call it this way to unlock the registers:

uint16 pwd = IfxScuWdt_getCpuWatchdogPassword();

IfxScuWdt_clearCpuEndinit(pwd);
IfxI2c_setSlaveDeviceAddress(i2c.i2c, 0xA1);
IfxScuWdt_setCpuEndinit(pwd);

but no luck, I have the same issue. Can someone help me with this issue? Maybe there is another way of setting a I2C slave address. My alternative way of doing it is by defining different configurations but it does not seem efficient (or I am wrong).

I am using Hightec compiler and SafeRTOS but the functions calls are executed before the scheduler is started.

Thank you in advance.

Greetings

0 Likes
1 Reply
Di_W
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 250 solutions authored

Hi gott,

https://github.com/Infineon/AURIX_code_examples/tree/master/code_examples/I2C_Read_Ext_Device_1_KIT_...

There is a demo code for I2C read. Please notice that the read address is 0xAF and write address 0xAE for MCP79411 as below

dw_0-1652884759023.png

dw_1-1652886417259.png

About READ OPERATION details, please refer to datasheet related.

 

https://www.infineon.com/dgdl/Infineon-AURIX_I2C_Read_Ext_Device_1_KIT_TC397_TFT-Training-v01_02-EN....

Please refer above and then debug.

dw 

0 Likes