
BDPL参考 简易寄存器接口SMMR.csdnant_iic_uart_system.tclPIN.xdcset_property-dict{PACKAGE_PIN M17 IOSTANDARD LVCMOS33}[get_ports O_LED[0]]set_property-dict{PACKAGE_PIN M19 IOSTANDARD LVCMOS33}[get_ports O_LED[1]]set_property-dict{PACKAGE_PIN L19 IOSTANDARD LVCMOS33}[get_ports O_LED[2]]set_property-dict{PACKAGE_PIN F16 IOSTANDARD LVCMOS33}[get_ports O_LED[3]]set_property-dict{PACKAGE_PIN N17 IOSTANDARD LVCMOS33}[get_ports IIC_0_0_scl_io]set_property-dict{PACKAGE_PIN P18 IOSTANDARD LVCMOS33}[get_ports IIC_0_0_sda_io]set_property-dict{PACKAGE_PIN R18 IOSTANDARD LVCMOS33}[get_ports UART_0_0_rxd]set_property-dict{PACKAGE_PIN T17 IOSTANDARD LVCMOS33}[get_ports UART_0_0_txd]set_property-dict{PACKAGE_PIN F19 IOSTANDARD LVCMOS33}[get_ports i_key]设备树#include dt-bindings/gpio/gpio.h#include dt-bindings/input/input.h#include dt-bindings/media/xilinx-vip.h#include dt-bindings/phy/phy.h#include dt-bindings/interrupt-controller/irq.h/{modelz7 Board ant 789;compatiblexlnx,zynq-zc702,xlnx,zynq-7000;chosen{bootargsconsolettyPS0,115200 earlyconcdns,mmio,0xe0000000,115200n8 keep_bootcon earlyprintk root/dev/mmcblk0p2 rw rootwait;stdout-pathserial0:115200n8;};led{compatibleming,led;statusokay;default-stateon;led-gpiogpio037GPIO_ACTIVE_HIGH;};beeper{compatibleming,beeper;statusokay;default-stateoff;beeper-gpiogpio038GPIO_ACTIVE_HIGH;};keys{compatiblegpio-keys;autorepeat;gpio-key1{labelps_key1;gpiosgpio047GPIO_ACTIVE_LOW;linux,codeKEY_UP;gpio-key,wakeup;autorepeat;};gpio-key2{labelps_key2;gpiosgpio051GPIO_ACTIVE_LOW;linux,codeKEY_DOWN;gpio-key,wakeup;autorepeat;};};};i2c0{clock-frequency100000;eeprom50{compatibleatmel,24c02;reg0x50;pagesize8;};};测试# 探测at24c02rootant:/sys/class/i2c-dev/i2c-0/device/0-0050# i2cdetect -y 0Warning: Cant use SMBus Quick Write command, will skip some addresses 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: 10: 20: 30: 40: 50: 60: # 探测at24c02 rootant:/sys/class/i2c-dev/i2c-0/device/0-0050# i2cdetect -y 0 Warning: Cant use SMBus Quick Write command, will skip some addresses0123456789a b c d e f 00:10:20:30: -- -- -- -- -- -- -- --40:50:5051525354555657-- -- -- -- -- -- -- --#rootant:~# ls /sys/bus/i2c/drivers/at24/binduevent unbind# 把 I2C 设备 0-0050 绑定(bind)到内核驱动 at24 上rootant:~# echo 0-0050 /sys/bus/i2c/drivers/at24/bindat240-0050:256byte 24c02 EEPROM, writable,8bytes/write rootant:~# ls /sys/bus/i2c/drivers/at24/0-0050binduevent unbind rootant:~# ls /sys/bus/i2c/devices/0-0050/0-00500 driver eeprom modalias name of_node power subsystem uevent# 读取at24c02rootant:~# hexdump -C /sys/bus/i2c/devices/0-0050/eeprom00000000 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff|................|* 00000100# at24c02 写入hellorootant:~# echo -n hello /sys/bus/i2c/devices/0-0050/eeprom# 读取at24c02rootant:~# hexdump -C /sys/bus/i2c/devices/0-0050/eeprom0000000068656c 6c 6f ff ff ff ff ff ff ff ff ff ff ff|hello...........|00000010 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff|................|* 00000100