I2C Generated code issue

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

cross mob
CyCP
Level 2
Level 2
5 replies posted 10 sign-ins 5 sign-ins

Hi,

I have a weird issue with I2C (Master) generated code.
Sometimes the generated function 'I2C_MasterSendStart' fails (even if the bus is free) with error code 'I2C_MSTR_NOT_READY'.
I've found 'strange values' of the 'I2C_state' variable on such occasions. With 'strange values', I mean values (like, for instance, 0xD2) that, looking at the whole generated code, it cannot assume (memory corruption or am I missing something?).

Again, in such occasions, if I reset it to its default value (namely 'I2C_state = I2C_SM_IDLE;') then the I2C communication works again.

Could you please shed some light on this issue?

0 Likes
1 Solution
CyCP
Level 2
Level 2
5 replies posted 10 sign-ins 5 sign-ins

Never mind, I found it.

It was 'exactly' a memory corruption problem,  a bug of my code (.map file was helpful), my bad.

Solved now.

View solution in original post

0 Likes
3 Replies
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi @CyCP 

 

Are you using the I2C master code example that we have for the device? If a custom project is used, please share the project so that we can reproduce the error at our end. 

Is this a multi-master configuration? Or is the PSoC the only master in the bus?

 

Best regards, 
Hari

0 Likes
CyCP
Level 2
Level 2
5 replies posted 10 sign-ins 5 sign-ins

Hi, 

Thank you for your reply.

Unfortunately, I cannot share the project, and anyway you don't have the corresponding hardware to run it.  Please let me know if I can provide any other useful detail.

The PSoC 5  (CY8C58888LTI) is the only master on the bus. All the (7) slaves  are PSoC4 (CY8C4245PVI).

Best regards.

 

0 Likes
CyCP
Level 2
Level 2
5 replies posted 10 sign-ins 5 sign-ins

Never mind, I found it.

It was 'exactly' a memory corruption problem,  a bug of my code (.map file was helpful), my bad.

Solved now.

0 Likes