I2C2_SetTimeoutCallback problem

General discussion on mikroBasic PRO for PIC32.
Post Reply
Author
Message
phil31
Posts: 348
Joined: 02 Apr 2009 15:02
Location: France
Contact:

I2C2_SetTimeoutCallback problem

#1 Post by phil31 » 29 Mar 2020 15:17

hi all

please, anybody successfully use the callback function for I2C library ? "I2C2_SetTimeoutCallback" ?
as soon as it's enable, the I2C bus stop to work !

without the callback, main program run as expected most of the time, but maybe 1 time each 24 hours, i discover that the I2C bus hang..

so now, i try to use this timeout callback function to re initialize the bus.
i declare this function when i initialize the I2C bus (just after the I2C2_Init)
but when enable, nothing work anymore on the I2C bus !
i got a lot of error when i configure my I2C devices then the program hang.

target PIC32MX450F256H
any tips ?

thanks, regards
phil

User avatar
filip.grujcic
Posts: 822
Joined: 14 May 2018 08:34

Re: I2C2_SetTimeoutCallback problem

#2 Post by filip.grujcic » 30 Mar 2020 08:27

Hello,

Please find attached the example that demonstrates the usage of I2C_SetTimeoutCallback function.

Regards,
Attachments
I2C Advanced.zip
(5.72 KiB) Downloaded 99 times
Filip Grujcic

phil31
Posts: 348
Joined: 02 Apr 2009 15:02
Location: France
Contact:

Re: I2C2_SetTimeoutCallback problem

#3 Post by phil31 » 30 Mar 2020 15:45

hi Filip

what is the step of the timeout value ?
"timeout: Represents a number of while loops in which the I²C timeout condition is checked."

are you sure that the functions works on 32MX450F256H, on I2C2 too ?

thanks

User avatar
filip.grujcic
Posts: 822
Joined: 14 May 2018 08:34

Re: I2C2_SetTimeoutCallback problem

#4 Post by filip.grujcic » 31 Mar 2020 08:22

Hello,

I2C timeout is pure software implementation, it is hardware independent, therefore it should work on PIC32MX too.
What do you mean by "step of the timeout value"? The value you pass to the timeout function is simply a number of while loops in which I2C flag is checked.

Regards,
Filip Grujcic

phil31
Posts: 348
Joined: 02 Apr 2009 15:02
Location: France
Contact:

Re: I2C2_SetTimeoutCallback problem

#5 Post by phil31 » 01 Apr 2020 13:58

what is the time of the "while loop" then ?

Post Reply

Return to “mikroBasic PRO for PIC32 General”