|
SMBus
Mar 7, 2018 9:11:25 GMT -8
Post by Richard b on Mar 7, 2018 9:11:25 GMT -8
Hey all, I solved this problem before, but I am damned if I can figure out how. Setting up a SunAirPlus on a Raspberry Pi using PiAware 3.5. I've grabbed the sample code,etc, but when I run the test_SDL python thing, I get this:
Traceback (most recent call last):
File "testSDL_Pi_INA3221.py", line 30, in <module>
ina3221 = SDL_Pi_INA3221.SDL_Pi_INA3221(addr=0x40)
File "/home/pi/SDL_Pi_INA3221/SDL_Pi_INA3221.py", line 76, in __init__
self._bus = smbus.SMBus(twi)
IOError: [Errno 13] Permission denied
pi@img-2.1-b0ad47:~/SDL_Pi_INA3221$ sudo pip
sudo: pip: command not found
pi@img-2.1-b0ad47:~/SDL_Pi_INA3221$ sudo raspi-config
pi@img-2.1-b0ad47:~/SDL_Pi_INA3221$ python testSDL_Pi_INA3221.py
Test SDL_Pi_INA3221 Version 1.0 - SwitchDoc Labs
Sample uses 0x40 and SunAirPlus board INA3221
Will work with the INA3221 SwitchDoc Labs Breakout Board
Program Started at:2018-03-07 17:06:26
Traceback (most recent call last):
File "testSDL_Pi_INA3221.py", line 30, in <module>
ina3221 = SDL_Pi_INA3221.SDL_Pi_INA3221(addr=0x40)
File "/home/pi/SDL_Pi_INA3221/SDL_Pi_INA3221.py", line 76, in __init__
self._bus = smbus.SMBus(twi)
IOError: [Errno 13] Permission denied Any ideas? I have installed SMBus2 and Python is running otherwise okay.
|
|
|
SMBus
Mar 7, 2018 9:27:31 GMT -8
Post by Richard b on Mar 7, 2018 9:27:31 GMT -8
Hm, just tried running it with an sudo in front and got this:
Traceback (most recent call last): File "testSDL_Pi_INA3221.py", line 30, in <module> ina3221 = SDL_Pi_INA3221.SDL_Pi_INA3221(addr=0x40) File "/home/pi/SDL_Pi_INA3221/SDL_Pi_INA3221.py", line 91, in __init__ self._write_register_little_endian(INA3221_REG_CONFIG, config) File "/home/pi/SDL_Pi_INA3221/SDL_Pi_INA3221.py", line 123, in _write_register_little_endian self._bus.write_word_data(self._addr, register, switchdata) IOError: [Errno 5] Input/output error
|
|
|
SMBus
Mar 8, 2018 11:35:39 GMT -8
Post by SDL on Mar 8, 2018 11:35:39 GMT -8
Hi Richard,
Run "i2cdetect -y 1" and post the results. Looks like it is not there because of a wiring or setup error.
BP
|
|
|
SMBus
Mar 9, 2018 13:40:06 GMT -8
Post by richard b on Mar 9, 2018 13:40:06 GMT -8
Okay, did that and got this less than helpful response:
pi@img-2.1-b0ad47:~/SDL_Pi_INA3221$ sudo i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --
So I am guessing that there is a wiring error in there somewhere. Time to pull out some cables!
|
|
|
SMBus
Mar 9, 2018 13:54:38 GMT -8
Post by Richard b on Mar 9, 2018 13:54:38 GMT -8
Aha! Got my SDL cables mixed up! Now working as expected.
pi@img-2.1-b0ad47:~/SDL_Pi_INA3221$ sudo i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: 40 -- -- -- -- -- -- -- 48 -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --
|
|
|
SMBus
Mar 9, 2018 18:00:02 GMT -8
Post by SDL on Mar 9, 2018 18:00:02 GMT -8
Richard!
Excellent!
BP
|
|