www.8devices.com
View unanswered posts | View active topics It is currently 25 Nov 2017, 09:43



Reply to topic  [ 1 post ] 
 smbus problem with reading registries 
Author Message

Joined: 01 Apr 2016, 12:46
Posts: 1
Hello,
I have strange problem with reading registries using python-smbus library. Im working with device that have two (important for me) registries (0x00 and 0x01). The problem is that "bus.read_byte_data(i2cAddr , 0x01)" returns always conntent of register 0x00 insted register 0x01. It is easy to see with simple python example:

#-----------------simple python example---------------------
import smbus
bus = smbus.SMBus(0)
i2cAddr = 0x23
register00 = bus.read_byte_data(i2cAddr , 0x00)
print register00
register01 = bus.read_byte_data(i2cAddr , 0x01)
print register01 # <--- print the same value as "print register00"
#-----------------simple python example---------------------

I have to mention that registries 0x00 and 0x01 have completely different meaning(0x00 is a status register, 0x01 is a commands register) and they should hold different values in most cases.
I tested the same program on RaspberryPi and it was working simply correct.

On the other hand tool i2cget in terminal on Carambola2 works properly. With "i2cget -y 0 0x23 0x00 c" i can read 0x00 register and with "i2cget -y 0 0x23 0x01 c" i can read also 0x01 register. So my question is what i must do to be able to read other register than 0x00 using "read_byte_data" function on Carambola2?

Below are some installed packages:
i2c-tools - 3.1.2-1
kmod-i2c-algo-bit - 4.1.23-1
kmod-i2c-core - 4.1.23-1
kmod-i2c-gpio - 4.1.23-1
kmod-i2c-gpio-custom - 4.1.23-2
python-smbus - 3.1.2-1


#uname -a
Linux Carambola2 4.1.23 #33 Mon Oct 10 13:09:36 UTC 2016 mips GNU/Linux


11 Oct 2016, 09:06
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron

Protected by Anti-Spam ACP Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.