[Solved] No I2C device on MT7628

Hi,
i tryed to activate i2c controller on MT7628 (Modul is Skylab Skw92a).
I want to use the "real" i2c device, not the gpio driver.

I have the same Problem as descriped here:
https://openwrt-devel.openwrt.narkive.com/blDRUUmU/i2c-device-not-in-dev

the driver is loaded , but there is no /dev/i2c interface

can anybody help me ?

Thanks a lot

Is the I2C controller properly defined in your DTS?

"Loading" the driver makes it available to the kernel, if it finds a matching "piece of hardware". No matching hardware, no /dev/i2c (Unlike PCs, you need to "tell" the kernel of an embedded device about most every bit of hardware)

Hi jeff,

thank you for your answer.
How can i check if the controller is defined in the DTS?

I checked the mt7628an.dtsi file

there is a propper area for the i2c. I checked with the datasheet of the MT7628.
That looks ok. The adresses match. So i think the driver should be ok.

1 Like

https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/linux/ramips/dts/mt7628an_skylab_skw92a.dts;h=41fd5f2135295978ad43810fbd28720c5f224096;hb=HEAD

I didn’t see it set to status = 'okay'; but may have missed it.

Thank you for your reply.

Ok, it's not in the DTS, but in the dtsi, which is included in Line 4

Perhaps that is not the way it worked?

How to include it propper?

Enable &i2c in the DTS like line 106 for the UART.

(Hard to accurately type code on a phone)

Hi jeff,

thank you so much.
I changed the settings in the dtsi File from status disable to okay.
thats all.
I did not change the dts file.

now i have a device i2c-0

image

But the real question is, why to do that by "hand".
Shouldn't it be done from menuconfig automaticly?

Best regards Jona

I'm wondering if you can now see your i2c devices with i2cdetect 0
I've tried to do something similar very recently and gave up, now back to GPIO driver.

Hi AndrwZ,

i will try that tomorror.
Hobby time is over for today.

It is common practice for the chip-level DTSI to define the range of (known, usable) capabilities of the chip and then have the DTS enable what is actually usable for that board. Especially for things like I2C, the connections to the SoC pins may not be available.

make menuconfig selects things, but doesn't change them. The DTS and what it includes are defined on a board-by-board basis, and set the limits of what might be meaningful to add to the firmware. As there are around a thousand boards supported, it would be a maintenance nightmare to have the config process reflect all the hardware variants in dependencies, not to mention making the dependency display completely unreadable.

Assuming that you can get I2C slaves recognized and the I2C connection is "easy", submitting a patch setting the I2C node to "okay" for your specific board would be the next step.

Hi jeff,
thanks for your explanation.

I tryed the i2c detect, and see there are a lot of adresses visible.
But i didn't connect anything. :frowning:
So that looks bad.

i used an oscilloscope, and i see i2c is working at a Bit time from 10µS.
That is OK.

I found a solution for bad working I2C.
http://vonger.cn/?p=14760

If you change the driver patch, i2cdetect is working fine.
I have a ds1337 real time clock here, and this is the result:
image

without the patch it is not working in a useable way.

2 Likes

thank you for the update, Jona
Are you able to communicate with the slave detected (ds1337)?

I try to read the adress 0 with
i2cget -y 0 0x68 0x00

sadly i receive read error.
I am not sure if this is a problem because of repeated start condition needed by i2c.

I also try an EEprom 24C32.
But i didnt get it on i2cdetect. Perhaps it is damaged.

I will keep trying....

Ahh..... there was a wire problem. No Ground connection.

Now it looks ok.
I can read the second value, and it is the real time.

Now also the Eprom gives a response.

image

1 Like

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.

Thank you, Jona, for inspiration. I've got my slaves working with the current snapshot and non-patched driver. I had wiring (pin numbering) issue as well.

Edit:
I'm now back to i2c via GPIO as it works for me better than native i2c (ds3231 rtc, bme280 sensor)

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.