EUA/AsrLed

Unable to Run

RattyDAVE opened this issue · 10 comments

Hi,

First of thank you for spending the time to do this.

I have a ASROCK Steel Legend B450M MATX Motherboard. And running Manjaro.

Using the following to install and run.

cd ~
git clone https://github.com/EUA/AsrLed.git

sudo pacman -S python-pip
sudo pip install smbus

sudo python AsrLed.py

I get the following error message.

Bus #0 open. Searching...
Traceback (most recent call last):
  File "AsrLed.py", line 53, in <module>
    bus,addr= detect_device()
  File "AsrLed.py", line 40, in detect_device
    response = bus.read_byte(dev_addr)
OSError: [Errno 6] No such device or address

Any ideas?

Thanks

DAVE

EUA commented

Hi Dave,
First you need to load i2c-dev module via modprobe i2c-dev command.
Than look if B20 device is available.

[root@Ryzen death]# i2cdetect -l
i2c-3	i2c       	Radeon i2c bit bus 0x90         	I2C adapter
i2c-1	smbus     	SMBus PIIX4 adapter port 2 at 0b00	SMBus adapter
i2c-2	smbus     	SMBus PIIX4 adapter port 1 at 0b20	SMBus adapter
i2c-0	smbus     	SMBus PIIX4 adapter port 0 at 0b00	SMBus adapter

AFAIK, 0B20 SMBus support not implemented at latest kernel, yet.
You probably need to activate the 0B20 SMBus.
In my config, it installed as i2c-2.
If you can't see it via i2cdetect -l command, you probably need to install aur/i2c-piix4-aura-dkms package and reboot first.
Than it could run.

Do you use AsrLed tool or Asr Polychrome tool at Windows?
Polychrome uses v2, which is not tested yet. Utility show this info also.
Thanks.

Hi,

Thanks for the quick response.

I installed i2c-piix4-aura-dkms from AUR

I found the python lib that I manually installed was causing issues with i2c-tools to had to remove with
sudo pip uninstall smbus

Then I installed i2c-tools
sudo pacman -S i2c-tools

I ran modprobe i2c-dev there was no output from that command.
Then I ran i2cdetect -l and got the following.

i2c-3	smbus     	SMBus PIIX4 adapter port 4 at 0b00	SMBus adapter
i2c-1	smbus     	SMBus PIIX4 adapter port 2 at 0b00	SMBus adapter
i2c-8	i2c       	AMDGPU DM i2c hw bus 3          	I2C adapter
i2c-6	i2c       	AMDGPU DM i2c hw bus 1          	I2C adapter
i2c-4	i2c       	AMDGPU DM i2c hw bus 0          	I2C adapter
i2c-2	smbus     	SMBus PIIX4 adapter port 3 at 0b00	SMBus adapter
i2c-0	smbus     	SMBus PIIX4 adapter port 0 at 0b00	SMBus adapter
i2c-9	i2c       	dmdc                            	I2C adapter
i2c-7	i2c       	AMDGPU DM i2c hw bus 2          	I2C adapter
i2c-5	i2c       	dmdc                            	I2C adapter

As your example I dont have 0b20

Any idea what I am missing?

And NO I dont run Windows just Manjaro. (If needed I can run another distro from USB for testing)

[dave-pc dave]# sudo python AsrLed.py
Bus #0 open. Searching...
Bus #1 open. Searching...
Bus #2 open. Searching...
Bus #3 open. Searching...
Bus #4 open. Searching...
Bus #5 open. Searching...
Bus #6 open. Searching...
Bus #7 open. Searching...
Bus #8 open. Searching...
Bus #9 open. Searching...
device not found.
Switching Cycling Mode
Traceback (most recent call last):
  File "AsrLed.py", line 125, in <module>
    set_mode('cycling')
  File "AsrLed.py", line 89, in set_mode
    bus.write_block_data( addr, 0x30, [mode.get(new_mode)] )
AttributeError: 'int' object has no attribute 'write_block_data'

There was a mistake in the previous message.

When I installed i2c-piix4-aura-dkms it said success at the end. I took that as it was installed. It did not mean that. ☹️

I needed to install linux-latest-headers and reinstall i2c-piix4-aura-dkms

Then I ran i2cdetect -l and got the following.

[dave@dave-pc ~]$ sudo i2cdetect -l
i2c-3	smbus     	SMBus PIIX4 adapter port 4 at 0b00	SMBus adapter
i2c-10	i2c       	dmdc                            	I2C adapter
i2c-1	smbus     	SMBus PIIX4 adapter port 2 at 0b00	SMBus adapter
i2c-8	i2c       	AMDGPU DM i2c hw bus 2          	I2C adapter
i2c-6	i2c       	dmdc                            	I2C adapter
i2c-4	smbus     	SMBus PIIX4 adapter port 1 at 0b20	SMBus adapter
i2c-2	smbus     	SMBus PIIX4 adapter port 3 at 0b00	SMBus adapter
i2c-0	smbus     	SMBus PIIX4 adapter port 0 at 0b00	SMBus adapter
i2c-9	i2c       	AMDGPU DM i2c hw bus 3          	I2C adapter
i2c-7	i2c       	AMDGPU DM i2c hw bus 1          	I2C adapter
i2c-5	i2c       	AMDGPU DM i2c hw bus 0          	I2C adapter

So now there is

i2c-4 smbus SMBus PIIX4 adapter port 1 at 0b20 SMBus adapter

But when running sudo python AsrLed.py I got

