I am working with a BPi and I would like to read an CAN to I2C module connected to the SCL and SCA pins of the BPi.
When I try to detect the module, it seems to work fine, as i run i2cdetect -y 0
and the module with address 0x25 appears as follows:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- 25 -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
Then, I try the i2cget -y 0 0x25 0
command, and something strange happens. I tried it once, and it returned 0x00, and after that, every time I run the same command, it pops up an error Error: Read failed
.
Just as additional information, I am using a LoganLabs I2C-CAN module and a BPi with the Raspbian Stretch OS. I have the CAN module connected to a kvaser in which a CAN message is sent, so I think I should be able to read something with this commands.
I am trying to run this commands on the command window as a debbuging process, as I t also tried with the following code above, which simply returns "None".
from smbus2 import SMbus, i2c_msg
import time
address=25
def func1():
lect=i2c_msg.read(address,0)
while True:
lecture1=func1()
print(lecture1)
time.sleep(1)
''' It returns: None '''