Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does Linux ARM IIC I2C EEPROM read and write?

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article is to share with you about Linux ARM IIC I2C EEPROM read and write operation, the editor thinks it is very practical, so I share it with you to learn, I hope you can get something after reading this article, say no more, follow the editor to have a look.

There are several sets of i2C buses for detection

Root@beaglebone:~# i2cdetect-li2c-0 i2C OMAP I2C adapter I2C adapteri2c-1 i2C OMAP I2C adapter I2C adapterroot@beaglebone:~#

Check the online status of devices on each bus:-y means yes,0 means / dev/i2c-0

Root@beaglebone:~# i2cdetect-y-r 00 1 2 3 4 5 6 7 8 9 a b cde f00:-10: -20:-- UU-30:-40:-- -50: UU-60:- -- 70:-root@beaglebone:~# UU indicates that there is a device in use at the address 0x50.

Look at the contents of EEPROM. The following 0 indicates / dev/i2c-0 bus, and 0x50 is the address of EEPROM.

Root@beaglebone:~# i2cdump-f-y 0 0x50No size specified (using byte-data access) 0123456789abcdef 0123456789abcdef00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff .10: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff .20: ff ff ff ff ff Ff ff ff ff ff ff ff ff ff ff ff .30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff .40: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff .50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff .60: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff .70: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff .80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff. .90: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff .a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff .b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff .c0: ff ff ff ff ff Ff ff ff ff ff ff ff ff ff ff ff .d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff .e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff .f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff .root @ beaglebone:~#

Get / set the 01st byte of the 0x24 device on the i2C0-0 bus

After root@beaglebone:~# i2cget-f-y 0 0x24 01 root@beaglebone:~# i2cset-f-y 0 0x24 01 0xaa # was powered off, the data written was invalid, pending investigation. Root@beaglebone:~# i2cget-f-y 0 0x24 01

BeagleBone Black reads from the file and writes to the EEPROM, which is permanent.

It takes more than 5 minutes for root@beaglebone:~# dd if=eeprom.bin of=/sys/bus/i2c/devices/0-0050/eeprom # to read and write Linux ARM IIC I2C EEPROM. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report