1

I'm trying to interface a Raspberry Pi with the mini-box OpenUPS. It claims to implement the Smart Battery SMBus specifications.

I can read data from the device using the i2c_smbus_read_word_data() function as defined in the Linux Kernel docs.

So, my basic problem is this: When the device is booted for the first time, and I perform the first read, all the data is messed up. I get negative numbers, and none of it makes sense.

But, if I perform a single byte read, then all following word reads give the correct data.

It's almost as if the byte order is getting messed up in a buffer someplace, and it takes a single byte read to straighten it out. But why doesn't it work the first time?

Adam Lawrence
  • 32,921
  • 3
  • 58
  • 110
  • Odd that the site complained that a hyperlink directly to the OpenUPS product page was 'not allowed'. – Adam Lawrence May 30 '13 at 15:04
  • BTW, 'asking about asking' and putting thanks / nametags in question posts on EE.SE are discouraged activities, and will end up getting edited out. – Adam Lawrence May 30 '13 at 15:05
  • This might be better asked at [RPi.SE](http://raspberrypi.stackexchange.com/) – yo' Mar 28 '14 at 20:53
  • I'm trying to do this exact same thing. Do you have any code for this? – dberm22 Jun 27 '17 at 20:05
  • Unfortunately not. That was four years ago, and I have since moved on from that company. However, IIRC, we ended up using the USB interface and a daemon of some sort. We then communicated with the daemon via bash. – Mark Baldridge Jun 28 '17 at 22:36

0 Answers0