spi

Spidev do not write/read simultaneously using ioctl

徘徊边缘 提交于 2019-12-04 03:47:19
I hope to find some help even if this issue might be more hardware than software related (we'll see). I'm working on a custom board based on Freescales P1021 processor (ppc, e500v2 core). A external PCB will be connected and could be configured by SPI. The specifications of this external PCB reads as it expects a 2-byte command in full duplex mode and that only the last byte is used to transfer data back on MISO. Knowing this i currently work to prepare some pieces of software to test this device. So I started with the well known spi_test program. root@p1021rdb:~# ./spi_test -D /dev

SDHC microSD card and SPI initialization

三世轮回 提交于 2019-12-04 03:25:18
I have a 32 GB Kingston SDHC microSD card which has to communicate to MSP430F2618 via SPI . I was not able to initialize it by using CMD55 + ACMD41 (with bit30 set to 1), as it is described in SD specification paper. What works is this sequence: CMD0, arg: 0 , CRC: 0x95 (response:0x01) CMD8, arg: 0x1AA , CRC: 0x87 (response:0x01) CMD1, arg: 0x40000000, CRC: 0xFF (response:0x00) I tried it also with a 8 GB SanDisk card and works for that too. So actually, I am using CMD1 here, not ACMD41, with HCS bit set to 1. However, it is not stable, sometimes it works, sometimes it does not. This may be

spi通信

守給你的承諾、 提交于 2019-12-03 21:01:34
  spi总线特点是一主多从结构,四线制,全双工,速度最大为10mbp/s.其机理是主从机内部的移位寄存器进行数据交换,从高位开始。有四种工作模式,主要是根据CPOL和CPHA的设置。一般的从机器件在出厂前已经设置完毕。 其程序如下: spi_mo=0; spi_mi=0; spi_scl=0; //上升沿输出 void spi_write(int data) { int i,temp; temp=data; for (i=0;i<8;i++) { spi_scl=0; if (data&0x80) spi_mo=1; esle spi_mo=0; spi_scl=1; data=data<<1; } } //下降沿采样 void spi_read() { int i, data; for(i=0;i<8;i++) { data<<1; spi_sck=1; if (spi_mi) data+=1; spi_sck=0; } return data; } 来源: https://www.cnblogs.com/xuehaiwuya0000/p/11808844.html

RTT学习之SPI设备

最后都变了- 提交于 2019-12-03 13:13:52
SPI 分为主、从、设备;具体又分标准SPI/DUAL SPI/QUAD SPI(用80字节的RAM rt_err_t rt_spi_take_bus(struct rt_spi_device *device); 代替收发寄存器) 从设备的操作:在多线程通讯中,从机需要先获得SPI总线、CS使能;使用完后再分别释放,从而使其它获得控制权。 rt_err_t rt_spi_take_bus(struct rt_spi_device *device); rt_err_t rt_spi_take(struct rt_spi_device *device); rt_err_t rt_spi_release(struct rt_spi_device *device); rt_err_t rt_spi_release_bus(struct rt_spi_device *device); void rt_spi_message_append (struct rt_spi_message * list, struct rt_spi_message *message);//单链表发送一条消息 二 主设备的操作: 2.1 先挂载已经注册好的SPI设备, rt_err_t rt_spi_bus_attach_device(struct rt_spi_device *device, const char

Who calls “probe” function in driver code?

怎甘沉沦 提交于 2019-12-03 08:44:16
问题 I am trying to understand this driver code of mcspi for omap2 panda board. I don't understand who calls the probe function and what is the call chain in this driver code? How does the driver is informed when the device is connected? 回答1: The probe function from spi-omap2-mcspi.c is saved in the static struct platform_driver omap2_mcspi_driver , which is registered with module_platform_driver(omap2_mcspi_driver); (at the end of file). The module_platform_driver macro, defined in platform

flash的几种模式Normal Mode、DUAL Mode、Quad Mode的概念和区别

痴心易碎 提交于 2019-12-03 07:32:12
概念 1. 标准SPI   标准SPI通常就称SPI,它是一种串行外设接口规范,有4根引脚信号:clk , cs, mosi, miso 2. Dual SPI   它只是针对SPI Flash而言,不是针对所有SPI外设。对于SPI Flash,全双工并不常用,因此扩展了mosi和miso的用法,让它们工作在半双工,用以加倍数据传输。也就是对于Dual SPI Flash,可以发送一个命令字节进入dual mode,这样mosi变成SIO0(serial io 0),mosi变成SIO1(serial io 1),这样一个时钟周期内就能传输2个bit数据,加倍了数据传输 3. Qual SPI   与Dual SPI类似,也是针对SPI Flash,Qual SPI Flash增加了两根I/O线(SIO2,SIO3),目的是一个时钟内传输4个bit 所以对于SPI Flash,有标准spi flash,dual spi , qual spi 三种类型,分别对应3-wire, 4-wire, 6-wire,在相同clock下,线数越多,传输速率越高。 接口说明 1 接口类型: Standard SPI: CLK, /CS, DI, DO, /WP, /Hold Dual SPI: CLK, /CS, IO0, IO1, /WP, /Hold Quad SPI: CLK, /CS,

Dubbo源码分析(6):Dubbo内核实现之基于SPI思想Dubbo内核实现

你离开我真会死。 提交于 2019-12-03 06:02:57
SPI接口定义 定义了@SPI注解 package com.alibaba.dubbo.common.extension; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * 扩展点接口的标识。 * <p /> * 扩展点声明配置文件,格式修改。<br /> * 以Protocol示例,配置文件META-INF/dubbo/com.xxx.Protocol内容:<br /> * 由<br/> * <pre><code>com.foo.XxxProtocol com.foo.YyyProtocol</code></pre><br/> * 改成使用KV格式<br/> * <pre><code>xxx=com.foo.XxxProtocol yyy=com.foo.YyyProtocol * </code></pre> * <br/> * 原因:<br/> * 当扩展点的static字段或方法签名上引用了三方库, *

How can i change the cursor (image) in the whole windows OS

匿名 (未验证) 提交于 2019-12-03 01:06:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I need to change the cursor in all windows, not just in the application, i have try this: this.Cursor = Cursors.WaitCursor; And this: System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; But it only changes the cursor in my application. Any idea? 回答1: Assuming you have your own cursor file (.cur) to apply you could hack this. First you will have to change thje default Arrow cursor in the Registry, then you will need to call some P-Invoke to allow the OS to update the current sytem paramerters so the cursor actually

华为 配置采用手工方式建立IPSec隧道

匿名 (未验证) 提交于 2019-12-03 00:38:01
一、组网需求 1、如图所示,RouterA为企业分支网关,RouterB为企业总部网关,分支与总部通过公网建立通信。分支子网为10.1.1.0/24,总部子网为10.1.2.0/24。 企业希望对分支子网与总部子网之间相互访问的流量进行安全保护。分支与总部通过公网建立通信,可以在分支网关与总部网关之间建立一个IPSec隧道来实施安全保护。由于维护网关较少,可以考虑采用手工方式建立IPSec隧道。 2、网络拓扑 3、采用如下思路配置采用手工方式建立IPSec隧道: 配置接口的IP地址和到对端的静态路由,保证两端路由可达。 配置ACL,以定义需要IPSec保护的数据流。 配置IPSec安全提议,定义IPSec的保护方法。 配置安全策略,并引用ACL和IPSec安全提议,确定对何种数据流采取何种保护方法。 在接口上应用安全策略组,使接口具有IPSec的保护功能。 二、操作步骤 1、配置接口IP地址 <Huawei>system-view [Huawei]sysname RouterA [RouterA]interface GigabitEthernet 0/0/2 [RouterA-GigabitEthernet0/0/2]ip address 10.1.1.1 24 [RouterA-GigabitEthernet0/0/2]q [RouterA]interface

SPI方式读取汉字字库芯片

匿名 (未验证) 提交于 2019-12-03 00:36:02
需求: 在液晶屏上显示指定的汉字 方案1:以带有汉字的图片形式显示 否定原因: 1)在画面展示时,会覆盖显示背景,不美观协调 2)需要先由图片格式转换成位图格式,不连贯,不方便 方案2:通过直接读取汉字字库芯片获得位图数据进行显示 选择原因: 1)在画面展示时,不会覆盖显示背景,美观协调 2)直接获取位图格式数据,连贯,方便 选定方案2后,硬件方面,需要在主板(还是背板?)上增加汉字字库芯片模块 汉字字库芯片使用方法(芯片厂家说明书上是这么说的): 1)得到指定汉字对应的内码 2)通过本手册提供的方法计算出在芯片内的地址 3)即可从地址连续读出字符点阵数据 字库芯片驱动: 1)SPI总线接口的初始化(尤其是MOSI/MISO/SCLK/CS#引脚的对应) 2)SPI读写函数 实际上,可从芯片厂家处获取相关库文件(.lib),直接调用库函数即可获取相应点阵数据,以12*12点阵函数为例: void gt_12_GetData (unsigned char MSB,unsigned char LSB,unsigned char *DZ_Data); 汉字内码的获取方法: 汉字字符串在寄存器以内码形式存储,通过unsigned char *指针,指向指定的汉字字符串(例:“中国长城”) 得到点阵数据后,根据厂家的字符排列格式(一般为横置横排)编写对应的代码。 本工程的主要工作即如上所述。