Hello
I have Raspberry Pi 3 and a custom circuit designed and coded by me. The circuit has 18F87K22 MCU, they are talking with I2C protocol. I developed the MCU's code by looking to the datasheet in C, using XC8 compiler. It is working in Proteus simulator as well but the real word is different as you know.
The problem is sometimes I2C protocol is just disconnecting in a way as I understood. I 'm using smbus library in Python code on RP side and getting Input/Output Error (Error 5) sometimes but totally random. if I disconnect the circuit, I 'm getting that error always, so it means the connection is losing but I don't know how?
I 'm giving latency between operations but it does not matter the latency is 1ms or 1 second, as I told before, it is totally random. I updated the RP kernel to 4.4 but nothing changed. I tried decreasing baudrate down to 9600 but nothing changed. There is no difference either 100000 or 9600. I tried to catch the problem like overflow etc on circuit side but it seems there is no overflow or something like that as I tested. Also I checked if the MCU is resetting but no, it is not resetting. How can I fix this problem? Actually is the problem about RP's I2C protocol or smbus library or my own circuit? There are lots of prorability but here is where the experince talks, please help me. I 'm not using external pull ups since RP has already 1.8k internal pull up resistors, I2C connection cable is about 50cm length. I can share the codes if needed.
I 'm awaiting urgent replies please.
Best
I have Raspberry Pi 3 and a custom circuit designed and coded by me. The circuit has 18F87K22 MCU, they are talking with I2C protocol. I developed the MCU's code by looking to the datasheet in C, using XC8 compiler. It is working in Proteus simulator as well but the real word is different as you know.
The problem is sometimes I2C protocol is just disconnecting in a way as I understood. I 'm using smbus library in Python code on RP side and getting Input/Output Error (Error 5) sometimes but totally random. if I disconnect the circuit, I 'm getting that error always, so it means the connection is losing but I don't know how?
I 'm giving latency between operations but it does not matter the latency is 1ms or 1 second, as I told before, it is totally random. I updated the RP kernel to 4.4 but nothing changed. I tried decreasing baudrate down to 9600 but nothing changed. There is no difference either 100000 or 9600. I tried to catch the problem like overflow etc on circuit side but it seems there is no overflow or something like that as I tested. Also I checked if the MCU is resetting but no, it is not resetting. How can I fix this problem? Actually is the problem about RP's I2C protocol or smbus library or my own circuit? There are lots of prorability but here is where the experince talks, please help me. I 'm not using external pull ups since RP has already 1.8k internal pull up resistors, I2C connection cable is about 50cm length. I can share the codes if needed.
I 'm awaiting urgent replies please.
Best