uboot 的i2c读写,i2c_read(u_int8_t chip, u_int32_t addr, int alen, u_int8_t *buf, int len),u-boot,i2c_write

uboot中 使用i2c uboot中i2c读写有2种方式,一种使用uboot驱动模型,通过宏 CONFIG_DM_I2C定义,另一种是传统方式,通过宏CONFIG_SYS_I2C定义。 传统方式——SYS_I2C 1.设置总线号 int i2c_set_bus_num(unsigned int bus); 2.读/写 int i2c_read(uint8_t chip, unsigned int addr, int... 阅读详情

【转帖请注明出处:blog.youkuaiyun.com/lanmanck】

看格式,介绍参数好了:

int i2c_read(u_int8_t chip, //芯片的i2c地址,不包含读写位

u_int32_t addr, //芯片内的读写地址,比如寄存器地址

int alen, //这个要看代码才知道是地址的长度。比如有的flash比较大就有16位地址。

              //uboot支持32位地址,不过要看驱动支不支持。0=8bit,1=16bit,2=32bit地址长度

u_int8_t *buf, //数据

int len)            //数据长度

 

通过代码可以看到,addr是在alen!=0的情况下采用的,所以如果只是读写8位地址的芯片,addr是没有用的。因此在读取之前可能需要用i2c_write先写一个寄存器地址,然后再调用i2c_read进行读取。

Linux驱动.之 iic i2c 应用层(一) device_addr:外围设备地址(Hi35xx 的 I2C 控制器支持标准地址(7bit)和扩展地址(10bit))device_addr:外围设备地址(Hi35xx 支持标准地址(7bit)和扩展地址(10bit))reg_width:外围设备的寄存器位宽(Hi35xx 的 I2C 控制器支持 8/16bit)data_width:外围设备的数据位宽(Hi35xx 的 I2C 控制器支持 8/16bit)把 I2C 控制器和新增的 I2C 外围设备关联起来,得到描述 I2C 外围设备的客户端结构体。 阅读详情

相关推荐

I2C通讯协议(详解SDA/SCL)

I2C通讯协议——使用攻略 1、基本介绍 调I2C时序,主要在调数据写入write_I2C和数据读取read_I2C的机制。I2C主要实现数据的传输,使主机和从机的相互响应。它有一种数据传送机制。总结起来为:起始信号,终止信号、应答信号,读字节,写字节,数据读取和数据写入。 I2C基本架构: Start_I2C Stop_I2C readack 读取应答信号 sendack and sendna...

weixin_44006573的博客 1万+

海思I2C工具i2c_read使用地址的规则

使用i2c_read工具时,该使用7位地址还是8位地址时遇到了一点小麻烦,记录一下。 i2c_read地址要使用8位,最后一位填0即可。

wangzh92429的博客 3202

【13】i2c,input,pwm,iio,dma

接了一个gpu卡,gpu升温快最长3秒,获取温度给风扇调速进程pid算法算风扇转速,如果温度获取慢,影响散热策略:接了一张raid卡(后面接了几十块硬盘),数据交互量非常大,i2c一个字节一个字节传输慢,要获取每个硬盘温度,如果把raid卡数据访问完,肯定超过3秒,再去访问gpu,gpu肯定超温了,常见解决方法给gpu单独开一个线程,和其他进程争抢访问i2c bus锁。:地址被探测了,但没有芯片应答。如下-f:force, -y:yes,i2cdetect -y -q 5,i2cdump。

持续更新ing... 1400

使用海思自带的i2c工具访问i2c设备

linux下开发i2c设备驱动,一般分为两个阶段,第一阶段是驱动实现,第二阶段是调试。驱动实现即是对i2c设备的正确访问,包括读、写、控制。而第二阶段,一般用于需要调整参数的i2c设备,如增益、亮度、灰度、补偿系数等;因为该类参数需与具体使用场合关联,需实时调整该类参数以满足最佳的状态何效果。对于这种场景,如果通过频繁修改驱动源码来调整参数,很显然不是理想的方式,工作繁琐且效率低下。

只要思想不滑坡,想法总比问题多。 5715

【bmc11】espi/postcode,uart/sol,usb/kvm

如下二进制转十进制,64+1=65就是A(ascii)。如下100微秒。

持续更新ing... 1272

【10】route,iptables,macvlan,mii/mdio,ncsi,bond,dns,ipv6

如下53134相当于一个小的switch交换机(固件文件小,所以用eeprom,bmc用spi去升级这个eeprom),53134 port1口给bmc,port2口给cpu,一根网线,cpu和bmc都有不同的ip。bmc中ifconfig会多出eth1(顺位,原来有eth0,不是eth3),ssh admin@eth1_ip和ssh root@eth1_ip能登上cpu和bmc,cpu端ifconfig没变化,如下phy-mode不写也可以。如下在烧录的机器上烧录镜像后,vi第一行.dep文件。

持续更新ing... 149

uboot 的i2c读写,i2c_read(u_int8_t chip, u_int32_t addr, int alen, u_int8_t *buf, int len),u-boot,i2c_wr

【转帖请注明出处:blog.youkuaiyun.com/lanmanck】 看格式,介绍参数好了: int i2c_read(u_int8_t chip, //芯片的i2c地址,不包含读写位 u_int32_t addr, //芯片内的读写地址,比如寄存器地址 int alen, //这个要看代码才知道是地址的长度。比如有的flash比较大就有16位地址。               //uboo

流水mpc 1234

RK3568平台入门到精通系列讲解之UBOOT开发篇(I2C操作)

RK3568平台入门到精通系列讲解之UBOOT开发篇(I2C操作)

4587

uboot 的i2c_read

int i2c_read(u8 dev,                     //i2c设备地址                    uint addr,                  //读i2c设备的数据起始地址,比如e2                    int alen,                    //e2的地址位数,0为8位,1为16位,2为32位

学习是为了探索这个世界的本质 3280

深入瑞芯微ISP生态:手把手配置RK3588上的RKAIQ Server并与Windows端RKISP Tuner联调

本文详细介绍了如何在RK3588平台上配置RKAIQ Server并与Windows端的RKISP Tuner进行联调,以实现高效的ISP调优。从环境准备、服务部署到实战调试,涵盖了IMX415相机适配等关键步骤,帮助开发者快速掌握瑞芯微ISP生态的核心技术。

weixin_32447969的博客 670

Shopee 虾皮API接口:商品详情采集的实践

随着电商行业的蓬勃发展,数据采集和分析在商业决策中扮演着越来越重要的角色。Shopee作为东南亚领先的电商平台,拥有大量的商品数据。通过Shopee的API接口,我们可以方便地获取商品详情,为数据分析和市场研究提供有力支持。本文将介绍如何使用Shopee API接口采集商品详情,并分享一些实践技巧。提供了丰富的数据接口,包括商品详情、店铺信息、订单数据等。通过API接口,开发者可以轻松地获取Shopee平台上的数据,进行进一步的处理和分析。Shopee API接口:商品详情采集的实践与技巧。

An4480的博客 1886

Uboot关于i2c和EEPROM的命令

在uboot命令行下输入i2c并回车,会打印出i2c所有命令的使用方法: 比如i2c dev会打印出目前挂载的i2c设备: i2c probe是对i2c设备地址的寻找: i2c md命令是从i2c设备读取数据,在这里本人用的是beaglebone black,然后就选择EEPROM这个内置的i2c设备进行读取 要注意的是md命令的参数,第一个是chi

hahachenchen789的博客 7082

多个MOS管并联应用场景的四大要点

动态运行时,阈值电压Vgsth最低的MOS管首先打开,最后关闭。这种MOS管一般会占据更多的开关损耗,并且在开关转换过程中,承担了更高的电应力。

VBsemi的博客 3748

I2C的使用讲解

1、I2C 本文以韦东山视频为基础,作如下笔记。 I2C硬件上的接法: 如下图所示,主控芯片引出两条线SCL,SDA线,在一条I2C总线上可以接很多I2C设备。数据可以从主设备传到从设备上,从设备也能传数据到主设备上,即双向传输。 读写操作: 刚开始主芯片要发出一个start信号,然后发出一个设备地址(用来确定是往哪一个芯片写数据),读/写(0表示写,1表示读)。 回应(用来确定这个设备是否存在...

qq_41816308的博客 2万+

OpenCLI入门:让任何网站变成你的命令行工具(超详细版)

最有用的工具,往往是最简单的。 opencli就是这样。 它不会帮你写代码,不会帮你做决策,但它能把200+个平台装进你的命令行。 让你用最简单的方式,获取最丰富的数据。

weixin_66295112的博客 2089

深入解析STM32定时器中央对齐模式3的双中断机制

本文深入解析了STM32定时器中央对齐模式3的双中断机制。该模式在一个PWM周期内,会在计数器到达ARR(上溢)和0(下溢)时各触发一次更新中断,实现更精细的实时控制。文章详细阐述了其工作原理、配置方法,并指导如何在中断服务函数中通过DIR位区分中断来源,同时探讨了其在电机控制、数字电源等场景下的应用优势与CPU负载挑战。

weixin_29164185的博客 492

I2C设备调试技巧(uboot命令、i2c detect)

Uboot关于i2c的命令以及对应调试

ldysl111的博客 9268

使用示波器通过串口抓取数据波形

当我们在软件上发送一个数据,需要在示波器上正确的显示发送数据的波形时,这个过程是需要按照软件上串口配置的参数对示波器进行调节的,本次使用的示波器(型号为RIGOL DS1102Z-E)外观如下图所示,本次对采集波形的调节主要用到以下几处按钮。具体是两条导线T+连接R+、T-连接R-,连接完毕后,打开XCOM软件,首先配置好参数后打开串口,如下所示,若在发送窗口发送数据在接收窗口可以实时显示到的话,证明串口的收发功能是正常的。1.CH1、CH2是示波器上的两个采集通道,本次波形采集使用的是CH1通道。

weixin_58061628的博客 1万+

UBOOT下I2C调试命令使用

UBOOT下I2C调试命令使用:

9527的专栏 1万+

PD3.0详解 电源规则,全解!!!全解!!!

电源规则 大师匈今天谈一下PD3.0的电源规则,PD3.0标准标定的规则。 USB协议声称,为了世界和平世界环境,让大家用上统一标准的充电器,不用再为每一个用电设备都配一个专门的充电器,这些充电器各种各样的都有,所以有时候大师匈也很烦!!!那么为了维护世界和平,USB协议呢就制订了这个PD快充协议,还有它的规则,只要全世界都用PD,就解决了这个大问题。 在这里先了解一个关键字,PDP: Power Delivery Power PD电源的功率。 每个PD充电产品的功率要以0.5W的精度上报,比如大师匈做的P

大师匈的博客 1万+

DAVIS前言:事件相机资料调研

Event-Camera 资料集锦 1. 官网资料 假设了你买了事件相机,就可以在以下几个链接了解相关的参数和gui界面安装,如果不喜欢gui界面安装,可以第2节,安装相关的源码驱动。 DVS/DAVIS产品说明 等相关产品的软硬件介绍。 iniVation DV教程文档 给出在不同平台下的dvs-gui界面,可按照其说明进行相应的操作。 另外,Neuromorphic vision com...

Ian的博客 4507

(二十)linux中i2c的ioctl,write,read函数的使用

一、ioctl函数的使用:原型:structioctl(struct file *file,unsigned int cmd,unsigned long arg);cmd有I2C_SLAVE,I2C_SLAVE_FORCE,I2C_TENBIT,I2C_S3C2410_SET_SPEED几个选项;I2C_SLAVE:对应的arg取值为I2C从机地址,用来设定I2C从机地址; I2C_SLA...

weixin_30460489的博客 1233

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

I2C读写驱动客户端

命令号 (I2C_IOCTL_READ 和 I2C_IOCTL_WRITE):通过宏定义,I2C_IOCTL_READ 和 I2C_IOCTL_WRITE 被替换为具体的数值(分别为 1 和 2)。在 ioctl 函数调用中,I2C_IOCTL_READ 和 I2C_IOCTL_WRITE 是宏定义的常量,它们的值分别为 1 和 2。在你的代码中,这就是 I2C_IOCTL_READ(等于1)和 I2C_IOCTL_WRITE(等于2)。

majhuaiii的博客 807

SIMATIC S7-1200, S7-1500 PID 控制[手册]

SIMATIC S7-1200, S7-1500 PID 控制[手册]

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

UBOOT I2C读写详解(基于mini2440)

mini2440 UBOOT I2C支持总结 1. mini2440开发板I2C连接的设备   SDA/SCL对应的引脚:      2. AT24C08地址 查看AT24C08芯片手册   ADDRESS数据段为1010xxx(xxx为A2/A1/A0pin脚连接的电平),由于这里A2/A1/A0都为低电平,所以地址为1010000即0x50   3. UBOOT下12C调

luoguoxian12的博客 4670

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

u-boot i2c 的调试

转载:http://bbs.ednchina.com/BLOG_ARTICLE_1981597.HTM   有许多外设芯片都通过i2c总线接到主芯片上,主芯片通过i2c发命令去初始化外设芯片。 I.MX5x 至少有3个外设芯片需要接到i2c总线上,由主芯片在初始化时配置外围芯片。分别是音频codec sgtl5000,  方向传感器mma7660, 还有EInk屏的pmic 芯片tps651...

weixin_33869377的博客 767

语法: data=i2c_read( );

I2C_READ()是PIC CCS编译器中PIC单片机的专有函数。

weixin_42550185的博客 455
上一篇: nand flash 的ce don't care 的意思。ce donot care meaning.
下一篇: 低功耗视频解码芯片-TVP5150
#Page#
博客等级 码龄23年 1691粉丝 360原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值