Bus #0 open. Searching...
Bus #1 open. Searching...
Bus #2 open. Searching...
Bus #3 open. Searching...
Bus #4 open. Searching...
Bus #5 open. Searching...
Bus #6 open. Searching...
Bus #7 open. Searching...
Bus #8 open. Searching...
Bus #9 open. Searching...
Bus #10 open. Searching...
device not found.
Switching Cycling Mode
Traceback (most recent call last):
  File "AsrLed.py", line 125, in <module>
    set_mode('cycling')
  File "AsrLed.py", line 89, in set_mode
    bus.write_block_data( addr, 0x30, [mode.get(new_mode)] )
AttributeError: 'int' object has no attribute 'write_block_data'
EUA commented

Well, at least you see some improvement but yeah it's weird situation.
This tool is just for nuvoton N76E885AT20 MCUs that controls rgb led lights via i2c bus, at some AsRock mobos.
Not working on your MB, why?
Probably due your MB do NOT have this chip at least on i2c bus...
Instead, I bet your MB having some USB RGB control device(s).
Do you see some unrecognized devices at usb bus?
lsusb could show them up.
If there is, than this tool is not for you.

No odd usb devices. Every one accounted for.

This is the motherboard I have https://www.asrock.com/MB/AMD/B450M%20Steel%20Legend/

Is there any diagnistics I could run?

DAVE

[dave-pc ~]# i2cdetect -l
i2c-3	smbus     	SMBus PIIX4 adapter port 4 at 0b00	SMBus adapter
i2c-1	smbus     	SMBus PIIX4 adapter port 2 at 0b00	SMBus adapter
i2c-6	i2c       	NVIDIA i2c adapter 6 at 7:00.0  	I2C adapter
i2c-4	smbus     	SMBus PIIX4 adapter port 1 at 0b20	SMBus adapter
i2c-2	smbus     	SMBus PIIX4 adapter port 3 at 0b00	SMBus adapter
i2c-0	smbus     	SMBus PIIX4 adapter port 0 at 0b00	SMBus adapter
i2c-7	i2c       	NVIDIA i2c adapter 7 at 7:00.0  	I2C adapter
i2c-5	i2c       	NVIDIA i2c adapter 4 at 7:00.0  	I2C adapter
[dave-pc ~]# i2cdetect 4
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-4.
I will probe address range 0x03-0x77.
Continue? [Y/n] y
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- 15 -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- 6a -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         

PROGRESS!!!!

I edited the pyton script and changed the following

#bus,addr= detect_device()
bus=SMBus(4)
addr=0x6a

Now when I run I get

Switching Cycling Mode

And it switches to the Cycling mode!

EUA commented

That good news Dave!
Indeed your hardware uses Asrock Polychrome RGB FW but compatible! :)

Or you can try my updated search routine. I think all AsRock boards using 0x6a for address. So I decide fix it. New code might work without edit. Please try.

Also can you run dump() function at python for me?
(change last line at script with dump() and run again. )

Your new and unmodified script.

[dave@dave-pc AsrLed]$ sudo python AsrLed.py 
[sudo] password for dave: 
Bus #0 open. Searching...
Bus #1 open. Searching...
Bus #2 open. Searching...
Bus #3 open. Searching...
Bus #4 open. Searching...
Bus:4 Addr:0x6a Reg:0x00 query returns 3.0.
Bus #5 open. Searching...
Bus #6 open. Searching...
Bus #7 open. Searching...
device not found.
Switching Cycling Mode
Traceback (most recent call last):
  File "AsrLed.py", line 132, in <module>
    set_mode('cycling')
  File "AsrLed.py", line 97, in set_mode
    bus.write_block_data( addr, 0x30, [mode.get(new_mode)] )
AttributeError: 'int' object has no attribute 'write_block_data'

And with dump()

Switching Cycling Mode
0x0 :0x3 0x0 
0x1 :0x0 
0x4 :0x1 
0x12 :0x4 
0x13 :0x14 
0x14 :0x4 
0x15 :0x28 
0x16 :0x80 0x80 0x80 
0x17 :0x1 
0x18 :0x10 
0x19 :0x4 
0x1a :0x4 
0x1b :0x4 
0x1c :0x21 
0x1d :0xa 
0x1e :0xa 
0x30 :0x14 
0x31 :0x0 
0x32 :0xff 
0x33 :0x1 0x1 0x0 0x8 0xa 0x50 
0x34 :0xff 0x80 0x80 
0x35 :0x1 
0x41 :0x0 0x0 0x20 
0x42 :0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 
0x50 :0x1 
0x51 :0x1 0x3 0x20 0x0 0x64 
0x52 :0x0 0x0 
0x53 :0x0 
0x54 :0x0 
0x55 :0xa 
0x56 :0x0 
0x57 :0x0 
0x60 :0x0 
0x61 :0x0 
0x62 :0x0 
0x63 :0x0 
0x64 :0x7 
0x70 :0x0 
0x9e :
0x9f :
0xa0 :
0xa1 :
0xa2 :
0xa3 :
0xa4 :
0xa5 :
0xa6 :
0xa7 :
0xa8 :
0xa9 :
0xaa :
0xab :
0xac :
0xad :
0xae :
0xaf :
0xb0 :
0xb1 :
0xb2 :
0xb3 :
0xb4 :
0xb5 :
0xb6 :
0xb7 :
0xb8 :

EUA commented

Hi Dave. Indeed your firmware version is 3.0.
This tool just released for v1.10.
I don't even test on v2.10.
But It's good to hear that at this runs on v3.0.
Now script ignores the version number and just act all 0x6a devices as if nuvoton RGB MCU chip.

I can say that from register dump, this lib is not fits your firmware.
Probably, some functions are not work proper.
I believe you can reverse and find other functions of Polychrome RGB by changing script.
Regards.
Erdem

I have made some progress.

https://github.com/RattyDAVE/asrock-leds/blob/master/changeled.sh

Do you know what the other registers are for?

DAVE