Solved I2C Device in FreeBSD (using Apollo Lake)

Hello,

I bought an RGB LED which I can connect using i2c on my device running FreeBSD 13.1 with CPU Apollo Lake.

I'm trying to set the color according to the commands from the document. I already tried in Debian using i2cdetect, i2cset, and all worked fine.
In FreeBSD when I use " i2c -s " I get "none found"

i2c -s -f /dev/iic0 I get:
Code:
Hardware may not support START/STOP scanning: trying less-reliable read method.
Scanning I2C devices on /dev/iic0: <none found>
i2c -s -f /dev/iic1 I get:
Code:
Error opening I2C controller (/dev/iic1) for scanning: No such file or directory
i2c -s -f /dev/smb0 I get:
Code:
Controller reset failed
Error scanning I2C controller (/dev/smb0): Invalid argument
And when I do i2c -f /dev/smb0 -r
Code:
Resetting I2C controller on /dev/smb0: error: Inappropriate ioctl for device.

smbmsg -p would give me:
Code:
Probing for devices on /dev/smb0:
Device @0x10: w
Device @0x5c: rw
Device @0x70: w
Device @0x88: rw
If I disconnect the I2C LED, "Device @0x70: w" is gone. So the device appears on 0x70 on /dev/smb0
(So when running smbmsg -p I get: Device @0x70 w (which is true because I had the same address on iic0 when trying on Debian with i2cdetect but using the same RGB i2c LED on a different device apu4c))

The modules are all loaded iic, iicsmb, iicbb, smb, iicbus, ichsmb, smbus ...

Trying to send some cmd for the LED to turn on:

Code:
i2c -a 0x38 -f /dev/iic0 -d w -m tr
0x2f
i2c: ioctl(I2CRDWR) failed: No such file or directory

Code:
i2c -a 0x38 -f /dev/smb0 -d w -m tr
0x2f
i2c: ioctl(I2CRDWR) failed: Inappropriate ioctl for device

And nothing changes if I use -a 0x70, it is the same result. I use 0x38 because according to man -a 7-bit address on the I2C device to operate on (hex).

If you have experience something similar, or have any clue, any tip or help is appreciated. Thank you in advance!
 
One important correction. The LED is connected to SMBus 3.3 V (SMB_CK3.3, SMB_DA3.3).
So I should use SMBus protocol. So this should be the right cmd:

smbmsg -f /dev/smb0 -s 0x70 -c 0 -o 1 0x2F

0x2F is the combined internal reg. and function in the RGB LED.
 
I'm updating the ticket in case anyone come across this issue trying to use this type of RGB LED (MIKROE-2950) with FreeBSD via SMBus.

The cmds are:

smbmsg -s 0x70 -o 1 0x2F
smbmsg -s 0x70 -o 1 0x50 (red) (details: -s slave, 0x70 address, -o outcnt, 1 send byte, 0x50 byte (reg. & function according to doc. of RGB LED)
smbmsg -s 0x70 -o 1 0x70 (yellow)
smbmsg -s 0x70 -o 1 0x90 (white)
smbmsg -s 0x70 -o 1 0x90 (off)

Check man smbmsg for more details.

I tried smbmsg -s 0x70 -c 0 -o 1 0x50 and did not see any LED on.
 
Last edited:
Back
Top