when adding a device to the I2C 4 channel mux on bus 1 thru 3 how/where do you program the python code for the device to find what bus it is on? For example adding the INA3221 voltage/current monitor on bus 2 what gets added to the program to tell this device it is operating on bus 2?
First let me say that I am new to the world of linux and python programming.
I purchased a I2C 4 Channel Mux TCA9545A Breakout Board. everything seems pretty straight forward. Doing an i2cdetect -y 1 I receive that the device is located at 0X73 as it should be per the documentation and github info.
My problem is that when I attempt to run the testSDL_Pi_TCA9545.py I receive the following errors.
Test SDL_Pi_TCA9545 Version 1.0 - SwitchDoc Labs
Sample uses 0x73 Program Started at:2021-04-20 18:48:15
-----------BUS 0------------------- Traceback (most recent call last): File "testSDL_Pi_TCA9545.py", line 58, in <module> tca9545.write_control_register(TCA9545_CONFIG_BUS0) File "/home/pi/SDL_Pi_TCA9545/SDL_Pi_TCA9545.py", line 74, in write_control_register self._write(TCA9545_REG_CONFIG, config) File "/home/pi/SDL_Pi_TCA9545/SDL_Pi_TCA9545.py", line 52, in _write self._bus.write_byte_data(self._addr, register, data) IOError: [Errno 5] Input/output error
When using Thonny in an attempt at debugging, I receive the following:
Traceback (most recent call last): File "/usr/lib/python3.7/ast.py", line 35, in parse return compile(source, filename, mode, PyCF_ONLY_AST) File "/home/pi/SDL_Pi_TCA9545/testSDL_Pi_TCA9545.py", line 58 tca9545.write_control_register(TCA9545_CONFIG_BUS0) ^ TabError: inconsistent use of tabs and spaces in indentation
This script is 6 years old and I am wondering if the errors are due to it wanting to run under Python3.7. Is there a way to force it to run using Python 2.7 or is there a better way to approach this. I have spent several hours doing multiple Google searches and trying find what I am sure i a simple solution.
Any help would be sincerely appreciated.
Davis Vantage Pro 2 Blitzortung Stations: 1387 1445 2315 WU: KARHOTSP16 CWOP: EW1823 hsnpar.com
I ran the test file using python3 from the Command line. I still get an error. Surely your code is correct. I removed the previous files before installing the new code. Do you have any suggestions on where to start looking?
Traceback (most recent call last): File "/home/pi/SDL_Pi_TCA9545/testSDL_Pi_TCA9545.py", line 51, in <module> tca9545 = SDL_Pi_TCA9545.SDL_Pi_TCA9545(addr=TCA9545_ADDRESS, bus_enable = TCA9545_CONFIG_BUS0) File "/home/pi/SDL_Pi_TCA9545/SDL_Pi_TCA9545.py", line 47, in __init__ self._write(TCA9545_REG_CONFIG, config) File "/home/pi/SDL_Pi_TCA9545/SDL_Pi_TCA9545.py", line 52, in _write self._bus.write_byte_data(self._addr, register, data) OSError: [Errno 5] Input/output error
Also I added the following line in the config.txt in the /boot/ directory when I first installed the original code:
I took a close look at the .pdf file and there is a pic showing 4 devices hooked up to a raspberrypi. I noticed that there are only 4 wires connected to the pi. I had a wire on the int pin on the mux going to pin 7 GPIO4. That is because one of the devices, an AS3935 was using it prior to installing the mux. I am attempting to add a LCD display, the reason for the mux. After removing the wire from the pi, here are my results: HooRaa However, how do I get the interrupt enabled on the AS3935 now?