将de1 soc中i2c2 设置为fpga后无法正常工作
时间:10-02
整理:3721RD
点击:
我想要把hps 里面i2c2设置为fpga的io,但是他无法正常工作
qsys 设置如下:
verilog部分添加了输入输出接口
两根线
一个ip核
soc声明
然后修改了linux的dtb
之后在linux上面不能工作,(i2c总线1上面没连接mpu6050,2上面连接着)
qsys 设置如下:
verilog部分添加了输入输出接口
- output i2c2_clk,
- inout i2c2_sda_io
两根线
- wire i2c2_sda;
- wire i2c2_out_data;
一个ip核
- ALT_IOBUF sda_iobuf (.i(1'b0), .oe(i2c2_out_data), .o(i2c2_sda), .io(i2c2_sda_io)); //
soc声明
- soc_system u0 (
- .pio_led_external_connection_export (LEDR), // pio_led_external_connection.export
- .pio_hex0_external_connection_export (HEX0), // pio_led_external_connection.export
-
- .hps_0_i2c2_clk_clk (i2c2_clk), // hps_0_i2c2_clk.clk
- .hps_0_i2c2_out_data (i2c2_out_data), // hps_0_i2c2.out_data
- .hps_0_i2c2_sda (i2c2_sda), // .sda
- ……
然后修改了linux的dtb
- &i2c2 {
- status = "okay";
- speed-mode = ;
- mpu6050@1 {
- compatible = "invensense,mpu6050";
- reg = ;
- //interrupt-parent = ;
- //interrupts = ;
- mount-matrix = "-0.984807753012208", /* x0 */
- "0", /* y0 */
- "-0.173648177666930", /* z0 */
- "0", /* x1 */
- "-1", /* y1 */
- "0", /* z1 */
- "-0.173648177666930", /* x2 */
- "0", /* y2 */
- "0.984807753012208"; /* z2 */
- };
- pca@1 {
- compatible = "nxp,pca9685-pwm";
- #pwm-cells = ;
- reg = ;
- invert;
- open-drain;
- };
- };
之后在linux上面不能工作,(i2c总线1上面没连接mpu6050,2上面连接着)
- ubuntu@DE1_SoC ~/l/linux-socfpga> i2cdetect -y -r 2
- 0 1 2 3 4 5 6 7 8 9 a b c d e f
- 00: 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
- 10: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
- 20: 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f
- 30: 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f
- 40: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f
- 50: 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f
- 60: 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f
- 70: 70 71 72 73 74 75 76 77
- ubuntu@DE1_SoC ~/l/linux-socfpga> sudo insmod drivers/iio/imu/inv_mpu6050/inv-mpu6050.ko
- ubuntu@DE1_SoC ~/l/linux-socfpga> dmesg | tail
- [ 963.440404] inv-mpu6050: probe of 2-0068 failed with error -22
- [ 1169.547496] inv-mpu6050: probe of 1-0068 failed with error -121
- [ 1169.782021] inv-mpu6050 2-0068: trigger probe fail -22
- [ 1169.787196] inv-mpu6050: probe of 2-0068 failed with error -22
- [ 1802.398730] inv-mpu6050: probe of 1-0068 failed with error -121
- [ 1802.585387] inv-mpu6050 2-0068: trigger probe fail -22
- [ 1802.590546] inv-mpu6050: probe of 2-0068 failed with error -22
- [ 5026.801030] inv-mpu6050: probe of 1-0068 failed with error -121
- [ 5026.955238] inv-mpu6050 2-0068: trigger probe fail -22
- [ 5026.960391] inv-mpu6050: probe of 2-0068 failed with error -22