【问题标题】:How to set up Raspberry Pi 4B as a I2C slave如何将 Raspberry Pi 4B 设置为 I2C 从机
【发布时间】:2021-10-23 10:48:03
【问题描述】:

我正在尝试将 RPi 4B 设置为使用 PSoC (4.4) - CY8C5888LTI-LP097 作为 I2C 从设备。 下面是我在 Pi 上设置从地址的代码。

import pigpio

pi = None
slave_addr = 0x13

def i2cInterrupt():
   global pi
   global slave_addr
   status, bytes_read, data = pi.bsc_i2c(slave_addr) 

   if bytes_read:
      print(data)

pi = pigpio.pi()
int_handler = pi.event_callback(pigpio.EVENT_BSC, i2cInterrupt)
pi.bsc_i2c(slave_addr)

我遵循了这个例子:http://abyz.me.uk/rpi/pigpio/python.html#bsc_i2c 但是,当我运行时没有检测到任何东西

$ i2cdetect -y 1

【问题讨论】:

    标签: python c++ c raspberry-pi psoc


    【解决方案1】:

    您是否将任何 i2c 主 GPIO 环回到从 GPIO?
    在 RPi4 上,您必须分别将 GPIO 2-3 跳线到 GPIO 10-11。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-04-21
      • 2022-09-28
      • 1970-01-01
      • 2016-12-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多