Linux I2C 通信問題 (Linux I2C communication issues)


問題描述

Linux I2C 通信問題 (Linux I2C communication issues)

我正在開發基於 iMX6Q 處理器的定制板,該處理器使用 linux‑imx 內核 4.9.11 (http://git.freescale.com/git/cgit.cgi/imx/linux‑imx.git/?h =imx_4.9.11_1.0.0_ga)。但是,當我向其中一個外圍設備發送 I2C 消息(我在 i2c‑2 總線上有 4 個從設備,處理器是唯一的主設備)時,控制器會出現以下錯誤:

[ 82.972843] i2c i2c‑2: ioctl, cmd=0x703, arg=0x5c
[ 82.972854] i2c i2c‑2: ioctl, cmd=0x720, arg=0x7ec06bbc
[ 82.972865] i2c i2c‑2: master_xfer[0] R, addr=0x5c, len=1
[ 82.972871] i2c i2c‑2: <i2c_imx_xfer>
[ 82.972877] i2c i2c‑2: <i2c_imx_start>
[ 82.973053] i2c i2c‑2: <i2c_imx_bus_busy>
[ 83.482804] i2c i2c‑2: <i2c_imx_bus_busy> I2C bus is busy
[ 83.482810] i2c i2c‑2: Trying i2c bus recovery
[ 83.482854] i2c i2c‑2: <i2c_imx_start>
[ 83.483029] i2c i2c‑2: <i2c_imx_bus_busy>
[ 83.992804] i2c i2c‑2: <i2c_imx_bus_busy> I2C bus is busy
[ 83.992816] i2c i2c‑2: <i2c_imx_xfer> exit with: error: ‑110

採取用示波器看一下,我可以看到總線處於空閒狀態時為高電平(如預期的那樣)。然而,當我嘗試開始傳輸時,主機在總線上設置啟動條件,然後,總線保持低電平(兩者,SDA 和 SCL),直到傳輸超時並且驅動程序警告總線正忙於超時錯誤(儘管它確實不是!)。我知道這不是硬件問題/錯誤,因為我可以通過 U‑Boot(以及較舊的內核版本,例如 4.1.15)通過 I2C 進行通信。

我已經檢查了 I2C 內核配置它似乎沒問題。此外,設備樹中的 I2C 總線控制器已正確配置。

PD:默認內核配置(imx_v7_defconfig)不起作用。

謝謝!

乾杯,

丹尼爾

我已經檢查了 I2C 內核配置,似乎沒問題。此外,設備樹中的 I2C 總線控制器已正確配置。

PD:默認內核配置(imx_v7_defconfig)不起作用。

謝謝!

乾杯,

丹尼爾

我已經檢查了 I2C 內核配置,似乎沒問題。此外,設備樹中的 I2C 總線控制器已正確配置。

PD:默認內核配置(imx_v7_defconfig)不起作用。

謝謝!

乾杯,

丹尼爾


參考解法

方法 1:

The issue has gone. I just had to change the i2c pin configuration (in the Device Tree) from 0x1b8b0 to 0x4001b8b1...It's still strange because those bits (Mask 0xFFFE0000) are marked as reserved in the iMX.6Q reference manual, though they seem not so reserved...In addition, the very same Device Tree file worked without problems with older Kernel versions...

Whatever the case, it is working as expected right now!

(by danrodlordanrodlor)

參考文件

  1. Linux I2C communication issues (CC BY‑SA 2.5/3.0/4.0)

#linux-kernel #I2C #embedded-linux #nxp-microcontroller #imx6






相關問題

選擇 Linux I/O 調度程序 (Selecting a Linux I/O Scheduler)

Android可加載內核模塊錯誤:賦值使指針從沒有強制轉換的整數 (Android Loadable Kernel Module Error: assignment makes integer from pointer without a cast)

文件描述符中實際存儲了多少信息? (How much information is actually stored in a file descriptor?)

hrtimer mengulangi tugas di kernel Linux (hrtimer repeating task in the Linux kernel)

我可以在 C 代碼中使用 LKM 內核代碼中的“getpwuid”嗎? (Can I use "getpwuid" from kernel code in LKM in c code?)

將傳入數據包注入網絡接口 (Injecting an incoming packet to a network interface)

無法從 D3 睡眠狀態喚醒 pci 總線 (Unable to wake pci bus form D3 sleep satate)

在 Linux 中使用 DMA 的最簡單方法 (Easiest way to use DMA in Linux)

Linux I2C 通信問題 (Linux I2C communication issues)

理解 perf stat 輸出中的數字 (Make sense of numbers in perf stat output)

我如何在 amazon Linux AMI 上找到我的 Linux 發行版? (How i could find my Linux distribution on amazon Linux AMI?)

將參數傳遞給系統調用 (Passing arguments to system calls)







留言討論